{
	"openapi": "3.1.0",
	"info": {
		"title": "Smileline API",
		"version": "0.1.0",
		"description": "Organization-scoped CRM API using Bearer API keys or browser sessions. Explicitly public contracts use their documented token boundary."
	},
	"servers": [
		{
			"url": "https://api-eu.smileline.io",
			"description": "Production EU"
		},
		{
			"url": "https://api-us.smileline.io",
			"description": "Production US"
		},
		{
			"url": "https://api-stage.smileline.io",
			"description": "Staging"
		},
		{
			"url": "http://localhost:8787",
			"description": "Local dev"
		}
	],
	"security": [
		{
			"bearerAuth": []
		},
		{
			"oauth2": [
				"read"
			]
		},
		{
			"oauth2": [
				"write"
			]
		},
		{
			"oauth2": [
				"dialer"
			]
		}
	],
	"tags": [
		{
			"name": "patients"
		},
		{
			"name": "marketing-consent"
		},
		{
			"name": "saved-views"
		},
		{
			"name": "journeys"
		},
		{
			"name": "pipelines"
		},
		{
			"name": "tasks"
		},
		{
			"name": "today"
		},
		{
			"name": "reports"
		},
		{
			"name": "calendar"
		},
		{
			"name": "inbox"
		},
		{
			"name": "report-subscriptions"
		},
		{
			"name": "notifications"
		},
		{
			"name": "Team chat"
		},
		{
			"name": "campaigns"
		},
		{
			"name": "bootstrap"
		},
		{
			"name": "billing"
		},
		{
			"name": "organization"
		},
		{
			"name": "appointments"
		},
		{
			"name": "settings"
		},
		{
			"name": "capture"
		},
		{
			"name": "site"
		},
		{
			"name": "ingest-review"
		},
		{
			"name": "intake-review"
		},
		{
			"name": "leads"
		},
		{
			"name": "connected-apps"
		},
		{
			"name": "outbound-webhooks"
		},
		{
			"name": "templates"
		},
		{
			"name": "AI Voice"
		},
		{
			"name": "chat-widget"
		},
		{
			"name": "widget"
		},
		{
			"name": "booking"
		},
		{
			"name": "scheduling"
		},
		{
			"name": "Channel connections"
		},
		{
			"name": "pms"
		},
		{
			"name": "automations"
		},
		{
			"name": "payments"
		},
		{
			"name": "deposits"
		},
		{
			"name": "referrals"
		},
		{
			"name": "dialer"
		},
		{
			"name": "voice"
		},
		{
			"name": "dialer-connections"
		},
		{
			"name": "audit-log"
		},
		{
			"name": "data-transfer"
		},
		{
			"name": "lead-ads"
		},
		{
			"name": "agreements"
		},
		{
			"name": "reputation-public"
		},
		{
			"name": "reputation"
		},
		{
			"name": "seo"
		},
		{
			"name": "seo-google"
		},
		{
			"name": "seo-public"
		},
		{
			"name": "ads"
		},
		{
			"name": "Clinical storage"
		},
		{
			"name": "Treatment plans"
		},
		{
			"name": "Clinical notes"
		},
		{
			"name": "Medical history"
		},
		{
			"name": "Patient forms"
		},
		{
			"name": "Recalls"
		},
		{
			"name": "Ledger"
		},
		{
			"name": "Invoices"
		},
		{
			"name": "Card terminal"
		},
		{
			"name": "Perio"
		},
		{
			"name": "Insurance"
		},
		{
			"name": "NHS"
		},
		{
			"name": "Prescriptions"
		},
		{
			"name": "Lab cases"
		},
		{
			"name": "Clinical referrals"
		},
		{
			"name": "Letters"
		},
		{
			"name": "Waitlist"
		},
		{
			"name": "Treatment templates"
		},
		{
			"name": "Statements"
		},
		{
			"name": "Memberships"
		},
		{
			"name": "Payment plans"
		},
		{
			"name": "Till"
		},
		{
			"name": "Accounting"
		},
		{
			"name": "Compliance"
		},
		{
			"name": "Practice archive"
		},
		{
			"name": "Sistema TS"
		}
	],
	"paths": {
		"/patients": {
			"get": {
				"summary": "List patients",
				"tags": [
					"patients"
				],
				"description": "Paginated list. q is a typo-tolerant (trigram) search over name, email, phones, fiscal code and address (street, city, postal code). `filters` is URL-encoded JSON matching the PatientFilters schema; keys are AND-ed. sort=relevance ranks by similarity to q. embed=tags attaches each row's tags. Archived patients are excluded unless includeArchived=true or a status filter asks for archived.",
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "createdAt",
							"type": "string",
							"enum": [
								"createdAt",
								"updatedAt",
								"lastName",
								"firstName",
								"status",
								"dateOfBirth",
								"city",
								"email",
								"relevance"
							]
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"default": "desc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 4000
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "tags"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"enquiry",
								"lead",
								"patient",
								"inactive",
								"archived",
								"deceased"
							]
						}
					},
					{
						"name": "tagId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "leadSourceId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientListItem"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a patient",
				"tags": [
					"patients"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"title": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"firstName": {
										"type": "string",
										"minLength": 1
									},
									"lastName": {
										"type": "string"
									},
									"preferredName": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"ethnicityCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 16
											},
											{
												"type": "null"
											}
										]
									},
									"dateOfBirth": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"gender": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"male",
													"female",
													"other",
													"unknown"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"fiscalCode": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"stsOpposition": {
										"type": "boolean"
									},
									"email": {
										"anyOf": [
											{
												"type": "string",
												"format": "email",
												"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneMobile": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneOther": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"province": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"country": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"language": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"preferredContactMethod": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"phone",
													"sms",
													"email",
													"whatsapp"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"preferredContactTime": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"smsOptOut": {
										"type": "boolean"
									},
									"emailOptOut": {
										"type": "boolean"
									},
									"whatsappOptOut": {
										"type": "boolean"
									},
									"leadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"referredByPatientId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"medicalAlert": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultPriceListId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"dentistPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"hygienistPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"customFields": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									}
								},
								"required": [
									"firstName"
								],
								"description": "Requires at least one of email or phoneMobile."
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Patient"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/export": {
			"get": {
				"summary": "Export patients as CSV",
				"tags": [
					"patients"
				],
				"description": "Same filtering as GET /patients (q, filters, includeArchived…). `columns` selects and orders the CSV columns; `ids` restricts to a selection. Caps at 10000 rows — code EXPORT_TOO_LARGE.",
				"parameters": [
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "createdAt",
							"type": "string",
							"enum": [
								"createdAt",
								"updatedAt",
								"lastName",
								"firstName",
								"status",
								"dateOfBirth",
								"city",
								"email",
								"relevance"
							]
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"default": "desc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 4000
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"enquiry",
								"lead",
								"patient",
								"inactive",
								"archived",
								"deceased"
							]
						}
					},
					{
						"name": "tagId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "leadSourceId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "columns",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^[a-zA-Z]+(,[a-zA-Z]+)*$"
						}
					},
					{
						"name": "ids",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36})*$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"text/csv": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/bulk/tags": {
			"post": {
				"summary": "Add/remove tags on many patients",
				"tags": [
					"patients"
				],
				"description": "Idempotent per patient-tag pair; ids outside the organization are ignored. Returns the number of patients touched.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientIds": {
										"minItems": 1,
										"maxItems": 500,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"addTagIds": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"removeTagIds": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"patientIds"
								],
								"description": "Requires at least one of addTagIds or removeTagIds."
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"updated": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"skipped": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"mergedIntoPatientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"patientId",
													"mergedIntoPatientId"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"updated",
										"skipped"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/bulk/location": {
			"post": {
				"summary": "Assign many patients to a location",
				"tags": [
					"patients"
				],
				"description": "Sets (or clears, with locationId=null) the location on every listed patient; ids outside the organization are ignored. Returns the number of patients touched.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientIds": {
										"minItems": 1,
										"maxItems": 500,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"patientIds",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"updated": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"skipped": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"mergedIntoPatientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"patientId",
													"mergedIntoPatientId"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"updated",
										"skipped"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/bulk/archive": {
			"post": {
				"summary": "Archive many patients",
				"tags": [
					"patients"
				],
				"description": "Sets archivedAt and status=archived on every listed patient still unarchived. Requires the patient delete permission. 409 ARCHIVE_REASON_REQUIRED (details.underCalledLeads) when the selection holds leads under five contact attempts and no reason was sent; nothing is archived.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientIds": {
										"minItems": 1,
										"maxItems": 500,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"reason": {
										"type": "string",
										"minLength": 1
									}
								},
								"required": [
									"patientIds"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"updated": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"skipped": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"mergedIntoPatientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"patientId",
													"mergedIntoPatientId"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"updated",
										"skipped"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}": {
			"get": {
				"summary": "Get a patient with tags",
				"tags": [
					"patients"
				],
				"description": "embed=timeline,journeys,touches folds the first timeline page, the patient's journeys and the capture-attribution touches into the response — a detail view's single data call.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(timeline|journeys|touches|pms|deposits|referral|marketing)(,(timeline|journeys|touches|pms|deposits|referral|marketing))*$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PatientDetail"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a patient",
				"tags": [
					"patients"
				],
				"description": "409 PATIENT_MERGED when the patient was merged into another record; the survivor's id rides on details.mergedIntoPatientId.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"title": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"firstName": {
										"type": "string",
										"minLength": 1
									},
									"lastName": {
										"type": "string"
									},
									"preferredName": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"ethnicityCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 16
											},
											{
												"type": "null"
											}
										]
									},
									"dateOfBirth": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"gender": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"male",
													"female",
													"other",
													"unknown"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"fiscalCode": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"stsOpposition": {
										"type": "boolean"
									},
									"email": {
										"anyOf": [
											{
												"type": "string",
												"format": "email",
												"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneMobile": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneOther": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"province": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"country": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"language": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"preferredContactMethod": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"phone",
													"sms",
													"email",
													"whatsapp"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"preferredContactTime": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"smsOptOut": {
										"type": "boolean"
									},
									"emailOptOut": {
										"type": "boolean"
									},
									"whatsappOptOut": {
										"type": "boolean"
									},
									"leadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"referredByPatientId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"medicalAlert": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultPriceListId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"dentistPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"hygienistPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"customFields": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									},
									"status": {
										"type": "string",
										"enum": [
											"enquiry",
											"lead",
											"patient",
											"inactive",
											"deceased"
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Patient"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Erase a patient",
				"tags": [
					"patients"
				],
				"description": "Owner only. Permanently deletes the patient and everything keyed to them — journeys, activities, conversations, calls, voicemails and transcripts — and schedules every stored call recording for deletion, all in one transaction: if anything fails the patient and their recordings are untouched. This is the right-to-erasure action; use Archive to hide a record while keeping its history.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										},
										"recordingsScheduled": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"ok",
										"recordingsScheduled"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/archive": {
			"post": {
				"summary": "Archive a patient",
				"tags": [
					"patients"
				],
				"description": "Sets archivedAt and status=archived. Idempotent. 409 PATIENT_MERGED when the patient was merged into another record. 409 ARCHIVE_REASON_REQUIRED when a lead under five contact attempts is archived without a reason; the reason is saved on the timeline.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Patient"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/export": {
			"get": {
				"summary": "Export everything held about one patient",
				"tags": [
					"patients"
				],
				"description": "The subject-access package as JSON: profile, calls, voicemails, transcripts, and short-lived signed links to stored recordings. The export is written to the audit log; the links are not.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"exportedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"profile": {
											"$ref": "#/components/schemas/Patient"
										},
										"calls": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"direction": {
														"type": "string",
														"enum": [
															"inbound",
															"outbound"
														]
													},
													"fromNumber": {
														"type": "string"
													},
													"toNumber": {
														"type": "string"
													},
													"status": {
														"type": "string"
													},
													"startedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"answeredAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"endedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"durationSec": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"voicemail": {
														"type": "boolean"
													},
													"note": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"disposition": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"recordingUrl": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"direction",
													"fromNumber",
													"toNumber",
													"status",
													"startedAt",
													"answeredAt",
													"endedAt",
													"durationSec",
													"voicemail",
													"note",
													"disposition",
													"recordingUrl"
												],
												"additionalProperties": false
											}
										},
										"voicemails": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"callLogId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"fromNumber": {
														"type": "string"
													},
													"durationSec": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"heardAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"required": [
													"id",
													"callLogId",
													"fromNumber",
													"durationSec",
													"heardAt",
													"createdAt"
												],
												"additionalProperties": false
											}
										},
										"transcripts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"callLogId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"source": {
														"type": "string"
													},
													"language": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"text": {
														"type": "string"
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"required": [
													"callLogId",
													"source",
													"language",
													"text",
													"createdAt"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"exportedAt",
										"profile",
										"calls",
										"voicemails",
										"transcripts"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/timeline": {
			"get": {
				"summary": "Patient activity timeline",
				"tags": [
					"patients"
				],
				"description": "Activities for the patient, newest first.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "type",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"note",
								"call",
								"sms",
								"email",
								"whatsapp",
								"webchat",
								"messenger",
								"instagram",
								"form_submission",
								"stage_change",
								"status_change",
								"task_event",
								"appointment_event",
								"pms_event",
								"system",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Activity"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/notes": {
			"post": {
				"summary": "Add a note to the patient timeline",
				"tags": [
					"patients"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"body": {
										"type": "string",
										"minLength": 1
									},
									"journeyId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Activity"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/tags": {
			"post": {
				"summary": "Add a tag to a patient",
				"tags": [
					"patients"
				],
				"description": "Idempotent; returns the patient's current tags. 409 PATIENT_MERGED when the patient was merged into another record.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"tagId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"tagId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Tag"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/tags/{tagId}": {
			"delete": {
				"summary": "Remove a tag from a patient",
				"tags": [
					"patients"
				],
				"description": "Idempotent; returns the patient's current tags. 409 PATIENT_MERGED when the patient was merged into another record.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "tagId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Tag"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/marketing-preferences": {
			"get": {
				"summary": "Get a patient's per-channel marketing preferences",
				"tags": [
					"patients",
					"marketing-consent"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientContactPreference"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/marketing-preferences/{channel}": {
			"put": {
				"summary": "Record marketing consent or an opt-out with evidence",
				"tags": [
					"patients",
					"marketing-consent"
				],
				"description": "Writes the current projection and an append-only evidence event in one transaction. Soft opt-in must be recorded and is never inferred from patient status.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "channel",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"sms",
								"email",
								"whatsapp",
								"phone"
							]
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"status": {
												"type": "string",
												"const": "opted_in"
											},
											"basis": {
												"type": "string",
												"enum": [
													"explicit",
													"soft_opt_in"
												]
											},
											"source": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"noticeVersion": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"evidenceNote": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2000
											}
										},
										"required": [
											"status",
											"basis",
											"source"
										]
									},
									{
										"type": "object",
										"properties": {
											"status": {
												"type": "string",
												"const": "opted_out"
											},
											"source": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"noticeVersion": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"evidenceNote": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2000
											}
										},
										"required": [
											"status",
											"source"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PatientContactPreference"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/marketing/unsubscribe/{token}": {
			"get": {
				"summary": "Inspect a signed email marketing unsubscribe link",
				"tags": [
					"marketing-consent"
				],
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 32,
							"maxLength": 2000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MarketingUnsubscribe"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Unsubscribe from marketing using a signed link",
				"tags": [
					"marketing-consent"
				],
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 32,
							"maxLength": 2000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MarketingUnsubscribe"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/saved-views/{entity}": {
			"get": {
				"summary": "List saved views for an entity",
				"tags": [
					"saved-views"
				],
				"description": "The caller's own views plus org-shared views.",
				"parameters": [
					{
						"name": "entity",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"patients",
								"conversations"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SavedView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a saved view for an entity",
				"tags": [
					"saved-views"
				],
				"parameters": [
					{
						"name": "entity",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"patients",
								"conversations"
							]
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"name": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"shared": {
												"type": "boolean"
											},
											"position": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"filters": {
												"type": "object",
												"properties": {
													"status": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"enquiry",
																		"lead",
																		"patient",
																		"inactive",
																		"archived",
																		"deceased"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"gender": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"male",
																		"female",
																		"other",
																		"unknown"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"preferredContactMethod": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"phone",
																		"sms",
																		"email",
																		"whatsapp"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"email": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"phoneMobile": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"fiscalCode": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"city": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"province": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"postalCode": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"country": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"language": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"medicalAlert": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"note": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"dateOfBirth": {
														"type": "object",
														"properties": {
															"from": {
																"type": "string",
																"format": "date",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
															},
															"to": {
																"type": "string",
																"format": "date",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
															}
														},
														"additionalProperties": false
													},
													"createdAt": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"from": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"to": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	}
																},
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"preset": {
																		"type": "string",
																		"enum": [
																			"today",
																			"yesterday",
																			"thisWeek",
																			"lastWeek",
																			"thisMonth",
																			"lastMonth",
																			"last7days",
																			"last30days",
																			"last90days",
																			"last12months",
																			"last24months",
																			"thisYear"
																		]
																	}
																},
																"required": [
																	"preset"
																],
																"additionalProperties": false
															}
														]
													},
													"updatedAt": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"from": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"to": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	}
																},
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"preset": {
																		"type": "string",
																		"enum": [
																			"today",
																			"yesterday",
																			"thisWeek",
																			"lastWeek",
																			"thisMonth",
																			"lastMonth",
																			"last7days",
																			"last30days",
																			"last90days",
																			"last12months",
																			"last24months",
																			"thisYear"
																		]
																	}
																},
																"required": [
																	"preset"
																],
																"additionalProperties": false
															}
														]
													},
													"smsOptOut": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"emailOptOut": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"whatsappOptOut": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"leadSourceId": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"locationId": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"referrerId": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"tags": {
														"type": "object",
														"properties": {
															"anyOf": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"noneOf": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"journey": {
														"type": "object",
														"properties": {
															"exists": {
																"type": "boolean"
															},
															"statusIn": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"active",
																		"won",
																		"lost"
																	]
																}
															},
															"pipelineId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"stageIdIn": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															}
														},
														"additionalProperties": false
													}
												},
												"additionalProperties": false
											},
											"columns": {
												"maxItems": 30,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"name",
														"status",
														"contact",
														"email",
														"phoneMobile",
														"tags",
														"leadSource",
														"location",
														"city",
														"province",
														"dateOfBirth",
														"gender",
														"language",
														"preferredContactMethod",
														"smsOptOut",
														"emailOptOut",
														"whatsappOptOut",
														"fiscalCode",
														"createdAt",
														"updatedAt"
													]
												}
											},
											"sort": {
												"type": "string",
												"enum": [
													"createdAt",
													"updatedAt",
													"lastName",
													"firstName",
													"status",
													"dateOfBirth",
													"city",
													"email",
													"relevance"
												]
											},
											"direction": {
												"type": "string",
												"enum": [
													"asc",
													"desc"
												]
											}
										},
										"required": [
											"name"
										],
										"additionalProperties": false
									},
									{
										"type": "object",
										"properties": {
											"name": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"shared": {
												"type": "boolean"
											},
											"position": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"filters": {
												"type": "object",
												"properties": {
													"status": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"open",
																	"pending",
																	"snoozed",
																	"closed"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"channel": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"whatsapp",
																	"sms",
																	"email",
																	"webchat",
																	"messenger",
																	"instagram",
																	"telegram",
																	"tiktok",
																	"facebook_comments",
																	"instagram_comments"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assignee": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															{
																"type": "null"
															}
														]
													},
													"unread": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											}
										},
										"required": [
											"name"
										],
										"additionalProperties": false
									}
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SavedView"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/saved-views/{entity}/{id}": {
			"patch": {
				"summary": "Update a saved view",
				"tags": [
					"saved-views"
				],
				"description": "Owners edit their own views; org admins/owners may also edit shared views.",
				"parameters": [
					{
						"name": "entity",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"patients",
								"conversations"
							]
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"name": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"shared": {
												"type": "boolean"
											},
											"position": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"filters": {
												"type": "object",
												"properties": {
													"status": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"enquiry",
																		"lead",
																		"patient",
																		"inactive",
																		"archived",
																		"deceased"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"gender": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"male",
																		"female",
																		"other",
																		"unknown"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"preferredContactMethod": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"phone",
																		"sms",
																		"email",
																		"whatsapp"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"email": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"phoneMobile": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"fiscalCode": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"city": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"province": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"postalCode": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"country": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"language": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"medicalAlert": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"note": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"dateOfBirth": {
														"type": "object",
														"properties": {
															"from": {
																"type": "string",
																"format": "date",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
															},
															"to": {
																"type": "string",
																"format": "date",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
															}
														},
														"additionalProperties": false
													},
													"createdAt": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"from": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"to": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	}
																},
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"preset": {
																		"type": "string",
																		"enum": [
																			"today",
																			"yesterday",
																			"thisWeek",
																			"lastWeek",
																			"thisMonth",
																			"lastMonth",
																			"last7days",
																			"last30days",
																			"last90days",
																			"last12months",
																			"last24months",
																			"thisYear"
																		]
																	}
																},
																"required": [
																	"preset"
																],
																"additionalProperties": false
															}
														]
													},
													"updatedAt": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"from": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"to": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	}
																},
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"preset": {
																		"type": "string",
																		"enum": [
																			"today",
																			"yesterday",
																			"thisWeek",
																			"lastWeek",
																			"thisMonth",
																			"lastMonth",
																			"last7days",
																			"last30days",
																			"last90days",
																			"last12months",
																			"last24months",
																			"thisYear"
																		]
																	}
																},
																"required": [
																	"preset"
																],
																"additionalProperties": false
															}
														]
													},
													"smsOptOut": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"emailOptOut": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"whatsappOptOut": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"leadSourceId": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"locationId": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"referrerId": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"tags": {
														"type": "object",
														"properties": {
															"anyOf": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"noneOf": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"journey": {
														"type": "object",
														"properties": {
															"exists": {
																"type": "boolean"
															},
															"statusIn": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"active",
																		"won",
																		"lost"
																	]
																}
															},
															"pipelineId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"stageIdIn": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															}
														},
														"additionalProperties": false
													}
												},
												"additionalProperties": false
											},
											"columns": {
												"maxItems": 30,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"name",
														"status",
														"contact",
														"email",
														"phoneMobile",
														"tags",
														"leadSource",
														"location",
														"city",
														"province",
														"dateOfBirth",
														"gender",
														"language",
														"preferredContactMethod",
														"smsOptOut",
														"emailOptOut",
														"whatsappOptOut",
														"fiscalCode",
														"createdAt",
														"updatedAt"
													]
												}
											},
											"sort": {
												"type": "string",
												"enum": [
													"createdAt",
													"updatedAt",
													"lastName",
													"firstName",
													"status",
													"dateOfBirth",
													"city",
													"email",
													"relevance"
												]
											},
											"direction": {
												"type": "string",
												"enum": [
													"asc",
													"desc"
												]
											}
										},
										"additionalProperties": false
									},
									{
										"type": "object",
										"properties": {
											"name": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"shared": {
												"type": "boolean"
											},
											"position": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"filters": {
												"type": "object",
												"properties": {
													"status": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"open",
																	"pending",
																	"snoozed",
																	"closed"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"channel": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"whatsapp",
																	"sms",
																	"email",
																	"webchat",
																	"messenger",
																	"instagram",
																	"telegram",
																	"tiktok",
																	"facebook_comments",
																	"instagram_comments"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assignee": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															{
																"type": "null"
															}
														]
													},
													"unread": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											}
										},
										"additionalProperties": false
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SavedView"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a saved view",
				"tags": [
					"saved-views"
				],
				"parameters": [
					{
						"name": "entity",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"patients",
								"conversations"
							]
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys": {
			"get": {
				"summary": "List journeys",
				"tags": [
					"journeys"
				],
				"description": "Pass embed=patient to include a compact patient on each row.",
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "createdAt",
							"type": "string",
							"enum": [
								"createdAt",
								"enteredStageAt"
							]
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"default": "desc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "pipelineId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 4000
						}
					},
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "patient"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/JourneyWithPatient"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a journey",
				"tags": [
					"journeys"
				],
				"description": "Writes the initial stage transition and timeline activity, and promotes the patient from enquiry to lead.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"treatmentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"pipelineId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"stageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"ownerId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"potentialValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"snoozedUntil": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"customFields": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									}
								},
								"required": [
									"patientId",
									"treatmentId"
								],
								"description": "pipelineId defaults to the treatment's pipeline, then the org default; stageId to the pipeline's first stage; potentialValueCents to the treatment's default price."
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Journey"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}": {
			"get": {
				"summary": "Get a journey",
				"tags": [
					"journeys"
				],
				"description": "Pass embed=patient to include the same compact patient the list embeds, so a caller that needs both does not pay a second round trip.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "patient"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/JourneyWithPatient"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a journey",
				"tags": [
					"journeys"
				],
				"description": "Stage and status never change here — use move, close and reopen.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"treatmentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"ownerId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"potentialValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"confirmedValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"snoozedUntil": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"customFields": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Journey"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}/move": {
			"post": {
				"summary": "Move a journey to another stage",
				"tags": [
					"journeys"
				],
				"description": "Entering a \"won\" stage also sets status=won and closedAt.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"toStageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion",
									"toStageId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Journey"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}/close": {
			"post": {
				"summary": "Close a journey as won or lost",
				"tags": [
					"journeys"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"outcome": {
												"type": "string",
												"const": "lost"
											},
											"expectedVersion": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											},
											"lostReasonId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"lostNote": {
												"type": "string",
												"minLength": 1
											}
										},
										"required": [
											"outcome",
											"expectedVersion",
											"lostReasonId"
										]
									},
									{
										"type": "object",
										"properties": {
											"outcome": {
												"type": "string",
												"const": "won"
											},
											"expectedVersion": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"outcome",
											"expectedVersion"
										]
									}
								],
								"description": "Losing keeps the journey in its current stage; winning moves it to the pipeline's explicitly configured won stage."
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Journey"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}/reopen": {
			"post": {
				"summary": "Reopen a closed journey",
				"tags": [
					"journeys"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Journey"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}/junk": {
			"post": {
				"summary": "Mark a journey as junk",
				"tags": [
					"journeys"
				],
				"description": "A junk lead was never a real enquiry: ad-platform conversion feedback is suppressed for it, in addition to whatever the journey's own status says. Independent of losing — losing with a marksJunk reason stamps this automatically.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Journey"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Remove a journey's junk mark",
				"tags": [
					"journeys"
				],
				"description": "Clears the junk flag. Conversion events already suppressed while the journey was junk stay suppressed — suppression is the safe direction, and the ad platforms' upload windows may have passed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Journey"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines": {
			"get": {
				"summary": "List pipelines with their stages",
				"tags": [
					"pipelines"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PipelineWithStages"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a pipeline",
				"tags": [
					"pipelines"
				],
				"description": "Creates the required entry and won stages. isDefault=true atomically moves the organization's default pointer.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"isDefault": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Pipeline"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}": {
			"patch": {
				"summary": "Update a pipeline",
				"tags": [
					"pipelines"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"isDefault": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Pipeline"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}/archive": {
			"post": {
				"summary": "Archive a pipeline",
				"tags": [
					"pipelines"
				],
				"description": "Refused for the default pipeline or while active journeys sit in the pipeline.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Pipeline"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}/restore": {
			"post": {
				"summary": "Restore an archived pipeline",
				"tags": [
					"pipelines"
				],
				"description": "Clears archivedAt only — does NOT restore isDefault. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Pipeline"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/reorder": {
			"post": {
				"summary": "Reorder pipelines",
				"tags": [
					"pipelines"
				],
				"description": "Sets position for each item in one transaction; an unknown id rolls the batch back. Returns all pipelines (archived included) with their stages.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PipelineWithStages"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}/stages": {
			"post": {
				"summary": "Add a stage to a pipeline",
				"tags": [
					"pipelines"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"category": {
										"type": "string",
										"const": "open"
									},
									"systemKey": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"new",
													"contact_attempted",
													"contacted",
													"consultation_booked",
													"failed_to_attend",
													"consultation_attended",
													"treatment_started"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"probability": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 100
											},
											{
												"type": "null"
											}
										]
									},
									"rottenDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PipelineStage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}/stages/{stageId}": {
			"patch": {
				"summary": "Update a stage (rename, reorder, category, color)",
				"tags": [
					"pipelines"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "stageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"category": {
										"type": "string",
										"const": "open"
									},
									"systemKey": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"new",
													"contact_attempted",
													"contacted",
													"consultation_booked",
													"failed_to_attend",
													"consultation_attended",
													"treatment_started"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"probability": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 100
											},
											{
												"type": "null"
											}
										]
									},
									"rottenDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PipelineStage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}/stages/{stageId}/archive": {
			"post": {
				"summary": "Archive a stage",
				"tags": [
					"pipelines"
				],
				"description": "Refused (400) while active journeys sit in the stage.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "stageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PipelineStage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}/stages/{stageId}/restore": {
			"post": {
				"summary": "Restore an archived stage",
				"tags": [
					"pipelines"
				],
				"description": "Clears archivedAt only. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "stageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PipelineStage"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pipelines/{id}/stages/reorder": {
			"post": {
				"summary": "Reorder a pipeline's stages",
				"tags": [
					"pipelines"
				],
				"description": "Sets position for each item in one transaction; an id outside the pipeline rolls the batch back. Returns all of the pipeline's stages (archived included).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PipelineStage"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/tasks": {
			"get": {
				"summary": "List tasks",
				"tags": [
					"tasks"
				],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "dueAt",
							"type": "string",
							"enum": [
								"dueAt",
								"createdAt"
							]
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"default": "asc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"done",
								"cancelled"
							]
						}
					},
					{
						"name": "assigneeId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "journeyId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "due",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"overdue",
								"today",
								"upcoming"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Task"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a task",
				"tags": [
					"tasks"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"title": {
										"type": "string",
										"minLength": 1
									},
									"kind": {
										"type": "string",
										"minLength": 1
									},
									"note": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"dueAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"priority": {
										"type": "string",
										"enum": [
											"normal",
											"urgent"
										]
									},
									"patientId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"assigneeId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"title"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Task"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}": {
			"get": {
				"summary": "Get a task",
				"tags": [
					"tasks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Task"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a task",
				"tags": [
					"tasks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"title": {
										"type": "string",
										"minLength": 1
									},
									"kind": {
										"type": "string",
										"minLength": 1
									},
									"note": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"dueAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"priority": {
										"type": "string",
										"enum": [
											"normal",
											"urgent"
										]
									},
									"patientId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"assigneeId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"status": {
										"type": "string",
										"enum": [
											"open",
											"cancelled"
										]
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Task"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/complete": {
			"post": {
				"summary": "Complete a task",
				"tags": [
					"tasks"
				],
				"description": "Sets status=done, stamps completedAt/completedById and appends a timeline activity when the task has a patient. Idempotent. 409 when the lead is locked by another user on the Today page.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Task"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/outcome": {
			"post": {
				"summary": "Record a contact outcome for a task",
				"tags": [
					"tasks"
				],
				"description": "Composite wizard commit, atomic: completes the task, stamps the journey's first-contact timestamps, moves the journey forward to the matching systemKey stage when the pipeline has one (booked targets consultation_booked), closes the journey as lost for outcome=not_proceeding (optional lostReasonId), optionally confirms the value (booked), books the consultation into the own diary (`booking`, needs appointment:create; a site a PMS connection covers answers 409 PMS_MANAGED_SITE) or links an existing booked/confirmed appointment (`appointmentId`, needs appointment:update), creates a follow-up task and appends a human-readable timeline activity. Returns an undo receipt valid for 60 seconds; undo never cancels the booking. 409 when the task is not open (TASK_ALREADY_DONE) or the lead is locked by another user (LOCKED); 422 when the site books by chair and no operatory was sent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"contacted": {
												"type": "boolean",
												"const": true
											},
											"outcome": {
												"type": "string",
												"enum": [
													"considering",
													"callback_later",
													"booked",
													"not_proceeding"
												]
											},
											"contactMethodId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"potentialValueCents": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"consultationAt": {
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											"booking": {
												"type": "object",
												"properties": {
													"requestId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"practitionerId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"operatoryId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"appointmentTypeId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"startsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"endsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"overbookReason": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"requestId",
													"locationId",
													"practitionerId",
													"startsAt",
													"endsAt"
												]
											},
											"appointmentId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"expectedVersion": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											},
											"note": {
												"type": "string",
												"minLength": 1
											},
											"followUp": {
												"type": "object",
												"properties": {
													"channel": {
														"type": "string",
														"enum": [
															"call",
															"sms",
															"email",
															"whatsapp"
														]
													},
													"dueAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"assigneeId": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"channel",
													"dueAt"
												]
											},
											"lostReasonId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"contacted",
											"outcome",
											"contactMethodId",
											"expectedVersion"
										]
									},
									{
										"type": "object",
										"properties": {
											"contacted": {
												"type": "boolean",
												"const": false
											},
											"outcome": {
												"type": "string",
												"enum": [
													"no_answer",
													"message_sent",
													"not_proceeding",
													"attended",
													"no_show"
												]
											},
											"contactMethodId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"expectedVersion": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											},
											"note": {
												"type": "string",
												"minLength": 1
											},
											"followUp": {
												"type": "object",
												"properties": {
													"channel": {
														"type": "string",
														"enum": [
															"call",
															"sms",
															"email",
															"whatsapp"
														]
													},
													"dueAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"assigneeId": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"channel",
													"dueAt"
												]
											},
											"lostReasonId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"contacted",
											"outcome",
											"expectedVersion"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TaskOutcomeReceipt"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/outcome/undo": {
			"post": {
				"summary": "Undo a just-recorded task outcome",
				"tags": [
					"tasks"
				],
				"description": "Corrects the composite outcome within 60 seconds: cancels the follow-up task, appends reverse transition/activity/correction events, restores the prior projection and reopens the task. History is never deleted. Only the user who recorded the outcome can correct it.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UndoTaskOutcome"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/today": {
			"get": {
				"summary": "The Today work queue",
				"tags": [
					"today"
				],
				"description": "The whole bucketed queue in one response, pre-sorted server-side against the practice's local day: uncontacted new leads (newest first), overdue tasks, today's tasks + enquiry triage cards, and tomorrow's follow-ups. Pass ?date=YYYY-MM-DD (today … today+41, practice-local) to preview a future day — those responses carry only that day's due tasks. Every response includes the rolling 42-day `week` counts.",
				"parameters": [
					{
						"name": "date",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "warm",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "selected"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TodayQueue"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/page/today": {
			"get": {
				"summary": "The Today page in one request",
				"tags": [
					"today"
				],
				"description": "The same payload as GET /today, resolved in a single database statement, plus `selected` — the first lead's work panel — when `?warm=selected` is sent on the initial load. Page endpoints exist to collapse a page's fan-out into one round-trip; prefer this over the per-resource endpoints when loading the page.",
				"parameters": [
					{
						"name": "date",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "warm",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "selected"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"buckets": {
											"type": "object",
											"properties": {
												"callNow": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/TodayTaskRow"
													}
												},
												"overdue": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/TodayTaskRow"
													}
												},
												"today": {
													"type": "array",
													"items": {
														"oneOf": [
															{
																"$ref": "#/components/schemas/TodayTaskRow"
															},
															{
																"$ref": "#/components/schemas/TodayEnquiryRow"
															}
														]
													}
												},
												"upcoming": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/TodayTaskRow"
													}
												}
											},
											"required": [
												"callNow",
												"overdue",
												"today",
												"upcoming"
											],
											"additionalProperties": false
										},
										"total": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"timezone": {
											"type": "string"
										},
										"serverTime": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"week": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TodayDayCount"
											}
										},
										"lookups": {
											"type": "object",
											"properties": {
												"dialer": {
													"$ref": "#/components/schemas/DialerBootstrap"
												},
												"entitlements": {
													"$ref": "#/components/schemas/Entitlements"
												},
												"payments": {
													"$ref": "#/components/schemas/PaymentsSummary"
												},
												"members": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/MemberSummary"
													}
												},
												"treatments": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/TreatmentSummary"
													}
												},
												"contactMethods": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/ContactMethod"
													}
												},
												"leadSources": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/LeadSource"
													}
												},
												"intakeReview": {
													"type": "object",
													"properties": {
														"items": {
															"type": "array",
															"items": {
																"$ref": "#/components/schemas/IntakeReviewIssue"
															}
														},
														"nextCursor": {
															"anyOf": [
																{
																	"type": "string"
																},
																{
																	"type": "null"
																}
															]
														},
														"reasonTotals": {
															"type": "object",
															"properties": {
																"archived_location": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"archived_treatment": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"archived_lead_source": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"invalid_optional_reference": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"intake_receipt_stalled": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"contact_value_unparsed": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"archived_location",
																"archived_treatment",
																"archived_lead_source",
																"invalid_optional_reference",
																"intake_receipt_stalled",
																"contact_value_unparsed"
															],
															"additionalProperties": false
														}
													},
													"required": [
														"items",
														"nextCursor",
														"reasonTotals"
													],
													"additionalProperties": false
												},
												"ingestReview": {
													"anyOf": [
														{
															"type": "object",
															"properties": {
																"openTotal": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"openTotal"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"missedCalls": {
													"anyOf": [
														{
															"type": "object",
															"properties": {
																"unreturned": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"unreturned"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"lostReasons": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/LostReason"
													}
												}
											},
											"required": [
												"dialer",
												"entitlements",
												"payments",
												"members",
												"treatments",
												"contactMethods",
												"leadSources",
												"intakeReview",
												"ingestReview",
												"missedCalls",
												"lostReasons"
											],
											"additionalProperties": false
										},
										"selectedDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"selected": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/TodaySelectedLead"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"buckets",
										"total",
										"timezone",
										"serverTime",
										"week",
										"lookups",
										"selectedDate",
										"selected"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/today/diary": {
			"get": {
				"summary": "The diary slice Today's slot picker draws",
				"tags": [
					"today"
				],
				"description": "One practice-local day (or up to seven) of appointments, working time, absences and closures — the /day-list shape without the lab-case flag — for a signed-in member with appointment:read. Today books consultations from it into the own diary or, for a site a PMS connection covers, through POST /pms/patients/:patientId/book.",
				"parameters": [
					{
						"name": "date",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "from",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"date": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"timezone": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"appointmentId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"firstName": {
														"type": "string"
													},
													"lastName": {
														"type": "string"
													},
													"preferredName": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"appointmentTypeName": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"treatmentName": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"status": {
														"type": "string",
														"enum": [
															"pending",
															"booked",
															"confirmed",
															"arrived",
															"in_chair",
															"fulfilled",
															"cancelled",
															"no_show"
														]
													},
													"startsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"endsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"version": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"practitionerIds": {
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"operatoryId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"appointmentTypeId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"note": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"isFirstVisit": {
														"type": "boolean"
													},
													"bookedVia": {
														"type": "string"
													},
													"phoneMobile": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"pmsManaged": {
														"type": "boolean"
													}
												},
												"required": [
													"appointmentId",
													"patientId",
													"firstName",
													"lastName",
													"preferredName",
													"appointmentTypeName",
													"treatmentName",
													"status",
													"startsAt",
													"endsAt",
													"version",
													"practitionerIds",
													"operatoryId",
													"locationId",
													"appointmentTypeId",
													"note",
													"isFirstVisit",
													"bookedVia",
													"phoneMobile",
													"pmsManaged"
												],
												"additionalProperties": false
											}
										},
										"working": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListInterval"
											}
										},
										"rotaPractitionerIds": {
											"type": "array",
											"items": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"absences": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListInterval"
											}
										},
										"closures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListClosure"
											}
										},
										"roster": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"practitionerId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"hasRota": {
														"type": "boolean"
													}
												},
												"required": [
													"practitionerId",
													"hasRota"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"date",
										"from",
										"to",
										"timezone",
										"locationId",
										"items",
										"working",
										"rotaPractitionerIds",
										"absences",
										"closures",
										"roster"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/today/diary/load": {
			"get": {
				"summary": "How full each day is, for Today's slot picker",
				"tags": [
					"today"
				],
				"description": "Bookable and booked minutes per practitioner per practice-local day (up to 100 days) for a signed-in member with appointment:read.",
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"timezone": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedDates": {
											"type": "array",
											"items": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											}
										},
										"rows": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"date": {
														"type": "string",
														"format": "date",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
													},
													"practitionerId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"bookableMin": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"bookedMin": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"count": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"date",
													"practitionerId",
													"bookableMin",
													"bookedMin",
													"count"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"from",
										"to",
										"timezone",
										"locationId",
										"closedDates",
										"rows"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/today/ws-ticket": {
			"post": {
				"summary": "Mint a short-lived voice-audience ticket for the Today socket",
				"tags": [
					"today"
				],
				"description": "Requires the dialer permission (and, over OAuth, the dialer scope). The ticket is single-purpose: offer it as the Sec-WebSocket-Protocol on GET /today/ws within 60 seconds. The resulting socket carries voice events only.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ticket": {
											"type": "string"
										},
										"expiresAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"ticket",
										"expiresAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/page/dashboard": {
			"get": {
				"summary": "The dashboard page in one request",
				"tags": [
					"reports"
				],
				"description": "The same payload as GET /reports/dashboard, resolved in a single database statement. Page endpoints exist to collapse a page's fan-out into one round-trip; prefer this over the per-resource endpoints when loading the page.",
				"parameters": [
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "grain",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"day",
								"week",
								"month"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportResponse"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/page/pipeline": {
			"get": {
				"summary": "The pipeline board in one request",
				"tags": [
					"pipelines"
				],
				"description": "The board, its stages and up to 500 cards (each with its patient embedded), resolved in a single database statement. `truncated` reports that the board holds more cards than were returned. Prefer this over GET /pipelines + GET /journeys when loading the board.",
				"parameters": [
					{
						"name": "pipelineId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "createdAt",
							"type": "string",
							"enum": [
								"createdAt",
								"enteredStageAt"
							]
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"default": "desc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 4000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"pipeline": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/PipelineWithStages"
												},
												{
													"type": "null"
												}
											]
										},
										"cards": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/JourneyWithPatient"
											}
										},
										"truncated": {
											"type": "boolean"
										},
										"treatments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										},
										"stageAutomations": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"stageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"count": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"stageId",
													"count"
												],
												"additionalProperties": false
											}
										},
										"boards": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"name": {
														"type": "string"
													},
													"isDefault": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name",
													"isDefault"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"pipeline",
										"cards",
										"truncated",
										"treatments",
										"stageAutomations",
										"boards"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/page/patients": {
			"get": {
				"summary": "The Patients page in one request",
				"tags": [
					"patients"
				],
				"description": "The GET /patients body (same query parameters, same filter, search, sort and embed semantics) together with the caller's saved views, resolved in a single database statement. Page endpoints exist to collapse a page's fan-out into one round-trip; prefer this over the per-resource endpoints when loading the page.",
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "createdAt",
							"type": "string",
							"enum": [
								"createdAt",
								"updatedAt",
								"lastName",
								"firstName",
								"status",
								"dateOfBirth",
								"city",
								"email",
								"relevance"
							]
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"default": "desc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 4000
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "tags"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"enquiry",
								"lead",
								"patient",
								"inactive",
								"archived",
								"deceased"
							]
						}
					},
					{
						"name": "tagId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "leadSourceId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"patients": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/PatientListItem"
													}
												},
												"total": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"limit": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"offset": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"items",
												"total",
												"limit",
												"offset"
											],
											"additionalProperties": false
										},
										"savedViews": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/SavedView"
													}
												}
											},
											"required": [
												"items"
											],
											"additionalProperties": false
										},
										"leadSources": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LeadSource"
											}
										}
									},
									"required": [
										"patients",
										"savedViews",
										"leadSources"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/page/calendar": {
			"get": {
				"summary": "The Calendar page in one request",
				"tags": [
					"calendar"
				],
				"description": "The same payload as GET /calendar, resolved in a single database statement. Page endpoints exist to collapse a page's fan-out into one round-trip; prefer this over the per-resource endpoints when loading the page. Omit from/to to be given the practice's current month grid, which the response reports back.",
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarOverview"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/page/inbox": {
			"get": {
				"summary": "The inbox page in one request",
				"tags": [
					"inbox"
				],
				"description": "The conversation list GET /conversations returns for the same query, plus the GET /inbox/counts badges, resolved in a single database statement. Page endpoints exist to collapse a page's fan-out into one round-trip; prefer this over the per-resource endpoints when loading the page. Message bodies are not included — open a thread with GET /conversations/:id/messages.",
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"pending",
								"snoozed",
								"closed"
							]
						}
					},
					{
						"name": "channel",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"whatsapp",
								"sms",
								"email",
								"webchat",
								"messenger",
								"instagram",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments"
							]
						}
					},
					{
						"name": "assignee",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "unread",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "patientStatus",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(enquiry|lead|patient|inactive|archived|deceased)(,(enquiry|lead|patient|inactive|archived|deceased))*$"
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conversations": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/ConversationListItem"
													}
												},
												"nextCursor": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"items",
												"nextCursor"
											],
											"additionalProperties": false
										},
										"counts": {
											"$ref": "#/components/schemas/InboxCounts"
										},
										"savedViews": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/SavedView"
													}
												}
											},
											"required": [
												"items"
											],
											"additionalProperties": false
										},
										"members": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/MemberSummary"
											}
										}
									},
									"required": [
										"conversations",
										"counts",
										"savedViews",
										"members"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/calendar": {
			"get": {
				"summary": "Per-day business aggregates for a date range",
				"tags": [
					"calendar"
				],
				"description": "One row per practice-local day, zero-filled: new leads, distinct patients contacted (outbound touches + outcome receipts), journeys won/lost with the deal value won, appointments taking place, and open tasks due. Pass from/to (both-or-neither, ≤45 days) — typically a Monday-aligned month grid; omitted = the practice's current month grid.",
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarOverview"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/calendar/detail": {
			"get": {
				"summary": "Every row behind a span of calendar days",
				"tags": [
					"calendar"
				],
				"description": "The drill-down for an inclusive practice-local day range (from ≤ to, ≤45 days; a single day when from === to): the overview stats summed over the range, plus the underlying rows merged chronologically — new leads with their source, every outbound contact, all appointments (any status), journeys won/lost with values, and open tasks due. Each section is capped at 200 rows.",
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarDetail"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reports/{report}": {
			"get": {
				"summary": "One report's KPIs, chart series and breakdown tables",
				"tags": [
					"reports"
				],
				"description": "Computes a named report over the org's CRM data as a generic block envelope (KPI tiles with previous-period comparison, zero-filled chart series, breakdown tables with server-emitted display labels). `filters` is url-encoded JSON validated against the report filter model; the date window defaults to the last 30 practice-local days — cohort reports default wider — and non-applicable filter keys are ignored. `grain` buckets timeseries by day/week/month; cohort reports pin it to month and ignore the parameter. Series of kind `matrix` are cohort grids whose cells are omitted where the period is not observable yet, rather than zero-filled.",
				"parameters": [
					{
						"name": "report",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"dashboard",
								"snapshot",
								"lead-volume",
								"lead-sources",
								"lead-attribution",
								"calls",
								"funnel",
								"conversion-summary",
								"speed-to-lead",
								"lost-journeys",
								"revenue-summary",
								"revenue-by-treatment",
								"pipeline-value",
								"patient-value",
								"patient-retention",
								"appointment-volume",
								"attendance",
								"team-activity",
								"team-conversion",
								"practitioner-performance",
								"referral-program",
								"lead-flow",
								"seo-weekly-digest",
								"ads-weekly-digest",
								"day-sheet",
								"aged-debt",
								"production",
								"collections",
								"associate-pay",
								"utilisation"
							]
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "grain",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"day",
								"week",
								"month"
							]
						}
					},
					{
						"name": "stages",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportResponse"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/report-subscriptions": {
			"get": {
				"summary": "List scheduled report email subscriptions",
				"tags": [
					"report-subscriptions"
				],
				"parameters": [
					{
						"name": "recipientUserId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "enabled",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReportSubscription"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a scheduled report email subscription",
				"tags": [
					"report-subscriptions"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"report": {
										"type": "string",
										"enum": [
											"dashboard",
											"snapshot",
											"lead-volume",
											"lead-sources",
											"lead-attribution",
											"calls",
											"funnel",
											"conversion-summary",
											"speed-to-lead",
											"lost-journeys",
											"revenue-summary",
											"revenue-by-treatment",
											"pipeline-value",
											"patient-value",
											"patient-retention",
											"appointment-volume",
											"attendance",
											"team-activity",
											"team-conversion",
											"practitioner-performance",
											"referral-program",
											"lead-flow",
											"seo-weekly-digest",
											"ads-weekly-digest",
											"day-sheet",
											"aged-debt",
											"production",
											"collections",
											"associate-pay",
											"utilisation"
										]
									},
									"filters": {
										"default": {},
										"type": "object",
										"properties": {
											"date": {
												"anyOf": [
													{
														"type": "object",
														"properties": {
															"from": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															"to": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															}
														},
														"additionalProperties": false
													},
													{
														"type": "object",
														"properties": {
															"preset": {
																"type": "string",
																"enum": [
																	"today",
																	"yesterday",
																	"thisWeek",
																	"lastWeek",
																	"thisMonth",
																	"lastMonth",
																	"last7days",
																	"last30days",
																	"last90days",
																	"last12months",
																	"last24months",
																	"thisYear"
																]
															}
														},
														"required": [
															"preset"
														],
														"additionalProperties": false
													}
												]
											},
											"pipelineId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"treatmentId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"channel": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"paid_search",
																"paid_social",
																"organic_search",
																"social",
																"referral_website",
																"referral_friend",
																"referral_practice",
																"existing_patient",
																"email",
																"chat",
																"direct",
																"phone",
																"walk_in",
																"print",
																"other",
																"unknown",
																"ai",
																"paid_ai"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"leadSourceId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"locationId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"ownerId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"practitionerId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											}
										},
										"additionalProperties": false
									},
									"grain": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"day",
													"week",
													"month"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"recipientUserId": {
										"type": "string",
										"minLength": 1
									},
									"timezone": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"schedule": {
										"$ref": "#/components/schemas/ReportSubscriptionSchedule"
									},
									"enabled": {
										"default": true,
										"type": "boolean"
									}
								},
								"required": [
									"report",
									"recipientUserId",
									"timezone",
									"schedule"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportSubscription"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/report-subscriptions/{id}": {
			"get": {
				"summary": "Get a scheduled report email subscription",
				"tags": [
					"report-subscriptions"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportSubscription"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a scheduled report email subscription",
				"tags": [
					"report-subscriptions"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"report": {
										"type": "string",
										"enum": [
											"dashboard",
											"snapshot",
											"lead-volume",
											"lead-sources",
											"lead-attribution",
											"calls",
											"funnel",
											"conversion-summary",
											"speed-to-lead",
											"lost-journeys",
											"revenue-summary",
											"revenue-by-treatment",
											"pipeline-value",
											"patient-value",
											"patient-retention",
											"appointment-volume",
											"attendance",
											"team-activity",
											"team-conversion",
											"practitioner-performance",
											"referral-program",
											"lead-flow",
											"seo-weekly-digest",
											"ads-weekly-digest",
											"day-sheet",
											"aged-debt",
											"production",
											"collections",
											"associate-pay",
											"utilisation"
										]
									},
									"filters": {
										"type": "object",
										"properties": {
											"date": {
												"anyOf": [
													{
														"type": "object",
														"properties": {
															"from": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															"to": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															}
														},
														"additionalProperties": false
													},
													{
														"type": "object",
														"properties": {
															"preset": {
																"type": "string",
																"enum": [
																	"today",
																	"yesterday",
																	"thisWeek",
																	"lastWeek",
																	"thisMonth",
																	"lastMonth",
																	"last7days",
																	"last30days",
																	"last90days",
																	"last12months",
																	"last24months",
																	"thisYear"
																]
															}
														},
														"required": [
															"preset"
														],
														"additionalProperties": false
													}
												]
											},
											"pipelineId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"treatmentId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"channel": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"paid_search",
																"paid_social",
																"organic_search",
																"social",
																"referral_website",
																"referral_friend",
																"referral_practice",
																"existing_patient",
																"email",
																"chat",
																"direct",
																"phone",
																"walk_in",
																"print",
																"other",
																"unknown",
																"ai",
																"paid_ai"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"leadSourceId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"locationId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"ownerId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"practitionerId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											}
										},
										"additionalProperties": false
									},
									"grain": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"day",
													"week",
													"month"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"recipientUserId": {
										"type": "string",
										"minLength": 1
									},
									"timezone": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"schedule": {
										"$ref": "#/components/schemas/ReportSubscriptionSchedule"
									},
									"enabled": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportSubscription"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a scheduled report email subscription",
				"tags": [
					"report-subscriptions"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/report-subscriptions/{id}/test": {
			"post": {
				"summary": "Queue a test report email",
				"tags": [
					"report-subscriptions"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"deliveryId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"status": {
											"type": "string",
											"const": "queued"
										}
									},
									"required": [
										"deliveryId",
										"status"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/report-subscriptions/{id}/deliveries": {
			"get": {
				"summary": "List the email deliveries of a scheduled report",
				"tags": [
					"report-subscriptions"
				],
				"description": "Every delivery attempt row, newest first, including the ones that failed after their attempts ran out. Parked deliveries stay listed until a human acts on them.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"queued",
								"sent",
								"failed"
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReportDelivery"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/report-subscriptions/{id}/deliveries/{deliveryId}": {
			"get": {
				"summary": "Inspect one email delivery of a scheduled report",
				"tags": [
					"report-subscriptions"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "deliveryId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportDelivery"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/report-subscriptions/{id}/deliveries/{deliveryId}/replay": {
			"post": {
				"summary": "Replay a failed email delivery of a scheduled report",
				"tags": [
					"report-subscriptions"
				],
				"description": "Queues a new delivery row at the next generation for the same occurrence; the failed row stays on record unchanged. Only a failed delivery, or one still queued after its recovery window closed, can be replayed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "deliveryId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportDelivery"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notifications": {
			"get": {
				"summary": "List the caller's notifications",
				"tags": [
					"notifications"
				],
				"parameters": [
					{
						"name": "beforeCreatedAt",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date-time",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
						}
					},
					{
						"name": "beforeId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 50
						}
					},
					{
						"name": "unreadOnly",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotificationList"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notifications/read": {
			"post": {
				"summary": "Mark notifications as read",
				"tags": [
					"notifications"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"eventIds": {
												"minItems": 1,
												"maxItems": 100,
												"type": "array",
												"items": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											}
										},
										"required": [
											"eventIds"
										]
									},
									{
										"type": "object",
										"properties": {
											"all": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"all"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MarkNotificationsRead"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notifications/{id}/dismiss": {
			"post": {
				"summary": "Dismiss a single notification",
				"tags": [
					"notifications"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MarkNotificationsRead"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notifications/settings": {
			"get": {
				"summary": "Get the caller's notification preferences",
				"tags": [
					"notifications"
				],
				"description": "Includes the caller's registered push devices (the same rows as GET /devices/push).",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"kinds": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"enum": [
															"lead.created",
															"lead.uncontacted",
															"call.missed",
															"voicemail.received",
															"voice.ai_handoff_unanswered",
															"voice.emergency_dialed",
															"message.received",
															"booking.created",
															"booking.cancelled",
															"deposit.paid",
															"review.received",
															"feedback.received",
															"integration.failed",
															"ingest.review_required",
															"tracking.ceiling_reached",
															"team.message"
														]
													},
													"group": {
														"type": "string",
														"enum": [
															"leads",
															"conversations",
															"bookings",
															"reputation",
															"operations",
															"team"
														]
													},
													"label": {
														"type": "string"
													},
													"priority": {
														"type": "string",
														"enum": [
															"normal",
															"urgent"
														]
													},
													"inApp": {
														"type": "boolean"
													},
													"push": {
														"type": "boolean"
													},
													"email": {
														"type": "boolean"
													},
													"lockedChannels": {
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"inApp",
																"push",
																"email"
															]
														}
													}
												},
												"required": [
													"kind",
													"group",
													"label",
													"priority",
													"inApp",
													"push",
													"email",
													"lockedChannels"
												],
												"additionalProperties": false
											}
										},
										"timezone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"quietHoursStartHour": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 23
												},
												{
													"type": "null"
												}
											]
										},
										"quietHoursEndHour": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 23
												},
												{
													"type": "null"
												}
											]
										},
										"webPushVapidPublicKey": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"readOnly": {
											"type": "boolean"
										},
										"devices": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PushDevice"
											}
										}
									},
									"required": [
										"kinds",
										"timezone",
										"quietHoursStartHour",
										"quietHoursEndHour",
										"webPushVapidPublicKey",
										"readOnly",
										"devices"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Update the caller's notification preferences",
				"tags": [
					"notifications"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"overrides": {
										"type": "object",
										"propertyNames": {
											"type": "string",
											"enum": [
												"lead.created",
												"lead.uncontacted",
												"call.missed",
												"voicemail.received",
												"voice.ai_handoff_unanswered",
												"voice.emergency_dialed",
												"message.received",
												"booking.created",
												"booking.cancelled",
												"deposit.paid",
												"review.received",
												"feedback.received",
												"integration.failed",
												"ingest.review_required",
												"tracking.ceiling_reached",
												"team.message"
											]
										},
										"additionalProperties": {
											"type": "object",
											"properties": {
												"inApp": {
													"type": "boolean"
												},
												"push": {
													"type": "boolean"
												},
												"email": {
													"type": "boolean"
												}
											}
										}
									},
									"timezone": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"quietHoursStartHour": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 23
											},
											{
												"type": "null"
											}
										]
									},
									"quietHoursEndHour": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 23
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotificationSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/devices/push": {
			"put": {
				"summary": "Register this device for push notifications",
				"tags": [
					"notifications"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"platform": {
										"type": "string",
										"enum": [
											"web",
											"ios",
											"android"
										]
									},
									"transport": {
										"type": "string",
										"enum": [
											"webpush",
											"expo"
										]
									},
									"token": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2048
									},
									"subscriptionKeys": {
										"type": "object",
										"properties": {
											"p256dh": {
												"type": "string",
												"minLength": 1,
												"maxLength": 256,
												"pattern": "^[A-Za-z0-9_-]+$"
											},
											"auth": {
												"type": "string",
												"minLength": 1,
												"maxLength": 64,
												"pattern": "^[A-Za-z0-9_-]+$"
											}
										},
										"required": [
											"p256dh",
											"auth"
										]
									},
									"label": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									}
								},
								"required": [
									"platform",
									"transport",
									"token"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"device": {
											"$ref": "#/components/schemas/PushDevice"
										}
									},
									"required": [
										"device"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"get": {
				"summary": "List the caller's registered push devices",
				"tags": [
					"notifications"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"devices": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PushDevice"
											}
										}
									},
									"required": [
										"devices"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/devices/push/{id}": {
			"delete": {
				"summary": "Remove one of the caller's push devices",
				"tags": [
					"notifications"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"deleted": {
											"type": "boolean"
										}
									},
									"required": [
										"deleted"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/threads": {
			"get": {
				"summary": "List the caller's team chat threads",
				"tags": [
					"Team chat"
				],
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 50
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TeamThread"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Start a DM or a group thread",
				"tags": [
					"Team chat"
				],
				"description": "A DM is get-or-create: 201 when created, 200 when the pair already shares one. 400 UNKNOWN_MEMBER when a user id is not a member of the organization.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "dm"
											},
											"userId": {
												"type": "string",
												"minLength": 1
											}
										},
										"required": [
											"kind",
											"userId"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "group"
											},
											"title": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120,
												"description": "At most 120 UTF-8 bytes"
											},
											"memberUserIds": {
												"minItems": 1,
												"type": "array",
												"items": {
													"type": "string",
													"minLength": 1
												}
											}
										},
										"required": [
											"kind",
											"memberUserIds"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"thread": {
											"$ref": "#/components/schemas/TeamThread"
										}
									},
									"required": [
										"thread"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"thread": {
											"$ref": "#/components/schemas/TeamThread"
										}
									},
									"required": [
										"thread"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/threads/{threadId}": {
			"get": {
				"summary": "Get one team chat thread",
				"tags": [
					"Team chat"
				],
				"parameters": [
					{
						"name": "threadId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"thread": {
											"$ref": "#/components/schemas/TeamThread"
										}
									},
									"required": [
										"thread"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/threads/{threadId}/messages": {
			"get": {
				"summary": "List a thread's messages, newest first",
				"tags": [
					"Team chat"
				],
				"parameters": [
					{
						"name": "threadId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TeamMessage"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Send a message to a thread",
				"tags": [
					"Team chat"
				],
				"description": "201 with the stored message; 200 with the same message when the clientMessageId was already sent.",
				"parameters": [
					{
						"name": "threadId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientMessageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"body": {
										"type": "string",
										"minLength": 1,
										"maxLength": 4000,
										"description": "At most 4000 UTF-8 bytes"
									}
								},
								"required": [
									"clientMessageId",
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"message": {
											"$ref": "#/components/schemas/TeamMessage"
										}
									},
									"required": [
										"message"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"message": {
											"$ref": "#/components/schemas/TeamMessage"
										}
									},
									"required": [
										"message"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/threads/{threadId}/read": {
			"post": {
				"summary": "Mark a thread read up to a sequence number",
				"tags": [
					"Team chat"
				],
				"parameters": [
					{
						"name": "threadId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"upToSeq": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"upToSeq"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"lastReadSeq": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"lastReadSeq"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/threads/{threadId}/members": {
			"post": {
				"summary": "Add members to a group thread",
				"tags": [
					"Team chat"
				],
				"description": "400 UNKNOWN_MEMBER when a user id is not a member of the organization; 409 on a DM.",
				"parameters": [
					{
						"name": "threadId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"userIds": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1
										}
									}
								},
								"required": [
									"userIds"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"thread": {
											"$ref": "#/components/schemas/TeamThread"
										}
									},
									"required": [
										"thread"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/threads/{threadId}/members/{userId}": {
			"delete": {
				"summary": "Remove a member from a group thread",
				"tags": [
					"Team chat"
				],
				"description": "409 on a DM.",
				"parameters": [
					{
						"name": "threadId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"thread": {
											"$ref": "#/components/schemas/TeamThread"
										}
									},
									"required": [
										"thread"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns": {
			"get": {
				"summary": "List outbound marketing campaigns",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"draft",
								"scheduled",
								"dispatching",
								"paused",
								"completed",
								"cancelled",
								"failed"
							]
						}
					},
					{
						"name": "channel",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"sms",
								"email",
								"whatsapp"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CampaignListItem"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a campaign draft",
				"tags": [
					"campaigns"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 160
									},
									"audience": {
										"$ref": "#/components/schemas/CampaignAudience"
									},
									"channel": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"sms",
													"email",
													"whatsapp"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"connectionId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"templateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"subject": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"body": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100000
											},
											{
												"type": "null"
											}
										]
									},
									"bodyHtml": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 1000000
											},
											{
												"type": "null"
											}
										]
									},
									"doc": {
										"anyOf": [
											{},
											{
												"type": "null"
											}
										]
									},
									"whatsappTemplateRef": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"whatsappLanguage": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 35
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name",
									"audience"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/preview": {
			"post": {
				"summary": "Preview campaign eligibility and estimated usage",
				"tags": [
					"campaigns"
				],
				"description": "The preview is an estimate. Segment membership is materialized and eligibility rechecked when dispatch begins.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"audience": {
										"$ref": "#/components/schemas/CampaignAudience"
									},
									"channel": {
										"type": "string",
										"enum": [
											"sms",
											"email",
											"whatsapp"
										]
									},
									"connectionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"subject": {
										"type": "string",
										"maxLength": 500
									},
									"body": {
										"type": "string",
										"maxLength": 100000
									},
									"bodyHtml": {
										"type": "string",
										"maxLength": 1000000
									},
									"whatsappTemplateRef": {
										"type": "string",
										"maxLength": 200
									},
									"whatsappLanguage": {
										"type": "string",
										"maxLength": 35
									}
								},
								"required": [
									"audience",
									"channel"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CampaignPreview"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}": {
			"get": {
				"summary": "Get a campaign",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a campaign draft",
				"tags": [
					"campaigns"
				],
				"description": "Only draft campaigns can be edited.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 160
									},
									"audience": {
										"$ref": "#/components/schemas/CampaignAudience"
									},
									"channel": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"sms",
													"email",
													"whatsapp"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"connectionId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"templateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"subject": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"body": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100000
											},
											{
												"type": "null"
											}
										]
									},
									"bodyHtml": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 1000000
											},
											{
												"type": "null"
											}
										]
									},
									"doc": {
										"anyOf": [
											{},
											{
												"type": "null"
											}
										]
									},
									"whatsappTemplateRef": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"whatsappLanguage": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 35
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a campaign draft",
				"tags": [
					"campaigns"
				],
				"description": "Only draft campaigns can be deleted.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "expectedVersion",
						"in": "query",
						"required": true,
						"schema": {
							"type": "integer",
							"exclusiveMinimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}/test": {
			"post": {
				"summary": "Send a campaign test message",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"destination": {
										"type": "string",
										"minLength": 1,
										"maxLength": 320
									}
								},
								"required": [
									"destination"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"messageId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"status": {
											"type": "string",
											"const": "queued"
										}
									},
									"required": [
										"messageId",
										"status"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}/launch": {
			"post": {
				"summary": "Send or schedule a campaign",
				"tags": [
					"campaigns"
				],
				"description": "Freezes the draft's selector and content. Dispatch pauses instead of silently exceeding the confirmed recipient or credit ceiling.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"sendAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"hourlyLimit": {
										"type": "integer",
										"minimum": 1,
										"maximum": 5000
									},
									"dailyLimit": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 15000
											},
											{
												"type": "null"
											}
										]
									},
									"maxRecipients": {
										"type": "integer",
										"minimum": 1,
										"maximum": 15000
									},
									"maxCredits": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"allowOverage": {
										"default": false,
										"type": "boolean"
									}
								},
								"required": [
									"expectedVersion",
									"maxRecipients"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}/pause": {
			"post": {
				"summary": "Pause a campaign",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}/resume": {
			"post": {
				"summary": "Resume a paused campaign",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}/cancel": {
			"post": {
				"summary": "Cancel a campaign",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}/duplicate": {
			"post": {
				"summary": "Duplicate a campaign as a draft",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 160
									}
								}
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Campaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/campaigns/{id}/recipients": {
			"get": {
				"summary": "List campaign recipients and exclusions",
				"tags": [
					"campaigns"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"pending",
								"queued",
								"sent",
								"delivered",
								"read",
								"replied",
								"skipped",
								"failed",
								"cancelled",
								"delivery_unknown"
							]
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CampaignRecipient"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/bootstrap": {
			"get": {
				"summary": "All rarely-changing org lookups in one call",
				"tags": [
					"bootstrap"
				],
				"description": "Non-archived lookups, members, pipelines with stages and the caller's saved patient and conversation views. savedViews are scoped to the caller (own + shared), so responses must never be cached across users.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Bootstrap"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/billing": {
			"get": {
				"summary": "Get the organization's subscription, entitlements and next invoice",
				"tags": [
					"billing"
				],
				"description": "Answers a null subscription (entitlements all false) for organizations that never subscribed. Owner/admin only.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Billing"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/billing/reconcile": {
			"post": {
				"summary": "Reconcile the practice subscription from Stripe",
				"tags": [
					"billing"
				],
				"description": "Runs the fenced Stripe-to-local projection used to recover checkout returns and missed webhooks. Returns the current recovery action and never creates a subscription. Owner only.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Billing"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/billing/addons": {
			"post": {
				"summary": "Enable or disable an add-on on the active subscription",
				"tags": [
					"billing"
				],
				"description": "Adds/removes the add-on's price items on the org's Stripe subscription with proration. Requires a usable (active/trialing/past_due) subscription. Owner only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"addon": {
										"type": "string",
										"enum": [
											"ai",
											"dialer",
											"voice",
											"aiVoice",
											"seoAds"
										]
									},
									"enabled": {
										"type": "boolean"
									}
								},
								"required": [
									"clientRef",
									"addon",
									"enabled"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Billing"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/billing/voice-lines": {
			"post": {
				"summary": "Set the organization's entitled concurrent Voice lines",
				"tags": [
					"billing"
				],
				"description": "Updates voice_configs.desiredLines and stages the composite capacity sync (extra lines + extra numbers) toward Stripe with proration. Capacity applies immediately; a permanently failing sync drops enforcement to the last billed count and flags the organization. Requires SmileLine Voice. Owner only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"totalLines": {
										"type": "integer",
										"minimum": 3,
										"maximum": 30
									}
								},
								"required": [
									"clientRef",
									"totalLines"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoiceLines"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/billing/checkout": {
			"post": {
				"summary": "Create or recover a Core subscription Checkout session",
				"tags": [
					"billing"
				],
				"description": "Claims a durable billing command before Stripe I/O and reuses its provider idempotency key on retry. Owner only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"returnTo": {
										"type": "string",
										"enum": [
											"billing",
											"onboarding"
										]
									}
								},
								"required": [
									"clientRef",
									"returnTo"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"url": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"url"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/billing/portal": {
			"post": {
				"summary": "Create or recover a Stripe Billing Portal session",
				"tags": [
					"billing"
				],
				"description": "Claims a durable billing command before creating the short-lived portal session. Owner only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"url": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"url"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/billing/resume": {
			"post": {
				"summary": "Resume a paused subscription from the current time",
				"tags": [
					"billing"
				],
				"description": "Resumes the authoritative paused Stripe subscription with a new billing-cycle anchor at the current time, without proration for the paused interval. Owner only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Billing"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/organization/lifecycle": {
			"get": {
				"summary": "Get the active practice lifecycle",
				"tags": [
					"organization"
				],
				"description": "Owner-only. Returns the durable active, closing, or purging state. Closing practices retain only recovery, export, account-security, and bounded lifecycle-safety access; automated privacy work continues while retention settings stay frozen. During irreversible purging, purgeBillingStatus reports Stripe cancellation as pending, durably stopped, or requiring manual review.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"state": {
											"type": "string",
											"enum": [
												"active",
												"closing",
												"purging",
												"custodian"
											]
										},
										"generation": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"reason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"owner_requested",
														"provider_terminal"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"openedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"deadlineAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recoveredAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"purgingAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"custodyEnteredAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"purgeBlockedByLegalHold": {
											"type": "boolean"
										},
										"purgeBillingStatus": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"pending",
														"stopped",
														"manual_review"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"recoveryAction": {
											"type": "string",
											"enum": [
												"none",
												"restore",
												"checkout",
												"resume_subscription"
											]
										}
									},
									"required": [
										"state",
										"generation",
										"reason",
										"openedAt",
										"deadlineAt",
										"recoveredAt",
										"purgingAt",
										"custodyEnteredAt",
										"purgeBlockedByLegalHold",
										"purgeBillingStatus",
										"recoveryAction"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/organization/lifecycle/close": {
			"post": {
				"summary": "Begin closing the active practice",
				"tags": [
					"organization"
				],
				"description": "Owner-only and idempotent. Opens a new 90-day closure generation immediately and starts durable provider cancellation. Pausing a subscription does not call this endpoint and does not open closure.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"confirmationSlug": {
										"type": "string",
										"minLength": 1,
										"maxLength": 255
									}
								},
								"required": [
									"confirmationSlug"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"lifecycle": {
											"$ref": "#/components/schemas/OrganizationLifecycle"
										},
										"checkoutUrl": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"cancellationPending": {
											"type": "boolean"
										}
									},
									"required": [
										"lifecycle",
										"checkoutUrl",
										"cancellationPending"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/organization/lifecycle/recover": {
			"post": {
				"summary": "Recover a closing practice",
				"tags": [
					"organization"
				],
				"description": "Owner-only and generation-fenced. Recovery is disabled once purging begins. A provider-terminal subscription returns a durable Checkout URL; the generation is restored only after Stripe confirms usable service.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"lifecycle": {
											"$ref": "#/components/schemas/OrganizationLifecycle"
										},
										"checkoutUrl": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"cancellationPending": {
											"type": "boolean"
										}
									},
									"required": [
										"lifecycle",
										"checkoutUrl",
										"cancellationPending"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/appointments": {
			"get": {
				"summary": "List appointments in a date range",
				"tags": [
					"appointments"
				],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date-time",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date-time",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "practitionerId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"pending",
								"booked",
								"confirmed",
								"arrived",
								"in_chair",
								"fulfilled",
								"cancelled",
								"no_show"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"uid": {
														"type": "string"
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"journeyId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"appointmentTypeId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"treatmentId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"status": {
														"type": "string",
														"enum": [
															"pending",
															"booked",
															"confirmed",
															"arrived",
															"in_chair",
															"fulfilled",
															"cancelled",
															"no_show"
														]
													},
													"version": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"startsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"endsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"timezone": {
														"type": "string"
													},
													"note": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"patientInstruction": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"isFirstVisit": {
														"type": "boolean"
													},
													"bookedVia": {
														"type": "string",
														"enum": [
															"staff",
															"online",
															"api",
															"automation",
															"pms",
															"import"
														]
													},
													"cancellationReasonId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"rescheduledFromId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"idempotencyKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"idempotencyDigest": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"heldUntil": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"confirmedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"arrivedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"seatedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"fulfilledAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"cancelledAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"noShowAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"sourceCorrectionPendingAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"reviewState": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"practitioner_unassigned",
																	"operatory_unassigned",
																	"unassigned"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"customFields": {},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdByName": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdBySource": {
														"type": "string",
														"enum": [
															"user",
															"patient",
															"automation",
															"campaign",
															"ai",
															"api",
															"import",
															"system"
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"practitionerIds": {
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"locationId",
													"uid",
													"patientId",
													"journeyId",
													"appointmentTypeId",
													"treatmentId",
													"status",
													"version",
													"startsAt",
													"endsAt",
													"timezone",
													"note",
													"patientInstruction",
													"isFirstVisit",
													"bookedVia",
													"cancellationReasonId",
													"rescheduledFromId",
													"idempotencyKey",
													"idempotencyDigest",
													"heldUntil",
													"confirmedAt",
													"arrivedAt",
													"seatedAt",
													"fulfilledAt",
													"cancelledAt",
													"noShowAt",
													"sourceCorrectionPendingAt",
													"reviewState",
													"customFields",
													"createdById",
													"createdByName",
													"createdBySource",
													"createdAt",
													"updatedAt",
													"practitionerIds"
												],
												"additionalProperties": false
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Book an appointment",
				"tags": [
					"appointments"
				],
				"description": "Uses requestId as the idempotency key. Practitioner or operatory collisions return 409 unless an owner or manager deliberately supplies an overbook reason.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"requestId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"startsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"endsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentTypeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"operatoryId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"overbookReason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									"note": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"patientInstruction": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"isFirstVisit": {
										"type": "boolean"
									},
									"treatmentPlanVisitId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"requestId",
									"patientId",
									"startsAt",
									"endsAt"
								],
								"description": "endsAt must be after startsAt. locationId may be omitted only when the organization has exactly one location."
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Appointment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/appointments/{id}": {
			"get": {
				"summary": "Get an appointment",
				"tags": [
					"appointments"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Appointment"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update an appointment",
				"tags": [
					"appointments"
				],
				"description": "Requires the current version. Time or resource conflicts return 409 unless an owner or manager deliberately supplies an overbook reason.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"startsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"endsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"practitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"operatoryId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"overbookReason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentTypeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"patientInstruction": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"isFirstVisit": {
										"type": "boolean"
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Appointment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/appointments/{id}/cancel": {
			"post": {
				"summary": "Cancel an appointment",
				"tags": [
					"appointments"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"cancellationReasonId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"expectedVersion",
									"cancellationReasonId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Appointment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/appointments/{id}/status": {
			"post": {
				"summary": "Progress an appointment's status",
				"tags": [
					"appointments"
				],
				"description": "Stamps the matching timestamp column (confirmedAt, arrivedAt, seatedAt, fulfilledAt, noShowAt). Cancellation goes through /cancel.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"status": {
										"type": "string",
										"enum": [
											"confirmed",
											"arrived",
											"in_chair",
											"fulfilled",
											"no_show"
										]
									}
								},
								"required": [
									"expectedVersion",
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Appointment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/appointments/{id}/approve": {
			"post": {
				"summary": "Approve a pending online booking",
				"tags": [
					"appointments"
				],
				"description": "Confirms an online booking request: pending → booked, the patient's booking confirmation and reminders schedule now, and the Today confirm task completes. Unpaid deposit holds can't be approved. Declining is a normal /cancel.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Appointment"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks": {
			"get": {
				"summary": "List capture hooks",
				"tags": [
					"settings"
				],
				"description": "Archived hooks are excluded unless includeArchived=true. The secret is never exposed.",
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CaptureHook"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a capture hook",
				"tags": [
					"settings"
				],
				"description": "Mints the endpoint token server-side. defaultTreatmentId is optional; without a matching submitted treatment or a default, new contacts arrive as enquiries. authMode=signed returns a signingSecret exactly once; it is never returned by later reads.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultLeadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultIntakeMethod": {
										"type": "string",
										"enum": [
											"form",
											"website_form",
											"webhook",
											"zapier",
											"lead_ad",
											"whatsapp",
											"sms",
											"call",
											"chat",
											"manual",
											"import",
											"booking",
											"referral"
										]
									},
									"affiliateLabel": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"fieldMap": {
										"type": "object",
										"properties": {
											"firstName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"lastName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"email": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneMobile": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneOther": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"dateOfBirth": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"gender": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine1": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine2": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"city": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"province": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"postalCode": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"country": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactMethod": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactTime": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"treatmentSlug": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"location": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"message": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"note": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"marketingConsent": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											}
										}
									},
									"extraFields": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"key": {
													"type": "string",
													"minLength": 1,
													"maxLength": 128
												},
												"label": {
													"type": "string",
													"minLength": 1,
													"maxLength": 60
												}
											},
											"required": [
												"key",
												"label"
											]
										}
									},
									"active": {
										"type": "boolean"
									},
									"authMode": {
										"default": "public",
										"type": "string",
										"enum": [
											"public",
											"signed"
										]
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHookSetup"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}": {
			"get": {
				"summary": "Get a capture hook",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHook"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a capture hook",
				"tags": [
					"settings"
				],
				"description": "Set active=false to pause intake without archiving.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultLeadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultIntakeMethod": {
										"type": "string",
										"enum": [
											"form",
											"website_form",
											"webhook",
											"zapier",
											"lead_ad",
											"whatsapp",
											"sms",
											"call",
											"chat",
											"manual",
											"import",
											"booking",
											"referral"
										]
									},
									"affiliateLabel": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"fieldMap": {
										"type": "object",
										"properties": {
											"firstName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"lastName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"email": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneMobile": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneOther": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"dateOfBirth": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"gender": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine1": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine2": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"city": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"province": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"postalCode": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"country": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactMethod": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactTime": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"treatmentSlug": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"location": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"message": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"note": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"marketingConsent": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											}
										}
									},
									"extraFields": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"key": {
													"type": "string",
													"minLength": 1,
													"maxLength": 128
												},
												"label": {
													"type": "string",
													"minLength": 1,
													"maxLength": 60
												}
											},
											"required": [
												"key",
												"label"
											]
										}
									},
									"active": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHook"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/archive": {
			"post": {
				"summary": "Archive a capture hook",
				"tags": [
					"settings"
				],
				"description": "Sets archivedAt; the public endpoint answers 404. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHook"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/restore": {
			"post": {
				"summary": "Restore an archived capture hook",
				"tags": [
					"settings"
				],
				"description": "Clears archivedAt only — a previously paused hook stays paused. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHook"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/regenerate-token": {
			"post": {
				"summary": "Regenerate the public token",
				"tags": [
					"settings"
				],
				"description": "Mints a fresh token; the previous endpoint URL stops working immediately.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHook"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/signing/enable": {
			"post": {
				"summary": "Enable signed capture delivery",
				"tags": [
					"settings"
				],
				"description": "Switches a public hook to signed JSON delivery and returns the fresh signingSecret exactly once.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHookSetup"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/signing/rotate": {
			"post": {
				"summary": "Rotate a capture signing secret",
				"tags": [
					"settings"
				],
				"description": "Returns the new signingSecret exactly once. The previous secret remains valid for 24 hours unless explicitly revoked.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHookSetup"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/signing/revoke-previous": {
			"post": {
				"summary": "Revoke the previous capture signing secret",
				"tags": [
					"settings"
				],
				"description": "Ends the rotation overlap immediately. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHook"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/signing/disable": {
			"post": {
				"summary": "Disable signed capture delivery",
				"tags": [
					"settings"
				],
				"description": "Revokes both signing secrets immediately and returns the hook to public-token browser form mode.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CaptureHook"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/deliveries": {
			"get": {
				"summary": "List deliveries a capture hook received",
				"tags": [
					"settings"
				],
				"description": "Newest first, keyset-paginated. Merges accepted deliveries (from the attribution touch), replayed duplicates, and rejected deliveries aggregated by failure shape with an occurrence count. Requests refused before the hook resolved — an unknown or paused token, or a rate limit — are never recorded and cannot appear here.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "kind",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"accepted",
								"rejected"
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CaptureDeliverySummary"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/capture-hooks/{id}/deliveries/{kind}/{deliveryId}": {
			"get": {
				"summary": "Get one delivery's payload",
				"tags": [
					"settings"
				],
				"description": "Returns the stored payload so a field mapping can be built from a real submission, plus the attribution intake made of it — the stored touch columns for an accepted delivery, the same extraction re-run over the body for a rejected one. Rejected bodies older than 13 months are redacted in place; the delivery itself is retained.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "kind",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"accepted",
								"rejected"
							]
						}
					},
					{
						"name": "deliveryId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"kind": {
											"type": "string",
											"enum": [
												"accepted",
												"rejected"
											]
										},
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"receivedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"outcomeCode": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"invalid_json",
														"not_an_object",
														"invalid_multipart",
														"body_not_utf8",
														"signature_invalid",
														"signing_unavailable",
														"query_string_forbidden",
														"content_type_forbidden",
														"event_id_mismatch",
														"payload_bounds",
														"contact_required",
														"idempotency_key_reused",
														"delivery_in_progress",
														"honeypot",
														"turnstile_failed",
														"unpinned_domain"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"errorMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"contentType": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"payload": {
											"anyOf": [
												{
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {}
												},
												{
													"type": "null"
												}
											]
										},
										"body": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bodyEncoding": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"utf8",
														"lossy",
														"merged_json"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"bodyTruncated": {
											"type": "boolean"
										},
										"headers": {
											"type": "object",
											"propertyNames": {
												"type": "string"
											},
											"additionalProperties": {
												"type": "string"
											}
										},
										"redacted": {
											"type": "boolean"
										},
										"attribution": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/CaptureDeliveryAttribution"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"kind",
										"id",
										"receivedAt",
										"outcomeCode",
										"errorMessage",
										"contentType",
										"payload",
										"body",
										"bodyEncoding",
										"bodyTruncated",
										"headers",
										"redacted",
										"attribution"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/capture/{token}": {
			"post": {
				"summary": "Public lead intake",
				"tags": [
					"capture"
				],
				"description": "Unauthenticated endpoint for website forms and webhooks. Public-token hooks accept application/json, application/x-www-form-urlencoded and multipart/form-data; URL query parameters are merged underneath the body. Signed hooks accept JSON only with no query string and require X-SmileLine-Delivery-Id, X-SmileLine-Timestamp and X-SmileLine-Signature: v1=<hex>, signing timestamp.deliveryId.rawBody with HMAC-SHA256. Timestamps have a five-minute skew allowance and use Unix seconds; deliveryId is the idempotency key and any _sl.event_id must be absent or identical. The hook's fieldMap routes incoming keys to patient fields; each entry is an exact key or a dot path into a nested payload (data.contact.email, answers.0.value), and an exact key always wins over a path. The hook's extraFields ([{key, label}]) promote further incoming keys onto the created journey's customFields as label → value. Attribution is captured automatically into a lead touch: attribution-named keys anywhere in the payload, nested objects included, with the shallowest occurrence winning (utm_*, gclid/gbraid/wbraid, fbclid, msclkid, ttclid, li_fat_id, twclid, epik, sc_click_id, rdt_cid and more, plus landing_url/referrer/user_agent and a forwarded visitor IP as client_ip/visitor_ip/user_ip/remote_ip/ip_address/ip, which beats the request's own IP on server-to-server posts) and/or a structured `_sl` envelope (event_id, visitor_id, urls, url_params, cookies, client_hints, screen, timezone, consent, ga) — envelope values win. `_sl.event_id` is an idempotency key: re-posting the same event_id returns the original result without creating anything. Every bounded unmapped field is preserved verbatim on the touch's raw snapshot. Requests are limited to 64 KiB; the merged body/query snapshot allows at most 100 keys, 128-byte key names, 8 KiB string values, 20 items per array and five levels of nesting. Requires at least a valid email or phone after mapping. Rate limited per hook; unknown, paused and archived tokens all answer 404.",
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/tracking": {
			"get": {
				"summary": "Get website tracking setup",
				"tags": [
					"settings"
				],
				"description": "Lazily mints the tracking row and its public site key on first read.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebsiteTracking"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update website tracking settings",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"siteUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"pinnedDomains": {
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 253,
											"pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$"
										},
										"description": "Pinned domains must be unique; empty disables pinning"
									},
									"consentPolicy": {
										"type": "string",
										"enum": [
											"auto",
											"always_required",
											"not_required"
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebsiteTracking"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/call-tracking": {
			"get": {
				"summary": "Get call-tracking pools and numbers",
				"tags": [
					"settings"
				],
				"description": "Pools, their rotating numbers, verification state and the transcription switch. Call tracking is part of the core plan; it bills per held number plus metered minutes/transcription.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"pools": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TrackingPool"
											}
										},
										"kycRequired": {
											"type": "boolean"
										},
										"kycStatus": {
											"type": "string",
											"enum": [
												"none",
												"submitted",
												"pending",
												"approved",
												"declined",
												"expired"
											]
										},
										"kycReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"kycReviewStalled": {
											"type": "boolean"
										},
										"callTranscriptionEnabled": {
											"type": "boolean"
										},
										"country": {
											"type": "string"
										},
										"ceilings": {
											"type": "object",
											"properties": {
												"maxConcurrentCalls": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"dailyMinutesCeiling": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"maxConcurrentCalls",
												"dailyMinutesCeiling"
											],
											"additionalProperties": false
										},
										"ceilingAlert": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"day": {
															"type": "string"
														},
														"minutes": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"day",
														"minutes"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"ga4": {
											"type": "object",
											"properties": {
												"measurementId": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"apiSecretSet": {
													"type": "boolean"
												},
												"parkedCount": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"measurementId",
												"apiSecretSet",
												"parkedCount"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"pools",
										"kycRequired",
										"kycStatus",
										"kycReview",
										"kycReviewStalled",
										"callTranscriptionEnabled",
										"country",
										"ceilings",
										"ceilingAlert",
										"ga4"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update call-tracking settings",
				"tags": [
					"settings"
				],
				"description": "Flip the transcription switch and/or set the GA4 destination. `ga4: null` disconnects GA4; a `ga4` object without `apiSecret` keeps the stored secret. Any GA4 save re-sends call events that had exhausted their delivery attempts.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"callTranscriptionEnabled": {
										"type": "boolean"
									},
									"ga4": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/Ga4SettingsInput"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"pools": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TrackingPool"
											}
										},
										"kycRequired": {
											"type": "boolean"
										},
										"kycStatus": {
											"type": "string",
											"enum": [
												"none",
												"submitted",
												"pending",
												"approved",
												"declined",
												"expired"
											]
										},
										"kycReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"kycReviewStalled": {
											"type": "boolean"
										},
										"callTranscriptionEnabled": {
											"type": "boolean"
										},
										"country": {
											"type": "string"
										},
										"ceilings": {
											"type": "object",
											"properties": {
												"maxConcurrentCalls": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"dailyMinutesCeiling": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"maxConcurrentCalls",
												"dailyMinutesCeiling"
											],
											"additionalProperties": false
										},
										"ceilingAlert": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"day": {
															"type": "string"
														},
														"minutes": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"day",
														"minutes"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"ga4": {
											"type": "object",
											"properties": {
												"measurementId": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"apiSecretSet": {
													"type": "boolean"
												},
												"parkedCount": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"measurementId",
												"apiSecretSet",
												"parkedCount"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"pools",
										"kycRequired",
										"kycStatus",
										"kycReview",
										"kycReviewStalled",
										"callTranscriptionEnabled",
										"country",
										"ceilings",
										"ceilingAlert",
										"ga4"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/call-tracking/pools": {
			"post": {
				"summary": "Create a tracking pool",
				"tags": [
					"settings"
				],
				"description": "An active pool must name a live treatment — a call from an unknown number is guaranteed to become a patient + journey + Today task. Forward targets that are the practice's own Voice number are recognized and rung internally.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"forwardMode": {
										"type": "string",
										"enum": [
											"location_phone",
											"custom",
											"voice_number"
										]
									},
									"forwardE164": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\+[1-9]\\d{6,14}$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"swapTargets": {
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "string",
											"pattern": "^\\+[1-9]\\d{6,14}$"
										}
									},
									"swapAllNumbers": {
										"default": false,
										"type": "boolean"
									},
									"ivrMode": {
										"type": "string",
										"enum": [
											"none",
											"menu"
										]
									},
									"ivrPromptText": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"ivrLeadDigits": {
										"maxItems": 9,
										"type": "array",
										"items": {
											"type": "string",
											"pattern": "^[0-9*#]$"
										}
									},
									"ivrTimeoutOutcome": {
										"type": "string",
										"enum": [
											"lead",
											"log_only"
										]
									},
									"ringTimeoutSec": {
										"default": null,
										"anyOf": [
											{
												"type": "integer",
												"minimum": 5,
												"maximum": 120
											},
											{
												"type": "null"
											}
										]
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"archived"
										]
									}
								},
								"required": [
									"name",
									"locationId",
									"forwardMode",
									"forwardE164",
									"defaultTreatmentId",
									"swapTargets",
									"ivrMode",
									"ivrPromptText",
									"ivrLeadDigits",
									"ivrTimeoutOutcome",
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string"
										},
										"country": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"forwardMode": {
											"type": "string",
											"enum": [
												"location_phone",
												"custom",
												"voice_number"
											]
										},
										"forwardE164": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"defaultTreatmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"swapTargets": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"swapAllNumbers": {
											"type": "boolean"
										},
										"ivrMode": {
											"type": "string",
											"enum": [
												"none",
												"menu"
											]
										},
										"ivrPromptText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ivrLeadDigits": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"ivrTimeoutOutcome": {
											"type": "string",
											"enum": [
												"lead",
												"log_only"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"archived"
											]
										},
										"numberCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"liveAssignmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"unservedToday": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"unservedWeek": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"ringTimeoutSec": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"name",
										"country",
										"locationId",
										"forwardMode",
										"forwardE164",
										"defaultTreatmentId",
										"swapTargets",
										"swapAllNumbers",
										"ivrMode",
										"ivrPromptText",
										"ivrLeadDigits",
										"ivrTimeoutOutcome",
										"status",
										"numberCount",
										"liveAssignmentCount",
										"unservedToday",
										"unservedWeek",
										"ringTimeoutSec",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/call-tracking/pools/{id}": {
			"patch": {
				"summary": "Update a tracking pool",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"forwardMode": {
										"type": "string",
										"enum": [
											"location_phone",
											"custom",
											"voice_number"
										]
									},
									"forwardE164": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\+[1-9]\\d{6,14}$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"swapTargets": {
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "string",
											"pattern": "^\\+[1-9]\\d{6,14}$"
										}
									},
									"swapAllNumbers": {
										"default": false,
										"type": "boolean"
									},
									"ivrMode": {
										"type": "string",
										"enum": [
											"none",
											"menu"
										]
									},
									"ivrPromptText": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"ivrLeadDigits": {
										"maxItems": 9,
										"type": "array",
										"items": {
											"type": "string",
											"pattern": "^[0-9*#]$"
										}
									},
									"ivrTimeoutOutcome": {
										"type": "string",
										"enum": [
											"lead",
											"log_only"
										]
									},
									"ringTimeoutSec": {
										"default": null,
										"anyOf": [
											{
												"type": "integer",
												"minimum": 5,
												"maximum": 120
											},
											{
												"type": "null"
											}
										]
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"archived"
										]
									}
								},
								"required": [
									"name",
									"locationId",
									"forwardMode",
									"forwardE164",
									"defaultTreatmentId",
									"swapTargets",
									"ivrMode",
									"ivrPromptText",
									"ivrLeadDigits",
									"ivrTimeoutOutcome",
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string"
										},
										"country": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"forwardMode": {
											"type": "string",
											"enum": [
												"location_phone",
												"custom",
												"voice_number"
											]
										},
										"forwardE164": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"defaultTreatmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"swapTargets": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"swapAllNumbers": {
											"type": "boolean"
										},
										"ivrMode": {
											"type": "string",
											"enum": [
												"none",
												"menu"
											]
										},
										"ivrPromptText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ivrLeadDigits": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"ivrTimeoutOutcome": {
											"type": "string",
											"enum": [
												"lead",
												"log_only"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"archived"
											]
										},
										"numberCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"liveAssignmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"unservedToday": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"unservedWeek": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"ringTimeoutSec": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"name",
										"country",
										"locationId",
										"forwardMode",
										"forwardE164",
										"defaultTreatmentId",
										"swapTargets",
										"swapAllNumbers",
										"ivrMode",
										"ivrPromptText",
										"ivrLeadDigits",
										"ivrTimeoutOutcome",
										"status",
										"numberCount",
										"liveAssignmentCount",
										"unservedToday",
										"unservedWeek",
										"ringTimeoutSec",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/tracking/regenerate-key": {
			"post": {
				"summary": "Regenerate the public site key",
				"tags": [
					"settings"
				],
				"description": "Mints a fresh key; snippets carrying the previous key stop resolving immediately.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebsiteTracking"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/tracking/detect-cms": {
			"post": {
				"summary": "Detect the website's CMS",
				"tags": [
					"settings"
				],
				"description": "Fetches the configured site URL server-side and records the detected builder. Fail-closed: an unreachable or unrecognized site records `unknown`, never an error.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebsiteTracking"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/tracking/send-instructions": {
			"post": {
				"summary": "Email install instructions to a developer",
				"tags": [
					"settings"
				],
				"description": "Throttled to one send per hour per organization.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"recipientEmail": {
										"type": "string",
										"maxLength": 320,
										"format": "email",
										"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
									}
								},
								"required": [
									"recipientEmail"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebsiteTracking"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/tracking/status": {
			"get": {
				"summary": "Get the derived setup checklist",
				"tags": [
					"settings"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebsiteSetupStatus"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/forms": {
			"get": {
				"summary": "List website forms",
				"tags": [
					"settings"
				],
				"description": "All three transports: CRM-built, auto-discovered and custom integrations. Archived forms are excluded unless includeArchived=true.",
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/FormListItem"
											}
										},
										"tracking": {
											"$ref": "#/components/schemas/WebsiteTracking"
										}
									},
									"required": [
										"items",
										"tracking"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a website form",
				"tags": [
					"settings"
				],
				"description": "crm builds a hosted/embeddable form from a builder document; custom mints a raw capture endpoint (today's capture-hook fields). Both mint the invisible owning capture hook; authMode=signed returns a signingSecret exactly once.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"type": {
												"type": "string",
												"const": "crm"
											},
											"name": {
												"type": "string",
												"minLength": 1
											},
											"builderConfig": {
												"$ref": "#/components/schemas/FormBuilderConfig"
											},
											"hostedPageEnabled": {
												"type": "boolean"
											},
											"locationId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"defaultLeadSourceId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"defaultTreatmentId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"type",
											"name",
											"builderConfig"
										]
									},
									{
										"type": "object",
										"properties": {
											"type": {
												"type": "string",
												"const": "custom"
											},
											"name": {
												"type": "string",
												"minLength": 1
											},
											"defaultIntakeMethod": {
												"type": "string",
												"enum": [
													"form",
													"website_form",
													"webhook",
													"zapier",
													"lead_ad",
													"whatsapp",
													"sms",
													"call",
													"chat",
													"manual",
													"import",
													"booking",
													"referral"
												]
											},
											"affiliateLabel": {
												"anyOf": [
													{
														"type": "string",
														"minLength": 1
													},
													{
														"type": "null"
													}
												]
											},
											"fieldMap": {
												"type": "object",
												"properties": {
													"firstName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"lastName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"email": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"phoneMobile": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"phoneOther": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"dateOfBirth": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"gender": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"addressLine1": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"addressLine2": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"city": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"province": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"postalCode": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"country": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"preferredContactMethod": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"preferredContactTime": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"treatmentSlug": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"location": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"message": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"note": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"marketingConsent": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													}
												}
											},
											"active": {
												"type": "boolean"
											},
											"authMode": {
												"default": "public",
												"type": "string",
												"enum": [
													"public",
													"signed"
												]
											},
											"awaitFirstSubmission": {
												"type": "boolean"
											},
											"locationId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"defaultLeadSourceId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"defaultTreatmentId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"type",
											"name"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"type": {
											"type": "string",
											"enum": [
												"crm",
												"discovered",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"pending",
												"active",
												"paused"
											]
										},
										"captureHookId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"domain": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"builderConfig": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/FormBuilderConfig"
												},
												{
													"type": "null"
												}
											]
										},
										"fingerprint": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"pageUrl": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"selector": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fieldInventory": {},
										"lastSeenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"proposedFieldMap": {},
										"proposalSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"ai",
														"heuristic"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"mappingConfirmedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"mappingConfirmedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"hostedPageToken": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"hostedPageEnabled": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"name": {
											"type": "string"
										},
										"token": {
											"type": "string"
										},
										"signingSecret": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"type",
										"status",
										"captureHookId",
										"domain",
										"builderConfig",
										"fingerprint",
										"pageUrl",
										"selector",
										"fieldInventory",
										"lastSeenAt",
										"proposedFieldMap",
										"proposalSource",
										"mappingConfirmedAt",
										"mappingConfirmedById",
										"hostedPageToken",
										"hostedPageEnabled",
										"archivedAt",
										"createdAt",
										"updatedAt",
										"name",
										"token",
										"signingSecret"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/forms/{id}": {
			"get": {
				"summary": "Get a website form",
				"tags": [
					"settings"
				],
				"description": "Embeds the owning capture hook, so the form page needs no second read.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"type": {
											"type": "string",
											"enum": [
												"crm",
												"discovered",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"pending",
												"active",
												"paused"
											]
										},
										"captureHookId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"domain": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"builderConfig": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/FormBuilderConfig"
												},
												{
													"type": "null"
												}
											]
										},
										"fingerprint": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"pageUrl": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"selector": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fieldInventory": {},
										"lastSeenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"proposedFieldMap": {},
										"proposalSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"ai",
														"heuristic"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"mappingConfirmedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"mappingConfirmedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"hostedPageToken": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"hostedPageEnabled": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"name": {
											"type": "string"
										},
										"token": {
											"type": "string"
										},
										"hook": {
											"$ref": "#/components/schemas/CaptureHook"
										}
									},
									"required": [
										"id",
										"organizationId",
										"type",
										"status",
										"captureHookId",
										"domain",
										"builderConfig",
										"fingerprint",
										"pageUrl",
										"selector",
										"fieldInventory",
										"lastSeenAt",
										"proposedFieldMap",
										"proposalSource",
										"mappingConfirmedAt",
										"mappingConfirmedById",
										"hostedPageToken",
										"hostedPageEnabled",
										"archivedAt",
										"createdAt",
										"updatedAt",
										"name",
										"token",
										"hook"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a website form",
				"tags": [
					"settings"
				],
				"description": "Form fields and the owning hook's fields through one surface. Set status=paused to stop intake without archiving.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"paused"
										]
									},
									"domain": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 253,
												"pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$"
											},
											{
												"type": "null"
											}
										]
									},
									"builderConfig": {
										"$ref": "#/components/schemas/FormBuilderConfig"
									},
									"hostedPageEnabled": {
										"type": "boolean"
									},
									"defaultIntakeMethod": {
										"type": "string",
										"enum": [
											"form",
											"website_form",
											"webhook",
											"zapier",
											"lead_ad",
											"whatsapp",
											"sms",
											"call",
											"chat",
											"manual",
											"import",
											"booking",
											"referral"
										]
									},
									"affiliateLabel": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"fieldMap": {
										"type": "object",
										"properties": {
											"firstName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"lastName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"email": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneMobile": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneOther": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"dateOfBirth": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"gender": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine1": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine2": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"city": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"province": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"postalCode": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"country": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactMethod": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactTime": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"treatmentSlug": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"location": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"message": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"note": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"marketingConsent": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											}
										}
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultLeadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Form"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/forms/{id}/archive": {
			"post": {
				"summary": "Archive a website form",
				"tags": [
					"settings"
				],
				"description": "Sets archivedAt on the form and its capture hook; the public endpoints answer 404. Permanently discards every submission still waiting for the form's field mapping, in the same transaction. Idempotent — a repeated call sweeps anything a previous one left.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Form"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/forms/{id}/restore": {
			"post": {
				"summary": "Restore an archived website form",
				"tags": [
					"settings"
				],
				"description": "Clears archivedAt only — a previously paused form stays paused. Submissions the archive discarded are not restored; a form still awaiting its mapping returns to the review queue and groups its next submissions again. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Form"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/forms/{id}/confirm-mapping": {
			"post": {
				"summary": "Confirm a pending form's field mapping",
				"tags": [
					"settings"
				],
				"description": "For a form in `pending` (discovered, or a custom endpoint awaiting its first submission): writes the hook's fieldMap and defaults, activates the form, and replays every submission parked for it through the ingress vault.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"fieldMap": {
										"type": "object",
										"properties": {
											"firstName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"lastName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"email": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneMobile": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"phoneOther": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"dateOfBirth": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"gender": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine1": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"addressLine2": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"city": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"province": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"postalCode": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"country": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactMethod": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"preferredContactTime": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"treatmentSlug": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"location": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"message": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"note": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											"marketingConsent": {
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											}
										}
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultLeadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"fieldMap"
								],
								"description": "Writes the hook's fieldMap and defaults, activates the form, and replays every submission parked for it."
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Form"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/forms/{id}/propose-mapping": {
			"post": {
				"summary": "Propose a field mapping",
				"tags": [
					"settings"
				],
				"description": "For a form in `pending`: synchronous AI proposal over the discovered field inventory (or, for a custom endpoint, the fields of its newest submission) and the latest stored delivery, falling back to the pure heuristic. Nothing is written until the mapping is confirmed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FormMappingProposal"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/forms/{id}/sample": {
			"get": {
				"summary": "Get a form's newest submission payload",
				"tags": [
					"settings"
				],
				"description": "The newest accepted delivery's payload, else the newest parked pending submission. Null until something arrives. Cheap enough to poll while a custom endpoint listens for its first submission.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"payload": {
											"anyOf": [
												{
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {}
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"accepted",
														"parked"
													]
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"payload",
										"source"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/site/{siteKey}/config": {
			"get": {
				"summary": "Public tracking-script configuration",
				"tags": [
					"site"
				],
				"description": "Unauthenticated, keyed by the public site key (`pk_…`). Returns the module switches, consent posture and forms to instrument. Edge-cached; fetching it doubles as the script heartbeat (recorded at most once per ten minutes per colo). Unknown or disabled keys answer 404.",
				"security": [],
				"parameters": [
					{
						"name": "siteKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 80
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteConfig"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/site/{siteKey}/forms": {
			"post": {
				"summary": "Public form-discovery report",
				"tags": [
					"site"
				],
				"description": "Unauthenticated; the tracking script reports forms it found on the practice's website. Server-side fingerprinting collapses re-scans onto the same form; new forms park in the review queue pending mapping confirmation. Rate limited per site; bodies are bounded and stored durably before parsing.",
				"security": [],
				"parameters": [
					{
						"name": "siteKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 80
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"pageUrl": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2048
									},
									"forms": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"fingerprint": {
													"type": "string",
													"maxLength": 64
												},
												"selector": {
													"type": "string",
													"minLength": 1,
													"maxLength": 512
												},
												"fields": {
													"minItems": 1,
													"maxItems": 60,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"name": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"label": {
																"anyOf": [
																	{
																		"type": "string",
																		"maxLength": 200
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"inputType": {
																"anyOf": [
																	{
																		"type": "string",
																		"maxLength": 32
																	},
																	{
																		"type": "null"
																	}
																]
															}
														},
														"required": [
															"name"
														]
													},
													"description": "Field names must be unique"
												}
											},
											"required": [
												"selector",
												"fields"
											]
										}
									}
								},
								"required": [
									"pageUrl",
									"forms"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/site/{siteKey}/dni": {
			"post": {
				"summary": "Public tracking-number assignment",
				"tags": [
					"site"
				],
				"description": "Unauthenticated, keyed by the public site key (`pk_…`). Assigns one rotating call-tracking number per active pool to this visitor (sticky for the rolling hold window) and returns the swap instructions. An unexpired assignment is never reassigned; when every number is held the response is empty and the page keeps its real number. Failures degrade to an empty assignment list — this endpoint never breaks the host page.",
				"security": [],
				"parameters": [
					{
						"name": "siteKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 80
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"visitor_id": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"page_url": {
										"type": "string",
										"maxLength": 2048
									},
									"_sl": {
										"type": "object",
										"properties": {
											"event_id": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"visitor_id": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"landing_url": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2048
											},
											"capture_url": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2048
											},
											"referrer": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2048
											},
											"url_params": {
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {
													"type": "string"
												}
											},
											"cookies": {
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {
													"type": "string"
												}
											},
											"client_hints": {
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {
													"type": "string"
												}
											},
											"screen_width": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 32767
											},
											"screen_height": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 32767
											},
											"timezone": {
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											"consent": {
												"type": "object",
												"properties": {
													"ad_storage": {
														"anyOf": [
															{
																"type": "boolean"
															},
															{
																"type": "null"
															}
														]
													},
													"analytics_storage": {
														"anyOf": [
															{
																"type": "boolean"
															},
															{
																"type": "null"
															}
														]
													},
													"ad_user_data": {
														"anyOf": [
															{
																"type": "boolean"
															},
															{
																"type": "null"
															}
														]
													},
													"ad_personalization": {
														"anyOf": [
															{
																"type": "boolean"
															},
															{
																"type": "null"
															}
														]
													}
												}
											},
											"ga": {
												"type": "object",
												"properties": {
													"client_id": {
														"type": "string",
														"minLength": 1,
														"maxLength": 64
													},
													"session_id": {
														"type": "string",
														"minLength": 1,
														"maxLength": 64
													}
												}
											}
										}
									}
								},
								"required": [
									"visitor_id"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"assignments": {
											"maxItems": 10,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pool": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"e164": {
														"type": "string"
													},
													"display": {
														"type": "object",
														"properties": {
															"national": {
																"type": "string"
															},
															"international": {
																"type": "string"
															}
														},
														"required": [
															"national",
															"international"
														],
														"additionalProperties": false
													},
													"replace": {
														"maxItems": 10,
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"replace_all": {
														"type": "boolean"
													}
												},
												"required": [
													"pool",
													"e164",
													"display",
													"replace",
													"replace_all"
												],
												"additionalProperties": false
											}
										},
										"ttl_s": {
											"type": "number",
											"const": 600
										}
									},
									"required": [
										"assignments",
										"ttl_s"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/form-page/{token}": {
			"get": {
				"summary": "Public hosted-form configuration",
				"tags": [
					"site"
				],
				"description": "Unauthenticated, keyed by the form's hosted-page token. Patient-safe by construction: practice display name, brand color and the builder document only. Unknown, disabled and archived tokens all answer 404.",
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 80
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HostedForm"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ingest-review-items": {
			"get": {
				"summary": "List inbound payloads that need review",
				"tags": [
					"ingest-review"
				],
				"description": "Lists submissions and provider events that never became a business record — parked payloads, unrecognized event types, wedged sync rows — with the resolution history once a human acts. A detected website form still waiting for its field mapping is listed once, with pendingSubmissions counting the submissions waiting for it; those submissions are not listed separately until the form is confirmed or archived. Kind totals use the selected status and ignore the optional kind filter.",
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"default": "open",
							"type": "string",
							"enum": [
								"open",
								"resolved"
							]
						}
					},
					{
						"name": "kind",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"ingress-vault",
								"stripe-event",
								"pms-staging",
								"lead-ad-submission",
								"dialer-event",
								"discovered-form",
								"call-lead-capture",
								"missed-call-followup",
								"patient-account"
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/IngestReviewItem"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"kindTotals": {
											"type": "object",
											"properties": {
												"ingress-vault": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"stripe-event": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"pms-staging": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"lead-ad-submission": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"dialer-event": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"discovered-form": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"call-lead-capture": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"missed-call-followup": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"patient-account": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"ingress-vault",
												"stripe-event",
												"pms-staging",
												"lead-ad-submission",
												"dialer-event",
												"discovered-form",
												"call-lead-capture",
												"missed-call-followup",
												"patient-account"
											],
											"additionalProperties": false
										},
										"openTotal": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"nextCursor",
										"kindTotals",
										"openTotal"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ingest-review-items/{id}/payload": {
			"get": {
				"summary": "Inspect a stored payload",
				"tags": [
					"ingest-review"
				],
				"description": "Returns the raw stored payload (bounded) with its receipt metadata. Payload-free kinds return metadata only.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"contentType": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bodyEncoding": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"utf8",
														"base64"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"body": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bodyTruncated": {
											"type": "boolean"
										},
										"meta": {
											"anyOf": [
												{
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {}
												},
												{
													"type": "null"
												}
											]
										},
										"replayHeaders": {
											"anyOf": [
												{
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {
														"type": "string"
													}
												},
												{
													"type": "null"
												}
											]
										},
										"failureSummary": {
											"type": "string"
										}
									},
									"required": [
										"contentType",
										"bodyEncoding",
										"body",
										"bodyTruncated",
										"meta",
										"replayHeaders",
										"failureSummary"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ingest-review-items/{id}/replay": {
			"post": {
				"summary": "Retry a stranded payload",
				"tags": [
					"ingest-review"
				],
				"description": "Replays the payload through the same idempotent entry the live delivery would have used. Safe to repeat; a payload that still cannot process stays in review.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"outcome": {
											"type": "string",
											"enum": [
												"recovered",
												"duplicate",
												"rejected",
												"retried",
												"deferred",
												"held",
												"quarantined",
												"exhausted",
												"missing",
												"unregistered",
												"manual_review",
												"released",
												"reset_for_retry",
												"provider_event_expired",
												"not_replayable"
											]
										},
										"state": {
											"type": "string",
											"enum": [
												"pending",
												"needs_review",
												"resolved",
												"discarded"
											]
										}
									},
									"required": [
										"outcome",
										"state"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ingest-review-items/{id}/resolve": {
			"post": {
				"summary": "Mark a review item handled",
				"tags": [
					"ingest-review"
				],
				"description": "Records an audited resolution with an optional bounded note. The stored payload is kept; discarding it here, or archiving the website form it waits on, removes it. A detected-form row is settled from Settings → Website instead (409).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"resolutionNote": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"state": {
											"type": "string",
											"enum": [
												"pending",
												"needs_review",
												"resolved",
												"discarded"
											]
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"resolutionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"state",
										"resolvedAt",
										"resolvedById",
										"resolutionNote"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ingest-review-items/{id}/discard": {
			"post": {
				"summary": "Discard a stored payload",
				"tags": [
					"ingest-review"
				],
				"description": "Deliberate deletion: records who discarded it and why, then removes the stored payload. The review row survives as the durable record. The only other way inbound data is removed is archiving a website form that still holds submissions waiting for its mapping; a detected-form row is settled there, not here (409).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"resolutionNote": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1000
									}
								},
								"required": [
									"resolutionNote"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"state": {
											"type": "string",
											"enum": [
												"pending",
												"needs_review",
												"resolved",
												"discarded"
											]
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"resolutionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"state",
										"resolvedAt",
										"resolvedById",
										"resolutionNote"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/intake-review-issues": {
			"get": {
				"summary": "List intake issues that need staff review",
				"tags": [
					"intake-review"
				],
				"description": "Lists capture-time reference degradations without changing patient data. Staff correct the patient or hook through the existing editors, then acknowledge the issue separately. Reason totals use the selected status and ignore the optional reason filter.",
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"default": "open",
							"type": "string",
							"enum": [
								"open",
								"resolved"
							]
						}
					},
					{
						"name": "reason",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"archived_location",
								"archived_treatment",
								"archived_lead_source",
								"invalid_optional_reference",
								"intake_receipt_stalled",
								"contact_value_unparsed"
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/IntakeReviewIssue"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reasonTotals": {
											"type": "object",
											"properties": {
												"archived_location": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"archived_treatment": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"archived_lead_source": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"invalid_optional_reference": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"intake_receipt_stalled": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"contact_value_unparsed": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"archived_location",
												"archived_treatment",
												"archived_lead_source",
												"invalid_optional_reference",
												"intake_receipt_stalled",
												"contact_value_unparsed"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"items",
										"nextCursor",
										"reasonTotals"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/intake-review-issues/{id}/resolve": {
			"post": {
				"summary": "Acknowledge a corrected intake issue",
				"tags": [
					"intake-review"
				],
				"description": "Records an audited acknowledgement and optional bounded note. It never mutates the patient, journey, hook, or referenced lookup.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"resolutionNote": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"status": {
											"type": "string",
											"const": "resolved"
										},
										"resolutionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"status",
										"resolutionNote",
										"resolvedById",
										"resolvedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/leads": {
			"post": {
				"summary": "Create a lead from a connected integration",
				"tags": [
					"leads"
				],
				"description": "Creates or matches a patient, opens a journey and records an attribution touch through the same pipeline as public form capture. Idempotent on eventId (or the body digest when none is given). Answers 202 when the payload was stored but could not be processed yet; it is replayed automatically.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"firstName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"lastName": {
										"type": "string",
										"maxLength": 200
									},
									"email": {
										"type": "string",
										"maxLength": 320,
										"format": "email",
										"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
									},
									"phoneMobile": {
										"type": "string",
										"maxLength": 50
									},
									"phoneOther": {
										"type": "string",
										"maxLength": 50
									},
									"dateOfBirth": {
										"type": "string",
										"maxLength": 40
									},
									"gender": {
										"type": "string",
										"maxLength": 40
									},
									"addressLine1": {
										"type": "string",
										"maxLength": 200
									},
									"addressLine2": {
										"type": "string",
										"maxLength": 200
									},
									"city": {
										"type": "string",
										"maxLength": 200
									},
									"province": {
										"type": "string",
										"maxLength": 200
									},
									"postalCode": {
										"type": "string",
										"maxLength": 40
									},
									"country": {
										"type": "string",
										"maxLength": 100
									},
									"preferredContactMethod": {
										"type": "string",
										"maxLength": 40
									},
									"preferredContactTime": {
										"type": "string",
										"maxLength": 200
									},
									"treatmentSlug": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"location": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"message": {
										"type": "string",
										"maxLength": 10000
									},
									"note": {
										"type": "string",
										"maxLength": 10000
									},
									"marketingConsent": {
										"anyOf": [
											{
												"type": "boolean"
											},
											{
												"type": "string",
												"maxLength": 16
											}
										]
									},
									"eventId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"landingUrl": {
										"type": "string",
										"maxLength": 2048
									},
									"captureUrl": {
										"type": "string",
										"maxLength": 2048
									},
									"referrer": {
										"type": "string",
										"maxLength": 2048
									},
									"attribution": {
										"type": "object",
										"propertyNames": {
											"type": "string",
											"minLength": 1,
											"maxLength": 128
										},
										"additionalProperties": {
											"type": "string",
											"maxLength": 2048
										}
									}
								},
								"required": [
									"firstName",
									"treatmentSlug"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadIntakeResult"
								}
							}
						}
					},
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadIntakeAccepted"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/connected-apps": {
			"get": {
				"summary": "List apps connected to this practice",
				"tags": [
					"settings",
					"connected-apps"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ConnectedApp"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/connected-apps/{id}": {
			"delete": {
				"summary": "Disconnect an app from this practice",
				"tags": [
					"settings",
					"connected-apps"
				],
				"description": "Revokes the connection's tokens immediately and archives the webhook endpoints it created. Takes effect on the next request, not at token expiry.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints": {
			"get": {
				"summary": "List outbound webhook endpoints",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WebhookEndpoint"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create an outbound webhook endpoint",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"description": "Returns the HMAC signing secret once. The endpoint stays disabled until a test delivery succeeds.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri",
										"description": "Absolute HTTPS URL, at most 2048 UTF-8 bytes."
									},
									"events": {
										"minItems": 1,
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"patient.created",
												"patient.updated",
												"patient.archived",
												"journey.created",
												"journey.updated",
												"journey.stage_changed",
												"journey.won",
												"journey.lost",
												"journey.reopened",
												"task.created",
												"task.updated",
												"task.completed",
												"task.reopened",
												"task.cancelled",
												"appointment.created",
												"appointment.updated",
												"appointment.status_changed",
												"appointment.rescheduled",
												"conversation.created",
												"conversation.updated",
												"message.received",
												"message.sent",
												"message.status_changed",
												"deposit_request.created",
												"deposit_request.status_changed",
												"reputation_request.status_changed",
												"reputation_feedback.received",
												"reputation_review.received",
												"reputation_review.updated",
												"reputation_reply.status_changed",
												"lead_ad_submission.received",
												"lead_ad_submission.status_changed",
												"lead_ad_connection.health_changed",
												"pms_connection.health_changed",
												"pms_patient.link_changed",
												"pms_sync.review_required",
												"pms_treatment_plan.updated",
												"pms_invoice.updated",
												"pms_payment.updated",
												"channel_connection.health_changed"
											]
										}
									}
								},
								"required": [
									"name",
									"url",
									"events"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpointSetup"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/subscriptions": {
			"post": {
				"summary": "Create or resume a machine-managed webhook subscription",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"description": "Creates the endpoint, delivers a signed verification probe with an X-Hook-Secret challenge, and enables it when the receiver returns a 2xx response echoing that challenge. Idempotent on subscriptionKey: an existing live subscription is returned with its current signing secret (200) rather than replaced.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri",
										"description": "Absolute HTTPS URL, at most 2048 UTF-8 bytes."
									},
									"events": {
										"minItems": 1,
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"patient.created",
												"patient.updated",
												"patient.archived",
												"journey.created",
												"journey.updated",
												"journey.stage_changed",
												"journey.won",
												"journey.lost",
												"journey.reopened",
												"task.created",
												"task.updated",
												"task.completed",
												"task.reopened",
												"task.cancelled",
												"appointment.created",
												"appointment.updated",
												"appointment.status_changed",
												"appointment.rescheduled",
												"conversation.created",
												"conversation.updated",
												"message.received",
												"message.sent",
												"message.status_changed",
												"deposit_request.created",
												"deposit_request.status_changed",
												"reputation_request.status_changed",
												"reputation_feedback.received",
												"reputation_review.received",
												"reputation_review.updated",
												"reputation_reply.status_changed",
												"lead_ad_submission.received",
												"lead_ad_submission.status_changed",
												"lead_ad_connection.health_changed",
												"pms_connection.health_changed",
												"pms_patient.link_changed",
												"pms_sync.review_required",
												"pms_treatment_plan.updated",
												"pms_invoice.updated",
												"pms_payment.updated",
												"channel_connection.health_changed"
											]
										}
									},
									"subscriptionKey": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"required": [
									"name",
									"url",
									"events",
									"subscriptionKey"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpointSetup"
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpointSetup"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}": {
			"get": {
				"summary": "Get an outbound webhook endpoint",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpoint"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update an outbound webhook endpoint",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"description": "Changing the URL clears verification and disables delivery.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri",
										"description": "Absolute HTTPS URL, at most 2048 UTF-8 bytes."
									},
									"events": {
										"minItems": 1,
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"patient.created",
												"patient.updated",
												"patient.archived",
												"journey.created",
												"journey.updated",
												"journey.stage_changed",
												"journey.won",
												"journey.lost",
												"journey.reopened",
												"task.created",
												"task.updated",
												"task.completed",
												"task.reopened",
												"task.cancelled",
												"appointment.created",
												"appointment.updated",
												"appointment.status_changed",
												"appointment.rescheduled",
												"conversation.created",
												"conversation.updated",
												"message.received",
												"message.sent",
												"message.status_changed",
												"deposit_request.created",
												"deposit_request.status_changed",
												"reputation_request.status_changed",
												"reputation_feedback.received",
												"reputation_review.received",
												"reputation_review.updated",
												"reputation_reply.status_changed",
												"lead_ad_submission.received",
												"lead_ad_submission.status_changed",
												"lead_ad_connection.health_changed",
												"pms_connection.health_changed",
												"pms_patient.link_changed",
												"pms_sync.review_required",
												"pms_treatment_plan.updated",
												"pms_invoice.updated",
												"pms_payment.updated",
												"channel_connection.health_changed"
											]
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpoint"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Archive an outbound webhook endpoint",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/test": {
			"post": {
				"summary": "Queue a test webhook delivery",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookDelivery"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/enable": {
			"post": {
				"summary": "Enable a verified webhook endpoint",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpoint"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/pause": {
			"post": {
				"summary": "Pause a webhook endpoint",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"default": "Paused by a user",
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpoint"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/secret/rotate": {
			"post": {
				"summary": "Rotate a webhook signing secret",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"description": "The previous secret remains valid for 24 hours unless revoked.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpointSetup"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/secret/revoke-previous": {
			"post": {
				"summary": "Revoke the previous webhook signing secret",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookEndpoint"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/deliveries": {
			"get": {
				"summary": "List webhook deliveries",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"pending",
								"leased",
								"delivered",
								"failed"
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WebhookDelivery"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/deliveries/{deliveryId}": {
			"get": {
				"summary": "Get a webhook delivery",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "deliveryId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookDelivery"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/webhook-endpoints/{id}/deliveries/{deliveryId}/replay": {
			"post": {
				"summary": "Replay a webhook delivery",
				"tags": [
					"settings",
					"outbound-webhooks"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "deliveryId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebhookDelivery"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations": {
			"get": {
				"summary": "List conversations",
				"tags": [
					"inbox"
				],
				"description": "Sorted by lastMessageAt DESC with cursor pagination. Without a status filter, closed conversations are excluded. assignee accepts 'me', 'unassigned' or a member user id. q searches peer name/handle and the last-message preview.",
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"pending",
								"snoozed",
								"closed"
							]
						}
					},
					{
						"name": "channel",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"whatsapp",
								"sms",
								"email",
								"webchat",
								"messenger",
								"instagram",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments"
							]
						}
					},
					{
						"name": "assignee",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "unread",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "patientStatus",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(enquiry|lead|patient|inactive|archived|deceased)(,(enquiry|lead|patient|inactive|archived|deceased))*$"
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ConversationListItem"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Start an outbound conversation",
				"tags": [
					"inbox"
				],
				"description": "Finds or creates the contact's unified thread for the recipient and sends the first message through it — if the recipient (or the matched patient) already has a thread, the message lands there as a new endpoint and the existing conversation is returned. WhatsApp with no prior inbound requires a template message.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"connectionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"to": {
										"type": "string",
										"minLength": 1,
										"maxLength": 320
									},
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"message": {
										"type": "object",
										"properties": {
											"clientRef": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"endpointId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"subjectPatientId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"type": {
												"default": "text",
												"type": "string",
												"enum": [
													"text",
													"note",
													"template"
												]
											},
											"body": {
												"type": "string",
												"minLength": 1,
												"maxLength": 10000
											},
											"subject": {
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											"emailHtml": {
												"type": "string",
												"maxLength": 200000
											},
											"templateId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"templateVariables": {
												"maxItems": 20,
												"type": "array",
												"items": {
													"type": "string",
													"maxLength": 500
												}
											},
											"attachments": {
												"maxItems": 20,
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"uploadId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													},
													"required": [
														"uploadId"
													]
												}
											},
											"commentReply": {
												"type": "object",
												"properties": {
													"visibility": {
														"type": "string",
														"enum": [
															"public",
															"private"
														]
													}
												},
												"required": [
													"visibility"
												]
											}
										},
										"required": [
											"clientRef"
										],
										"description": "Requires at least one of body, templateId or attachments."
									}
								},
								"required": [
									"connectionId",
									"to",
									"message"
								],
								"description": "message.type must not be 'note'."
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ConversationDetail"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}": {
			"get": {
				"summary": "Get a conversation",
				"tags": [
					"inbox"
				],
				"description": "embed=messages includes the newest page of messages (ascending) with a cursor for older pages.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "messages"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ConversationDetail"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a conversation",
				"tags": [
					"inbox"
				],
				"description": "Assign, close/reopen, snooze (status=snoozed + snoozedUntil), link a patient/journey, or mark unread. Linking a patient backfills the timeline; if the patient already has a thread, the two are merged and the survivor is returned (a conversation.merged event re-points open clients).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"open",
											"pending",
											"snoozed",
											"closed"
										]
									},
									"snoozedUntil": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"assigneeId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"patientId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"unread": {
										"type": "boolean",
										"const": true
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ConversationListItem"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/represented-patients": {
			"post": {
				"summary": "Add a patient represented by this contact",
				"tags": [
					"inbox"
				],
				"description": "Explicitly records a family, guardian, guarantor or other relationship before the shared phone number or email can be used for that patient.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"role": {
										"type": "string",
										"enum": [
											"parent",
											"guardian",
											"guarantor",
											"family",
											"other"
										]
									}
								},
								"required": [
									"patientId",
									"role"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ConversationListItem"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/read": {
			"post": {
				"summary": "Mark a conversation read",
				"tags": [
					"inbox"
				],
				"description": "Zeroes the org-wide unread counter. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"unreadCount": {
											"type": "number",
											"const": 0
										}
									},
									"required": [
										"unreadCount"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/messages": {
			"get": {
				"summary": "List older messages",
				"tags": [
					"inbox"
				],
				"description": "Keyset pagination walking backwards from `before`; items are ascending within the page.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "before",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Message"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Send a message (or add an internal note)",
				"tags": [
					"inbox"
				],
				"description": "Sends through the endpoint named by endpointId (required unless type=note). subjectPatientId identifies which represented patient a message concerns, must belong to that contact, and is required when the contact represents more than one patient (409 CONTACT_PARTY_SUBJECT_REQUIRED). Returns the queued row synchronously for optimistic UI; delivery progresses via WebSocket message.updated events. Notes are never sent to the patient. Sends respect per-channel opt-outs (403 OPTED_OUT), the WhatsApp 24h window (400 WHATSAPP_WINDOW_CLOSED — retry with a template), and the 1 MiB patient-bearing metadata ceiling (413 MESSAGE_CONTENT_METADATA_TOO_LARGE).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"endpointId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"subjectPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"type": {
										"default": "text",
										"type": "string",
										"enum": [
											"text",
											"note",
											"template"
										]
									},
									"body": {
										"type": "string",
										"minLength": 1,
										"maxLength": 10000
									},
									"subject": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									"emailHtml": {
										"type": "string",
										"maxLength": 200000
									},
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"templateVariables": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"maxLength": 500
										}
									},
									"attachments": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"uploadId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"required": [
												"uploadId"
											]
										}
									},
									"commentReply": {
										"type": "object",
										"properties": {
											"visibility": {
												"type": "string",
												"enum": [
													"public",
													"private"
												]
											}
										},
										"required": [
											"visibility"
										]
									}
								},
								"required": [
									"clientRef"
								],
								"description": "Requires at least one of body, templateId or attachments."
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Message"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/messages/{messageId}": {
			"get": {
				"summary": "Get a single message",
				"tags": [
					"inbox"
				],
				"description": "Hydrates one message for a caller holding only its id — the same row the thread page returns, including the resolved email HTML body. The conversation is part of the lookup, not a check after it: a message id from another thread is indistinguishable from one that does not exist.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "messageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Message"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/messages/{messageId}/retry": {
			"post": {
				"summary": "Retry a failed message",
				"tags": [
					"inbox"
				],
				"description": "Re-enqueues a conclusively failed outbound message, keeping its id. Provider-ambiguous delivery cannot be retried because the original may have been accepted. Content already removed by retention cannot be retried (409 MESSAGE_CONTENT_REDACTED).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "messageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Message"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/attachments": {
			"post": {
				"summary": "Upload an attachment",
				"tags": [
					"inbox"
				],
				"description": "multipart/form-data with a single `file` field (max 16 MiB). Returns an expiring, one-time upload id to include in a subsequent send.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"uploadId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"mime": {
											"type": "string"
										},
										"size": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"filename": {
											"type": "string"
										},
										"width": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"height": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"uploadId",
										"mime",
										"size",
										"filename"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/attachments": {
			"post": {
				"summary": "Stage an attachment before a thread exists",
				"tags": [
					"inbox"
				],
				"description": "Same multipart/form-data shape as the per-conversation upload, for a first message to a contact who has no thread yet. The expiring, one-time upload id is accepted by POST /conversations and by any send from the same user.",
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"uploadId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"mime": {
											"type": "string"
										},
										"size": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"filename": {
											"type": "string"
										},
										"width": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"height": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"uploadId",
										"mime",
										"size",
										"filename"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/messages/{messageId}/attachments/{index}": {
			"get": {
				"summary": "Download an attachment",
				"tags": [
					"inbox"
				],
				"description": "Streams the server-owned object after the org check. Active and unknown formats are forced to a safe download.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "messageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "index",
						"in": "path",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 0,
							"maximum": 19
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/inbox/counts": {
			"get": {
				"summary": "Inbox badge counts",
				"tags": [
					"inbox"
				],
				"description": "open/mine/unassigned/unread conversation counts plus a per-channel breakdown (closed excluded).",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/InboxCounts"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/ai/suggest": {
			"post": {
				"summary": "AI: suggest a reply",
				"tags": [
					"inbox"
				],
				"description": "Drafts a reply from the recent thread plus the linked patient's context. The draft is editable — nothing is sent. Rate limited per organization.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"instruction": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"suggestions": {
											"minItems": 1,
											"maxItems": 3,
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"suggestions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/ai/summarize": {
			"post": {
				"summary": "AI: summarize the conversation",
				"tags": [
					"inbox"
				],
				"description": "Short summary of the thread for handovers; can be saved as an internal note. Rate limited per organization.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"summary": {
											"type": "string"
										}
									},
									"required": [
										"summary"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/templates": {
			"get": {
				"summary": "List message templates",
				"tags": [
					"templates"
				],
				"description": "Archived templates are excluded unless includeArchived=true.",
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/MessageTemplate"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a message template",
				"tags": [
					"templates"
				],
				"description": "channel NULL makes a channel-agnostic snippet. A WhatsApp template is submitted to Meta for approval automatically; its approved template name is derived and written by SmileLine when Meta approves it.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"channel": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"whatsapp",
													"sms",
													"email",
													"webchat",
													"messenger",
													"instagram",
													"telegram",
													"tiktok",
													"facebook_comments",
													"instagram_comments"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"subject": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"body": {
										"type": "string",
										"minLength": 1
									},
									"language": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 16
											},
											{
												"type": "null"
											}
										]
									},
									"whatsappCategory": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"utility",
													"marketing",
													"authentication"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"doc": {
										"anyOf": [
											{},
											{
												"type": "null"
											}
										]
									},
									"bodyHtml": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1000000
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name",
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MessageTemplate"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/templates/{id}": {
			"get": {
				"summary": "Get a message template",
				"tags": [
					"templates"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MessageTemplate"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a message template",
				"tags": [
					"templates"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"channel": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"whatsapp",
													"sms",
													"email",
													"webchat",
													"messenger",
													"instagram",
													"telegram",
													"tiktok",
													"facebook_comments",
													"instagram_comments"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"subject": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"body": {
										"type": "string",
										"minLength": 1
									},
									"language": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 16
											},
											{
												"type": "null"
											}
										]
									},
									"whatsappCategory": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"utility",
													"marketing",
													"authentication"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"doc": {
										"anyOf": [
											{},
											{
												"type": "null"
											}
										]
									},
									"bodyHtml": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1000000
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"confirmed": {
										"type": "boolean"
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MessageTemplate"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/templates/{id}/whatsapp": {
			"get": {
				"summary": "Get a WhatsApp template's submissions",
				"tags": [
					"templates"
				],
				"description": "The organisation's template account and every version of this template submitted to it, newest first.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"account": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"wabaId": {
															"type": "string"
														},
														"address": {
															"anyOf": [
																{
																	"type": "string"
																},
																{
																	"type": "null"
																}
															]
														},
														"verifiedAt": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"lastError": {
															"anyOf": [
																{
																	"type": "string"
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"wabaId",
														"address",
														"verifiedAt",
														"lastError"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WhatsappTemplateRegistration"
											}
										}
									},
									"required": [
										"account",
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/templates/{id}/whatsapp/submit": {
			"post": {
				"summary": "Resubmit a WhatsApp template to Meta",
				"tags": [
					"templates"
				],
				"description": "Re-arms a rejected or parked version as a fresh draft for the next submission. A version Meta is still reviewing, or has approved, is left alone.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MessageTemplate"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/templates/{id}/archive": {
			"post": {
				"summary": "Archive a message template",
				"tags": [
					"templates"
				],
				"description": "Sets archivedAt. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MessageTemplate"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/templates/{id}/restore": {
			"post": {
				"summary": "Restore an archived message template",
				"tags": [
					"templates"
				],
				"description": "Clears archivedAt only. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MessageTemplate"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-voice": {
			"get": {
				"summary": "AI voice agent overview",
				"tags": [
					"AI Voice"
				],
				"description": "The org's agent (null until provisioned), assignment rules, resolved calling window and entitlement state.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"agent": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AiVoiceAgent"
												},
												{
													"type": "null"
												}
											]
										},
										"rules": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AiCallRule"
											}
										},
										"callingWindow": {
											"type": "object",
											"properties": {
												"days": {
													"type": "array",
													"items": {
														"type": "string",
														"enum": [
															"mon",
															"tue",
															"wed",
															"thu",
															"fri",
															"sat",
															"sun"
														]
													}
												},
												"start": {
													"type": "string"
												},
												"end": {
													"type": "string"
												}
											},
											"required": [
												"days",
												"start",
												"end"
											],
											"additionalProperties": false
										},
										"entitled": {
											"type": "boolean"
										},
										"ringGroups": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceRingGroup"
											}
										},
										"queue": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AiCallQueueRow"
											}
										},
										"voiceRuntime": {
											"type": "string",
											"enum": [
												"xai",
												"livekit",
												"openai-live"
											]
										}
									},
									"required": [
										"agent",
										"rules",
										"callingWindow",
										"entitled",
										"ringGroups",
										"queue",
										"voiceRuntime"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Provision the AI voice agent",
				"tags": [
					"AI Voice"
				],
				"description": "Idempotent singleton provision with default config. Requires the AI voice entitlement.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"agent": {
											"$ref": "#/components/schemas/AiVoiceAgent"
										}
									},
									"required": [
										"agent"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update the AI voice agent",
				"tags": [
					"AI Voice"
				],
				"description": "Turning the booking tool on requires an enabled booking page, a live location and a deposit-free online-bookable appointment type; otherwise 409 AI_BOOKING_PREREQUISITES lists what is missing.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"maxConcurrentCalls": {
										"type": "integer",
										"minimum": 1,
										"maximum": 30
									},
									"dailyMinutesBudget": {
										"type": "integer",
										"minimum": 10,
										"maximum": 1440
									},
									"textBackEnabled": {
										"type": "boolean"
									},
									"voicemailDropEnabled": {
										"type": "boolean"
									},
									"voicemailDropMessage": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"config": {
										"type": "object",
										"properties": {
											"identity": {
												"type": "object",
												"properties": {
													"displayName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 80
													},
													"voiceId": {
														"type": "string",
														"minLength": 1,
														"maxLength": 120
													},
													"language": {
														"type": "string",
														"enum": [
															"en",
															"it",
															"es"
														]
													}
												},
												"required": [
													"displayName",
													"voiceId",
													"language"
												]
											},
											"greeting": {
												"type": "object",
												"properties": {
													"inbound": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													},
													"inboundClosed": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 500
															},
															{
																"type": "null"
															}
														]
													},
													"outbound": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"inbound",
													"inboundClosed",
													"outbound"
												]
											},
											"persona": {
												"type": "object",
												"properties": {
													"instructions": {
														"type": "string",
														"maxLength": 4000
													},
													"inboundNotes": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2000
															},
															{
																"type": "null"
															}
														]
													},
													"outboundNotes": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2000
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"instructions",
													"inboundNotes",
													"outboundNotes"
												]
											},
											"tools": {
												"type": "object",
												"properties": {
													"booking": {
														"type": "boolean"
													},
													"leadCapture": {
														"type": "boolean"
													},
													"defaultTreatmentId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"transfer": {
														"type": "object",
														"properties": {
															"enabled": {
																"type": "boolean"
															},
															"ringGroupId": {
																"anyOf": [
																	{
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	},
																	{
																		"type": "null"
																	}
																]
															}
														},
														"required": [
															"enabled",
															"ringGroupId"
														]
													}
												},
												"required": [
													"booking",
													"leadCapture",
													"defaultTreatmentId",
													"transfer"
												]
											},
											"knowledge": {
												"type": "object",
												"properties": {
													"enabled": {
														"type": "boolean"
													}
												},
												"required": [
													"enabled"
												]
											},
											"guardrails": {
												"type": "object",
												"properties": {
													"maxCallMinutes": {
														"type": "integer",
														"minimum": 1,
														"maximum": 240
													}
												},
												"required": [
													"maxCallMinutes"
												]
											}
										},
										"required": [
											"identity",
											"greeting",
											"persona",
											"tools",
											"knowledge",
											"guardrails"
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"agent": {
											"$ref": "#/components/schemas/AiVoiceAgent"
										}
									},
									"required": [
										"agent"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-voice/rules": {
			"post": {
				"summary": "Create an AI assignment rule",
				"tags": [
					"AI Voice"
				],
				"description": "Journeys matching an enabled rule are marked AI-handled and queued for outbound calling. Bounded per org.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"enabled": {
										"type": "boolean"
									},
									"trigger": {
										"type": "string",
										"enum": [
											"journey_created",
											"stage_entered",
											"call_missed"
										]
									},
									"stageId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"conditions": {
										"$ref": "#/components/schemas/AiCallRuleConditions"
									},
									"scope": {
										"type": "string",
										"enum": [
											"always",
											"practice_closed"
										]
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"aiCallbackEnabled": {
										"type": "boolean"
									},
									"textBackBody": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name",
									"enabled",
									"trigger",
									"stageId",
									"conditions",
									"scope",
									"locationId",
									"aiCallbackEnabled",
									"textBackBody"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rule": {
											"$ref": "#/components/schemas/AiCallRule"
										}
									},
									"required": [
										"rule"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-voice/rules/{id}": {
			"patch": {
				"summary": "Update an AI assignment rule",
				"tags": [
					"AI Voice"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"enabled": {
										"type": "boolean"
									},
									"trigger": {
										"type": "string",
										"enum": [
											"journey_created",
											"stage_entered",
											"call_missed"
										]
									},
									"stageId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"conditions": {
										"$ref": "#/components/schemas/AiCallRuleConditions"
									},
									"scope": {
										"type": "string",
										"enum": [
											"always",
											"practice_closed"
										]
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"aiCallbackEnabled": {
										"type": "boolean"
									},
									"textBackBody": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rule": {
											"$ref": "#/components/schemas/AiCallRule"
										}
									},
									"required": [
										"rule"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-voice/rules/{id}/archive": {
			"post": {
				"summary": "Archive an AI assignment rule",
				"tags": [
					"AI Voice"
				],
				"description": "Archived rules stop matching new journeys; already-queued journeys keep their marker.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rule": {
											"$ref": "#/components/schemas/AiCallRule"
										}
									},
									"required": [
										"rule"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-voice/queue": {
			"get": {
				"summary": "AI outbound queue",
				"tags": [
					"AI Voice"
				],
				"description": "Journeys currently AI-handled with their attempt/pacing state, newest next-attempt first.",
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rows": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AiCallQueueRow"
											}
										}
									},
									"required": [
										"rows"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-voice/dnc-imports": {
			"post": {
				"summary": "Import a Do-Not-Call list for outbound AI screening",
				"tags": [
					"AI Voice"
				],
				"description": "US practices upload their downloaded National Do-Not-Call registry list (one number per line, or the first field of each CSV line). The raw upload is kept before it is parsed; lines that do not read as a number in the practice's country are counted and named in Review rather than dropped. Numbers on the list are never dialled by the AI.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"list": {
										"type": "string",
										"minLength": 1
									}
								},
								"required": [
									"list"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"imported": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"malformed": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"imported",
										"malformed"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-voice/test": {
			"post": {
				"summary": "Text-mode agent test bench",
				"tags": [
					"AI Voice"
				],
				"description": "Runs the composed persona + tools through the chat model in text mode. Live test calls ride the ordinary call path on stage.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"direction": {
										"type": "string",
										"enum": [
											"inbound",
											"outbound"
										]
									},
									"messages": {
										"minItems": 1,
										"maxItems": 30,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"role": {
													"type": "string",
													"enum": [
														"user",
														"assistant"
													]
												},
												"content": {
													"type": "string",
													"minLength": 1,
													"maxLength": 2000
												}
											},
											"required": [
												"role",
												"content"
											]
										}
									}
								},
								"required": [
									"direction",
									"messages"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"reply": {
											"type": "string"
										},
										"actions": {
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"reply",
										"actions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}/ai-handling": {
			"post": {
				"summary": "Hand a lead to the AI or take it back",
				"tags": [
					"AI Voice"
				],
				"description": "The per-lead toggle. Enabling clears a prior release and (re)queues the journey; the lifetime dial-attempt budget never resets. Optimistic concurrency via expectedVersion.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"expectedVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"enabled",
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"journeyId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"aiHandledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"aiReleasedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"journeyId",
										"version",
										"aiHandledAt",
										"aiReleasedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget": {
			"get": {
				"summary": "Get the chat widget and its knowledge base",
				"tags": [
					"chat-widget"
				],
				"description": "Returns the org's widget (null until provisioned) plus every knowledge-base source with ingestion status.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"widget": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ChatWidget"
												},
												{
													"type": "null"
												}
											]
										},
										"sources": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/KbSource"
											}
										}
									},
									"required": [
										"widget",
										"sources"
									],
									"additionalProperties": false
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Provision the chat widget",
				"tags": [
					"chat-widget"
				],
				"description": "Idempotently creates the org's webchat channel connection (whose routing token is the public embed key), a hidden capture hook for the scripted flow, and the widget row with default config.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChatWidget"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update widget config",
				"tags": [
					"chat-widget"
				],
				"description": "Config is replaced whole. Changes propagate to embedded widgets within ~a minute (the public config is edge-cached).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"config": {
										"$ref": "#/components/schemas/ChatWidgetConfig"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChatWidget"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget/kb/website": {
			"post": {
				"summary": "Add a website knowledge source",
				"tags": [
					"chat-widget"
				],
				"description": "Queues a same-host crawl from the start URL (up to 150 pages). Re-crawls run weekly and on demand.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"required": [
									"url"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/KbSource"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget/kb/document": {
			"post": {
				"summary": "Upload a document knowledge source",
				"tags": [
					"chat-widget"
				],
				"description": "multipart/form-data with a single `file` field (pdf, txt, md or html, max 10 MB). Extraction and embedding run asynchronously.",
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/KbSource"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget/kb/snippet": {
			"post": {
				"summary": "Add a text snippet knowledge source",
				"tags": [
					"chat-widget"
				],
				"description": "Free-text knowledge (opening hours, price list, policies) — the fastest way to teach the assistant.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"content": {
										"type": "string",
										"minLength": 1,
										"maxLength": 20000
									}
								},
								"required": [
									"title",
									"content"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/KbSource"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget/kb/{id}": {
			"patch": {
				"summary": "Update a snippet source",
				"tags": [
					"chat-widget"
				],
				"description": "Snippets only; re-embeds on save.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"content": {
										"type": "string",
										"minLength": 1,
										"maxLength": 20000
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/KbSource"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget/kb/{id}/recrawl": {
			"post": {
				"summary": "Re-ingest a knowledge source",
				"tags": [
					"chat-widget"
				],
				"description": "Websites re-crawl; documents and snippets re-extract and re-embed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/KbSource"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget/kb/{id}/archive": {
			"post": {
				"summary": "Archive a knowledge source",
				"tags": [
					"chat-widget"
				],
				"description": "Removes its chunks from retrieval immediately. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/KbSource"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/chat-widget/test": {
			"post": {
				"summary": "Test the AI assistant",
				"tags": [
					"chat-widget"
				],
				"description": "Runs the widget's AI answering pipeline (knowledge retrieval included) without persisting anything. Requires the AI assistant add-on.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"messages": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"role": {
													"type": "string",
													"enum": [
														"visitor",
														"assistant"
													]
												},
												"content": {
													"type": "string",
													"minLength": 1,
													"maxLength": 2000
												}
											},
											"required": [
												"role",
												"content"
											]
										}
									}
								},
								"required": [
									"messages"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"reply": {
											"type": "string"
										},
										"sources": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"title": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"url": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"title",
													"url"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"reply",
										"sources"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/widget/{key}/config": {
			"get": {
				"summary": "Widget bootstrap config",
				"tags": [
					"widget"
				],
				"description": "Public, CORS-open endpoint the embedded widget loads first: appearance, proactive messages, the precomputed first flow step and whether AI answers are enabled. Never contains PII. Unknown or disabled keys answer 404. Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WidgetConfig"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/widget/{key}/messages": {
			"get": {
				"summary": "Widget conversation history",
				"tags": [
					"widget"
				],
				"description": "The visitor's own webchat thread (never other channels), oldest first, plus the current flow position and the widget configuration — the embedded frame's single boot request. Empty until the visitor's first interaction.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "visitorId",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"pattern": "^[A-Za-z0-9_-]{22,64}$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conversationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"mode": {
											"type": "string",
											"enum": [
												"flow",
												"ai",
												"human"
											]
										},
										"prompt": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"quickReplies": {
															"type": "array",
															"items": {
																"type": "string"
															}
														},
														"expects": {
															"type": "string",
															"enum": [
																"option",
																"text",
																"none"
															]
														},
														"inputHint": {
															"type": "string",
															"enum": [
																"name",
																"phone",
																"email"
															]
														}
													},
													"required": [
														"quickReplies",
														"expects"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"messages": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WidgetMessage"
											}
										},
										"config": {
											"$ref": "#/components/schemas/WidgetConfig"
										}
									},
									"required": [
										"conversationId",
										"mode",
										"prompt",
										"messages",
										"config"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Send a visitor message",
				"tags": [
					"widget"
				],
				"description": "Free-text message from the visitor. While the scripted flow is active the text advances it; in AI mode the assistant replies asynchronously over the widget socket; in human mode the practice team replies from their inbox. clientMessageId makes retries idempotent.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"visitorId": {
										"type": "string",
										"pattern": "^[A-Za-z0-9_-]{22,64}$"
									},
									"clientMessageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"body": {
										"type": "string",
										"maxLength": 2000
									},
									"uploads": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"uploadId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"required": [
												"uploadId"
											]
										}
									},
									"pageUrl": {
										"type": "string",
										"maxLength": 2048
									}
								},
								"required": [
									"visitorId",
									"clientMessageId",
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WidgetTurn"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/widget/{key}/uploads": {
			"post": {
				"summary": "Stage a visitor attachment",
				"tags": [
					"widget"
				],
				"description": "multipart/form-data with a single `file` field (max 16 MiB). Returns a one-time upload id to pass to POST /widget/:key/messages. The stored content type is derived from the bytes, never from the browser's claim.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"uploadId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"mime": {
											"type": "string"
										},
										"size": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"filename": {
											"type": "string"
										}
									},
									"required": [
										"uploadId",
										"mime",
										"size",
										"filename"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/widget/{key}/messages/{messageId}/attachments/{index}": {
			"get": {
				"summary": "Download an attachment from the visitor's own thread",
				"tags": [
					"widget"
				],
				"description": "Streams one attachment's bytes. The message must belong to this visitor's webchat endpoint — no other channel and no other visitor. Images are served inline; every other type is forced to a download.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "messageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "index",
						"in": "path",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 0,
							"maximum": 19
						}
					},
					{
						"name": "visitorId",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"pattern": "^[A-Za-z0-9_-]{22,64}$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/widget/{key}/flow": {
			"post": {
				"summary": "Advance the scripted flow",
				"tags": [
					"widget"
				],
				"description": "Applies one visitor input (quick-reply tap or typed answer) to the guided qualifier. The visitor's answer and the bot's next prompts are persisted to the practice inbox; completing the contact step creates the lead.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"visitorId": {
										"type": "string",
										"pattern": "^[A-Za-z0-9_-]{22,64}$"
									},
									"clientMessageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"input": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "option"
													},
													"value": {
														"type": "string",
														"minLength": 1,
														"maxLength": 300
													}
												},
												"required": [
													"kind",
													"value"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "text"
													},
													"value": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2000
													}
												},
												"required": [
													"kind",
													"value"
												]
											}
										]
									},
									"pageUrl": {
										"type": "string",
										"maxLength": 2048
									}
								},
								"required": [
									"visitorId",
									"clientMessageId",
									"input"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WidgetTurn"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/widget/{key}/read": {
			"post": {
				"summary": "Mark messages read",
				"tags": [
					"widget"
				],
				"description": "Visitor read receipt up to a message id — the practice inbox shows read ticks.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"visitorId": {
										"type": "string",
										"pattern": "^[A-Za-z0-9_-]{22,64}$"
									},
									"upToMessageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"visitorId",
									"upToMessageId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/online-booking": {
			"get": {
				"summary": "Get the online booking page",
				"tags": [
					"booking"
				],
				"description": "Returns the org's booking page (provisioned on first read) — public token, enable switch and page config.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/BookingPage"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update the online booking page",
				"tags": [
					"booking"
				],
				"description": "Config is replaced whole. Changes propagate to embedded pages within ~a minute (the public config is edge-cached).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"config": {
										"$ref": "#/components/schemas/BookingPageConfig"
									},
									"defaultLeadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/BookingPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/online-booking/regenerate-token": {
			"post": {
				"summary": "Regenerate the public booking token",
				"tags": [
					"booking"
				],
				"description": "Invalidates the current hosted link and embed snippet immediately; update the practice website after rotating.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/BookingPage"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/schedules/{practitionerId}/{locationId}": {
			"get": {
				"summary": "Get a practitioner's rota",
				"tags": [
					"scheduling"
				],
				"description": "The weekly recurrence rules plus date overrides that feed online-booking availability. Empty until a rota is saved.",
				"parameters": [
					{
						"name": "practitionerId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "locationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PractitionerSchedule"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Replace a practitioner's rota",
				"tags": [
					"scheduling"
				],
				"description": "Whole-write: the submitted rules replace the existing rota in one transaction. A date override with start = end marks the practitioner off that day.",
				"parameters": [
					{
						"name": "practitionerId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "locationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"timezone": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									},
									"rules": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"default": "working",
													"type": "string",
													"enum": [
														"working",
														"break",
														"block"
													]
												},
												"label": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 200
														},
														{
															"type": "null"
														}
													]
												},
												"days": {
													"default": [],
													"maxItems": 7,
													"type": "array",
													"items": {
														"type": "integer",
														"minimum": 0,
														"maximum": 6
													}
												},
												"startTime": {
													"type": "string",
													"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
												},
												"endTime": {
													"type": "string",
													"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
												},
												"date": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"startTime",
												"endTime"
											]
										}
									}
								},
								"required": [
									"expectedVersion",
									"rules"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PractitionerSchedule"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/{key}/config": {
			"get": {
				"summary": "Booking page bootstrap config",
				"tags": [
					"booking"
				],
				"description": "Public, CORS-open endpoint the booking page loads first: practice identity, bookable locations, online-bookable appointment types (with deposit amounts) and practitioners. Never contains PII. Unknown or disabled keys answer 404. Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/BookingConfig"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/{key}/availability": {
			"get": {
				"summary": "Bookable slots",
				"tags": [
					"booking"
				],
				"description": "Discrete bookable start times for one appointment type at one location, grouped by practice-local day. Query at most 14 days within the next 14 weeks. Slots reflect practitioner rotas, opening hours, existing appointments and live holds (or the PMS diary for connected practices). In PMS mode, an any-practitioner query covers at most 10 linked practitioners; larger rosters must provide practitionerId. When live PMS availability cannot be read in full, this returns `503` with `PMS_AVAILABILITY_RETRY` rather than a partial list of slots — retry rather than presenting it as complete. Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "appointmentTypeId",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "practitionerId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
							"description": "First practice-local day in the slot window."
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
							"description": "Last practice-local day in the inclusive window; at most 14 days after from and within the next 14 weeks."
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"timezone": {
											"type": "string"
										},
										"days": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"date": {
														"type": "string",
														"format": "date",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
													},
													"slots": {
														"type": "array",
														"items": {
															"$ref": "#/components/schemas/BookingSlot"
														}
													}
												},
												"required": [
													"date",
													"slots"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"timezone",
										"days"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/{key}/hold": {
			"post": {
				"summary": "Hold a slot",
				"tags": [
					"booking"
				],
				"description": "Reserves the chosen slot as a pending appointment while the patient finishes booking — 30 minutes, or 60 when the appointment type takes a deposit (the response then carries a Stripe Checkout URL). Creates or matches the patient record and starts their journey, or reuses a matching active journey for a valid chat handoff. A taken slot answers 409 SLOT_TAKEN. An exact eventId retry returns the same hold; reusing that eventId with different booking details answers 409 IDEMPOTENCY_KEY_REUSED. 503 BOOKING_RETRY means the slot could not be reserved because of a momentary service disruption — the request was retained for the practice and the same request can be retried in a moment.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"eventId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentTypeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"practitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"startsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"patient": {
										"type": "object",
										"properties": {
											"firstName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											"lastName": {
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											"dateOfBirth": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											"email": {
												"type": "string",
												"maxLength": 320
											},
											"phoneMobile": {
												"type": "string",
												"minLength": 5,
												"maxLength": 32
											},
											"marketingConsent": {
												"type": "boolean"
											}
										},
										"required": [
											"firstName",
											"lastName"
										]
									},
									"note": {
										"type": "string",
										"maxLength": 1000
									},
									"pageUrl": {
										"type": "string",
										"maxLength": 2048
									},
									"referralToken": {
										"type": "string",
										"maxLength": 64
									},
									"chatHandoffToken": {
										"type": "string",
										"maxLength": 2048
									}
								},
								"required": [
									"eventId",
									"appointmentTypeId",
									"locationId",
									"practitionerId",
									"startsAt",
									"patient"
								],
								"description": "Patient must provide an email address or a mobile number."
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/BookingHold"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/{key}/complete": {
			"post": {
				"summary": "Convert a hold into a booking",
				"tags": [
					"booking"
				],
				"description": "Finalizes a no-deposit hold: the appointment becomes booked, or stays pending for practice confirmation when the type requires it. Deposit holds finalize via the payment webhook instead — this answers 402 DEPOSIT_UNPAID until then. An expired hold answers 410 HOLD_EXPIRED.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"uid": {
										"type": "string",
										"minLength": 8,
										"maxLength": 64
									}
								},
								"required": [
									"uid"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"booked",
												"pending"
											]
										}
									},
									"required": [
										"status"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"410": {
						"description": "Gone",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/{uid}": {
			"get": {
				"summary": "Booking status by manage link",
				"tags": [
					"booking"
				],
				"description": "Patient-safe view of one booking, addressed by the uid from the confirmation message. Also the polling target while a deposit payment settles. Rate limited; unknown uids answer 404.",
				"security": [],
				"parameters": [
					{
						"name": "uid",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 8,
							"maxLength": 64
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ManagedBooking"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/{uid}/cancel": {
			"post": {
				"summary": "Cancel a booking",
				"tags": [
					"booking"
				],
				"description": "Patient-initiated cancellation via the manage link, allowed until the appointment type's notice cutoff. Paid booking deposits follow the practice's refund policy.",
				"security": [],
				"parameters": [
					{
						"name": "uid",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 8,
							"maxLength": 64
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"maxLength": 500
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/{uid}/reschedule": {
			"post": {
				"summary": "Reschedule a booking",
				"tags": [
					"booking"
				],
				"description": "Cancels the old appointment and books the new slot in one step (the paid deposit carries over). Returns the NEW uid — previous manage links keep pointing at the cancelled appointment. A taken slot answers 409 SLOT_TAKEN.",
				"security": [],
				"parameters": [
					{
						"name": "uid",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 8,
							"maxLength": 64
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"startsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"practitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"startsAt"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"uid": {
											"type": "string"
										},
										"startsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"status": {
											"type": "string",
											"enum": [
												"booked",
												"pending"
											]
										}
									},
									"required": [
										"uid",
										"startsAt",
										"endsAt",
										"status"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"410": {
						"description": "Gone",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels": {
			"get": {
				"summary": "List channel connections",
				"tags": [
					"settings"
				],
				"description": "Archived connections are excluded unless includeArchived=true. Credentials are never exposed.",
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ChannelConnection"
											}
										},
										"domains": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/EmailSendingDomain"
											}
										}
									},
									"required": [
										"items",
										"domains"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Connect a channel",
				"tags": [
					"settings"
				],
				"description": "Creates a connection with a server-minted routing token. Credentials are encrypted at rest and write-only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"address": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"externalId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"externalMeta": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									},
									"credentials": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"type": "string"
										}
									},
									"channel": {
										"type": "string",
										"enum": [
											"whatsapp",
											"sms",
											"email",
											"webchat",
											"messenger",
											"instagram",
											"telegram",
											"tiktok",
											"facebook_comments",
											"instagram_comments"
										]
									},
									"provider": {
										"type": "string",
										"enum": [
											"whatsapp_cloud",
											"twilio",
											"telnyx",
											"resend",
											"webchat",
											"meta_messaging",
											"telegram",
											"tiktok_messaging",
											"meta_comments",
											"gmail",
											"outlook"
										]
									}
								},
								"required": [
									"name",
									"channel",
									"provider"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChannelConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/setup": {
			"get": {
				"summary": "Get guided channel setup availability",
				"tags": [
					"settings"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"whatsapp": {
											"type": "object",
											"properties": {
												"available": {
													"type": "boolean"
												},
												"appId": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"configId": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"available",
												"appId",
												"configId"
											],
											"additionalProperties": false
										},
										"sms": {
											"type": "object",
											"properties": {
												"available": {
													"type": "boolean"
												}
											},
											"required": [
												"available"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"whatsapp",
										"sms"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/setup": {
			"get": {
				"summary": "Get guided SMS setup and number readiness",
				"tags": [
					"Channel connections"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"available": {
											"type": "boolean"
										},
										"country": {
											"type": "string",
											"enum": [
												"GB",
												"US"
											]
										},
										"numbers": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"e164": {
														"type": "string"
													},
													"name": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"status": {
														"type": "string"
													},
													"purpose": {
														"type": "string"
													},
													"country": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"numberType": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"eligible": {
														"type": "boolean"
													},
													"reason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"registrationId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"connectionId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"ready": {
														"type": "boolean"
													},
													"setupStatus": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"setupMessage": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"e164",
													"name",
													"status",
													"purpose",
													"country",
													"numberType",
													"eligible",
													"reason",
													"registrationId",
													"connectionId",
													"ready",
													"setupStatus",
													"setupMessage"
												],
												"additionalProperties": false
											}
										},
										"registrations": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"kind": {
														"type": "string",
														"enum": [
															"gb_mobile",
															"us_10dlc",
															"us_tollfree"
														]
													},
													"status": {
														"type": "string",
														"enum": [
															"draft",
															"submitting",
															"pending",
															"action_required",
															"approved"
														]
													},
													"revision": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"phoneNumberId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"brandStatus": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"campaignStatus": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"feedback": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"ukReview": {
														"anyOf": [
															{
																"$ref": "#/components/schemas/DialerKycReview"
															},
															{
																"type": "null"
															}
														]
													},
													"details": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"business": {
																		"type": "object",
																		"properties": {
																			"entityType": {
																				"type": "string",
																				"enum": [
																					"PRIVATE_PROFIT",
																					"PUBLIC_PROFIT",
																					"NON_PROFIT",
																					"GOVERNMENT",
																					"SOLE_PROPRIETOR"
																				]
																			},
																			"legalName": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"displayName": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"registrationNumber": {
																				"type": "string",
																				"maxLength": 20
																			},
																			"registrationType": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"country": {
																				"type": "string",
																				"pattern": "^[A-Z]{2}$"
																			},
																			"street": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"city": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"state": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"postalCode": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 10
																			},
																			"firstName": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"lastName": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 100
																			},
																			"email": {
																				"type": "string",
																				"maxLength": 100
																			},
																			"phone": {
																				"type": "string",
																				"maxLength": 16
																			},
																			"mobilePhone": {
																				"type": "string",
																				"maxLength": 16
																			},
																			"website": {
																				"type": "string",
																				"maxLength": 100
																			},
																			"stockSymbol": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 10
																			},
																			"stockExchange": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 20
																			}
																		},
																		"additionalProperties": false
																	},
																	"campaign": {
																		"type": "object",
																		"properties": {
																			"usecase": {
																				"type": "string",
																				"enum": [
																					"CUSTOMER_CARE",
																					"ACCOUNT_NOTIFICATION",
																					"MIXED",
																					"SOLE_PROPRIETOR"
																				]
																			},
																			"subUsecases": {
																				"type": "array",
																				"items": {
																					"type": "string",
																					"enum": [
																						"CUSTOMER_CARE",
																						"ACCOUNT_NOTIFICATION",
																						"MARKETING"
																					]
																				}
																			},
																			"description": {
																				"type": "string",
																				"maxLength": 500
																			},
																			"consentFlow": {
																				"type": "string",
																				"maxLength": 500
																			},
																			"sample1": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 255
																			},
																			"sample2": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 255
																			},
																			"helpMessage": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 255
																			},
																			"optinMessage": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 500
																			},
																			"optoutMessage": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 500
																			},
																			"privacyPolicyUrl": {
																				"type": "string",
																				"maxLength": 500
																			},
																			"termsUrl": {
																				"type": "string",
																				"maxLength": 500
																			},
																			"embeddedLink": {
																				"type": "boolean"
																			},
																			"embeddedPhone": {
																				"type": "boolean"
																			},
																			"embeddedLinkSample": {
																				"type": "string",
																				"maxLength": 500
																			},
																			"monthlyVolume": {
																				"type": "string",
																				"enum": [
																					"10",
																					"100",
																					"1,000",
																					"10,000",
																					"100,000",
																					"250,000",
																					"500,000",
																					"750,000",
																					"1,000,000",
																					"5,000,000",
																					"10,000,000+"
																				]
																			},
																			"optinEvidenceUrls": {
																				"type": "array",
																				"items": {
																					"type": "string",
																					"maxLength": 500
																				}
																			}
																		},
																		"additionalProperties": false
																	},
																	"amendmentReason": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 1000
																	},
																	"ukFields": {
																		"default": [],
																		"type": "array",
																		"items": {
																			"type": "object",
																			"properties": {
																				"requirementId": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 128
																				},
																				"value": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 4000
																				}
																			},
																			"required": [
																				"requirementId",
																				"value"
																			],
																			"additionalProperties": false
																		}
																	}
																},
																"required": [
																	"business",
																	"ukFields"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"acceptedQuote": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"id": {
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	},
																	"registrationId": {
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	},
																	"purpose": {
																		"type": "string",
																		"enum": [
																			"registration",
																			"number"
																		]
																	},
																	"numberE164": {
																		"anyOf": [
																			{
																				"type": "string",
																				"minLength": 1,
																				"pattern": "^\\+[1-9][0-9]{7,14}$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"revision": {
																		"type": "integer",
																		"exclusiveMinimum": 0,
																		"maximum": 9007199254740991
																	},
																	"createdAt": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"lines": {
																		"type": "array",
																		"items": {
																			"type": "object",
																			"properties": {
																				"code": {
																					"type": "string",
																					"enum": [
																						"brand",
																						"campaign_review",
																						"campaign_subscription",
																						"number_rental"
																					]
																				},
																				"currency": {
																					"type": "string",
																					"enum": [
																						"USD",
																						"GBP"
																					]
																				},
																				"amountMinor": {
																					"type": "integer",
																					"minimum": 0,
																					"maximum": 9007199254740991
																				},
																				"interval": {
																					"type": "string",
																					"enum": [
																						"once",
																						"month"
																					]
																				},
																				"prepaidMonths": {
																					"type": "integer",
																					"minimum": 0,
																					"maximum": 9007199254740991
																				},
																				"nonrefundable": {
																					"type": "boolean"
																				}
																			},
																			"required": [
																				"code",
																				"currency",
																				"amountMinor",
																				"interval",
																				"prepaidMonths",
																				"nonrefundable"
																			],
																			"additionalProperties": false
																		}
																	},
																	"carrierSource": {
																		"type": "string",
																		"format": "uri"
																	},
																	"carrierPriceDate": {
																		"type": "string"
																	},
																	"repeatReview": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"id",
																	"registrationId",
																	"purpose",
																	"numberE164",
																	"revision",
																	"createdAt",
																	"lines",
																	"carrierSource",
																	"carrierPriceDate",
																	"repeatReview"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"canAmend": {
														"type": "boolean"
													},
													"campaignSubmitted": {
														"type": "boolean"
													},
													"campaignAutoRenewal": {
														"anyOf": [
															{
																"type": "boolean"
															},
															{
																"type": "null"
															}
														]
													},
													"campaignRenewalDate": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"kind",
													"status",
													"revision",
													"phoneNumberId",
													"brandStatus",
													"campaignStatus",
													"feedback",
													"ukReview",
													"details",
													"acceptedQuote",
													"canAmend",
													"campaignSubmitted",
													"campaignAutoRenewal",
													"campaignRenewalDate"
												],
												"additionalProperties": false
											}
										},
										"businessDefaults": {
											"type": "object",
											"properties": {
												"entityType": {
													"type": "string",
													"enum": [
														"PRIVATE_PROFIT",
														"PUBLIC_PROFIT",
														"NON_PROFIT",
														"GOVERNMENT",
														"SOLE_PROPRIETOR"
													]
												},
												"legalName": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"displayName": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"registrationNumber": {
													"default": "",
													"type": "string",
													"maxLength": 20
												},
												"registrationType": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"country": {
													"type": "string",
													"pattern": "^[A-Z]{2}$"
												},
												"street": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"city": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"state": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"postalCode": {
													"type": "string",
													"minLength": 1,
													"maxLength": 10
												},
												"firstName": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"lastName": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												},
												"email": {
													"type": "string",
													"maxLength": 100,
													"format": "email",
													"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
												},
												"phone": {
													"type": "string",
													"minLength": 1,
													"pattern": "^\\+[1-9][0-9]{7,14}$"
												},
												"mobilePhone": {
													"type": "string",
													"minLength": 1,
													"pattern": "^\\+[1-9][0-9]{7,14}$"
												},
												"website": {
													"type": "string",
													"maxLength": 100,
													"format": "uri"
												},
												"stockSymbol": {
													"type": "string",
													"minLength": 1,
													"maxLength": 10
												},
												"stockExchange": {
													"type": "string",
													"minLength": 1,
													"maxLength": 20
												}
											},
											"additionalProperties": false
										}
									},
									"required": [
										"available",
										"country",
										"numbers",
										"registrations",
										"businessDefaults"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations/{id}/stop-renewal": {
			"post": {
				"summary": "Stop renewing a US SMS campaign",
				"tags": [
					"Channel connections"
				],
				"description": "The campaign expires at the carrier's current period end. Existing charges remain due. Number rental is separate.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"confirm": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"confirm"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gb_mobile",
												"us_10dlc",
												"us_tollfree"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitting",
												"pending",
												"action_required",
												"approved"
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"phoneNumberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"brandStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"feedback": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ukReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"details": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"business": {
															"type": "object",
															"properties": {
																"entityType": {
																	"type": "string",
																	"enum": [
																		"PRIVATE_PROFIT",
																		"PUBLIC_PROFIT",
																		"NON_PROFIT",
																		"GOVERNMENT",
																		"SOLE_PROPRIETOR"
																	]
																},
																"legalName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"displayName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"registrationNumber": {
																	"type": "string",
																	"maxLength": 20
																},
																"registrationType": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"country": {
																	"type": "string",
																	"pattern": "^[A-Z]{2}$"
																},
																"street": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"city": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"state": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"postalCode": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"firstName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"lastName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"email": {
																	"type": "string",
																	"maxLength": 100
																},
																"phone": {
																	"type": "string",
																	"maxLength": 16
																},
																"mobilePhone": {
																	"type": "string",
																	"maxLength": 16
																},
																"website": {
																	"type": "string",
																	"maxLength": 100
																},
																"stockSymbol": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"stockExchange": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 20
																}
															},
															"additionalProperties": false
														},
														"campaign": {
															"type": "object",
															"properties": {
																"usecase": {
																	"type": "string",
																	"enum": [
																		"CUSTOMER_CARE",
																		"ACCOUNT_NOTIFICATION",
																		"MIXED",
																		"SOLE_PROPRIETOR"
																	]
																},
																"subUsecases": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"enum": [
																			"CUSTOMER_CARE",
																			"ACCOUNT_NOTIFICATION",
																			"MARKETING"
																		]
																	}
																},
																"description": {
																	"type": "string",
																	"maxLength": 500
																},
																"consentFlow": {
																	"type": "string",
																	"maxLength": 500
																},
																"sample1": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"sample2": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"helpMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"optinMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"optoutMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"privacyPolicyUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"termsUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"embeddedLink": {
																	"type": "boolean"
																},
																"embeddedPhone": {
																	"type": "boolean"
																},
																"embeddedLinkSample": {
																	"type": "string",
																	"maxLength": 500
																},
																"monthlyVolume": {
																	"type": "string",
																	"enum": [
																		"10",
																		"100",
																		"1,000",
																		"10,000",
																		"100,000",
																		"250,000",
																		"500,000",
																		"750,000",
																		"1,000,000",
																		"5,000,000",
																		"10,000,000+"
																	]
																},
																"optinEvidenceUrls": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"maxLength": 500
																	}
																}
															},
															"additionalProperties": false
														},
														"amendmentReason": {
															"type": "string",
															"minLength": 1,
															"maxLength": 1000
														},
														"ukFields": {
															"default": [],
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"requirementId": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 128
																	},
																	"value": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 4000
																	}
																},
																"required": [
																	"requirementId",
																	"value"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"business",
														"ukFields"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedQuote": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"registrationId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"purpose": {
															"type": "string",
															"enum": [
																"registration",
																"number"
															]
														},
														"numberE164": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"pattern": "^\\+[1-9][0-9]{7,14}$"
																},
																{
																	"type": "null"
																}
															]
														},
														"revision": {
															"type": "integer",
															"exclusiveMinimum": 0,
															"maximum": 9007199254740991
														},
														"createdAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"lines": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"code": {
																		"type": "string",
																		"enum": [
																			"brand",
																			"campaign_review",
																			"campaign_subscription",
																			"number_rental"
																		]
																	},
																	"currency": {
																		"type": "string",
																		"enum": [
																			"USD",
																			"GBP"
																		]
																	},
																	"amountMinor": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"interval": {
																		"type": "string",
																		"enum": [
																			"once",
																			"month"
																		]
																	},
																	"prepaidMonths": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"nonrefundable": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"code",
																	"currency",
																	"amountMinor",
																	"interval",
																	"prepaidMonths",
																	"nonrefundable"
																],
																"additionalProperties": false
															}
														},
														"carrierSource": {
															"type": "string",
															"format": "uri"
														},
														"carrierPriceDate": {
															"type": "string"
														},
														"repeatReview": {
															"type": "boolean"
														}
													},
													"required": [
														"id",
														"registrationId",
														"purpose",
														"numberE164",
														"revision",
														"createdAt",
														"lines",
														"carrierSource",
														"carrierPriceDate",
														"repeatReview"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"canAmend": {
											"type": "boolean"
										},
										"campaignSubmitted": {
											"type": "boolean"
										},
										"campaignAutoRenewal": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignRenewalDate": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"status",
										"revision",
										"phoneNumberId",
										"brandStatus",
										"campaignStatus",
										"feedback",
										"ukReview",
										"details",
										"acceptedQuote",
										"canAmend",
										"campaignSubmitted",
										"campaignAutoRenewal",
										"campaignRenewalDate"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/documents": {
			"post": {
				"summary": "Upload a document for SMS registration",
				"tags": [
					"Channel connections"
				],
				"description": "Upload one document up to 10 MiB. The returned document belongs to this practice and can be reused in its registration.",
				"requestBody": {
					"required": true,
					"content": {
						"multipart/form-data": {
							"schema": {
								"type": "object",
								"properties": {
									"file": {
										"type": "string",
										"format": "binary",
										"contentEncoding": "binary",
										"maxLength": 10485760
									}
								},
								"required": [
									"file"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"documentId": {
											"type": "string"
										}
									},
									"required": [
										"documentId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations": {
			"put": {
				"summary": "Save a practice's SMS registration details",
				"tags": [
					"Channel connections"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"gb_mobile",
											"us_10dlc",
											"us_tollfree"
										]
									},
									"targetNumberId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"phoneNumberId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"revision": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"details": {
										"type": "object",
										"properties": {
											"business": {
												"type": "object",
												"properties": {
													"entityType": {
														"type": "string",
														"enum": [
															"PRIVATE_PROFIT",
															"PUBLIC_PROFIT",
															"NON_PROFIT",
															"GOVERNMENT",
															"SOLE_PROPRIETOR"
														]
													},
													"legalName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"displayName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"registrationNumber": {
														"type": "string",
														"maxLength": 20
													},
													"registrationType": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"country": {
														"type": "string",
														"pattern": "^[A-Z]{2}$"
													},
													"street": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"city": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"state": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"postalCode": {
														"type": "string",
														"minLength": 1,
														"maxLength": 10
													},
													"firstName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"lastName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"email": {
														"type": "string",
														"maxLength": 100
													},
													"phone": {
														"type": "string",
														"maxLength": 16
													},
													"mobilePhone": {
														"type": "string",
														"maxLength": 16
													},
													"website": {
														"type": "string",
														"maxLength": 100
													},
													"stockSymbol": {
														"type": "string",
														"minLength": 1,
														"maxLength": 10
													},
													"stockExchange": {
														"type": "string",
														"minLength": 1,
														"maxLength": 20
													}
												}
											},
											"campaign": {
												"type": "object",
												"properties": {
													"usecase": {
														"type": "string",
														"enum": [
															"CUSTOMER_CARE",
															"ACCOUNT_NOTIFICATION",
															"MIXED",
															"SOLE_PROPRIETOR"
														]
													},
													"subUsecases": {
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"CUSTOMER_CARE",
																"ACCOUNT_NOTIFICATION",
																"MARKETING"
															]
														}
													},
													"description": {
														"type": "string",
														"maxLength": 500
													},
													"consentFlow": {
														"type": "string",
														"maxLength": 500
													},
													"sample1": {
														"type": "string",
														"minLength": 1,
														"maxLength": 255
													},
													"sample2": {
														"type": "string",
														"minLength": 1,
														"maxLength": 255
													},
													"helpMessage": {
														"type": "string",
														"minLength": 1,
														"maxLength": 255
													},
													"optinMessage": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													},
													"optoutMessage": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													},
													"privacyPolicyUrl": {
														"type": "string",
														"maxLength": 500
													},
													"termsUrl": {
														"type": "string",
														"maxLength": 500
													},
													"embeddedLink": {
														"type": "boolean"
													},
													"embeddedPhone": {
														"type": "boolean"
													},
													"embeddedLinkSample": {
														"type": "string",
														"maxLength": 500
													},
													"monthlyVolume": {
														"type": "string",
														"enum": [
															"10",
															"100",
															"1,000",
															"10,000",
															"100,000",
															"250,000",
															"500,000",
															"750,000",
															"1,000,000",
															"5,000,000",
															"10,000,000+"
														]
													},
													"optinEvidenceUrls": {
														"type": "array",
														"items": {
															"type": "string",
															"maxLength": 500
														}
													}
												}
											},
											"amendmentReason": {
												"type": "string",
												"minLength": 1,
												"maxLength": 1000
											},
											"ukFields": {
												"default": [],
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"requirementId": {
															"type": "string",
															"minLength": 1,
															"maxLength": 128
														},
														"value": {
															"type": "string",
															"minLength": 1,
															"maxLength": 4000
														}
													},
													"required": [
														"requirementId",
														"value"
													]
												}
											}
										},
										"required": [
											"business"
										]
									}
								},
								"required": [
									"kind",
									"revision",
									"details"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gb_mobile",
												"us_10dlc",
												"us_tollfree"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitting",
												"pending",
												"action_required",
												"approved"
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"phoneNumberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"brandStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"feedback": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ukReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"details": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"business": {
															"type": "object",
															"properties": {
																"entityType": {
																	"type": "string",
																	"enum": [
																		"PRIVATE_PROFIT",
																		"PUBLIC_PROFIT",
																		"NON_PROFIT",
																		"GOVERNMENT",
																		"SOLE_PROPRIETOR"
																	]
																},
																"legalName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"displayName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"registrationNumber": {
																	"type": "string",
																	"maxLength": 20
																},
																"registrationType": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"country": {
																	"type": "string",
																	"pattern": "^[A-Z]{2}$"
																},
																"street": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"city": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"state": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"postalCode": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"firstName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"lastName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"email": {
																	"type": "string",
																	"maxLength": 100
																},
																"phone": {
																	"type": "string",
																	"maxLength": 16
																},
																"mobilePhone": {
																	"type": "string",
																	"maxLength": 16
																},
																"website": {
																	"type": "string",
																	"maxLength": 100
																},
																"stockSymbol": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"stockExchange": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 20
																}
															},
															"additionalProperties": false
														},
														"campaign": {
															"type": "object",
															"properties": {
																"usecase": {
																	"type": "string",
																	"enum": [
																		"CUSTOMER_CARE",
																		"ACCOUNT_NOTIFICATION",
																		"MIXED",
																		"SOLE_PROPRIETOR"
																	]
																},
																"subUsecases": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"enum": [
																			"CUSTOMER_CARE",
																			"ACCOUNT_NOTIFICATION",
																			"MARKETING"
																		]
																	}
																},
																"description": {
																	"type": "string",
																	"maxLength": 500
																},
																"consentFlow": {
																	"type": "string",
																	"maxLength": 500
																},
																"sample1": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"sample2": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"helpMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"optinMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"optoutMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"privacyPolicyUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"termsUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"embeddedLink": {
																	"type": "boolean"
																},
																"embeddedPhone": {
																	"type": "boolean"
																},
																"embeddedLinkSample": {
																	"type": "string",
																	"maxLength": 500
																},
																"monthlyVolume": {
																	"type": "string",
																	"enum": [
																		"10",
																		"100",
																		"1,000",
																		"10,000",
																		"100,000",
																		"250,000",
																		"500,000",
																		"750,000",
																		"1,000,000",
																		"5,000,000",
																		"10,000,000+"
																	]
																},
																"optinEvidenceUrls": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"maxLength": 500
																	}
																}
															},
															"additionalProperties": false
														},
														"amendmentReason": {
															"type": "string",
															"minLength": 1,
															"maxLength": 1000
														},
														"ukFields": {
															"default": [],
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"requirementId": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 128
																	},
																	"value": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 4000
																	}
																},
																"required": [
																	"requirementId",
																	"value"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"business",
														"ukFields"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedQuote": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"registrationId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"purpose": {
															"type": "string",
															"enum": [
																"registration",
																"number"
															]
														},
														"numberE164": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"pattern": "^\\+[1-9][0-9]{7,14}$"
																},
																{
																	"type": "null"
																}
															]
														},
														"revision": {
															"type": "integer",
															"exclusiveMinimum": 0,
															"maximum": 9007199254740991
														},
														"createdAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"lines": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"code": {
																		"type": "string",
																		"enum": [
																			"brand",
																			"campaign_review",
																			"campaign_subscription",
																			"number_rental"
																		]
																	},
																	"currency": {
																		"type": "string",
																		"enum": [
																			"USD",
																			"GBP"
																		]
																	},
																	"amountMinor": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"interval": {
																		"type": "string",
																		"enum": [
																			"once",
																			"month"
																		]
																	},
																	"prepaidMonths": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"nonrefundable": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"code",
																	"currency",
																	"amountMinor",
																	"interval",
																	"prepaidMonths",
																	"nonrefundable"
																],
																"additionalProperties": false
															}
														},
														"carrierSource": {
															"type": "string",
															"format": "uri"
														},
														"carrierPriceDate": {
															"type": "string"
														},
														"repeatReview": {
															"type": "boolean"
														}
													},
													"required": [
														"id",
														"registrationId",
														"purpose",
														"numberE164",
														"revision",
														"createdAt",
														"lines",
														"carrierSource",
														"carrierPriceDate",
														"repeatReview"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"canAmend": {
											"type": "boolean"
										},
										"campaignSubmitted": {
											"type": "boolean"
										},
										"campaignAutoRenewal": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignRenewalDate": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"status",
										"revision",
										"phoneNumberId",
										"brandStatus",
										"campaignStatus",
										"feedback",
										"ukReview",
										"details",
										"acceptedQuote",
										"canAmend",
										"campaignSubmitted",
										"campaignAutoRenewal",
										"campaignRenewalDate"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations/{id}/quote": {
			"post": {
				"summary": "Review SMS registration charges before submitting",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"registrationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"purpose": {
											"type": "string",
											"enum": [
												"registration",
												"number"
											]
										},
										"numberE164": {
											"anyOf": [
												{
													"type": "string",
													"minLength": 1,
													"pattern": "^\\+[1-9][0-9]{7,14}$"
												},
												{
													"type": "null"
												}
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lines": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"code": {
														"type": "string",
														"enum": [
															"brand",
															"campaign_review",
															"campaign_subscription",
															"number_rental"
														]
													},
													"currency": {
														"type": "string",
														"enum": [
															"USD",
															"GBP"
														]
													},
													"amountMinor": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"interval": {
														"type": "string",
														"enum": [
															"once",
															"month"
														]
													},
													"prepaidMonths": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"nonrefundable": {
														"type": "boolean"
													}
												},
												"required": [
													"code",
													"currency",
													"amountMinor",
													"interval",
													"prepaidMonths",
													"nonrefundable"
												],
												"additionalProperties": false
											}
										},
										"carrierSource": {
											"type": "string",
											"format": "uri"
										},
										"carrierPriceDate": {
											"type": "string"
										},
										"repeatReview": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"registrationId",
										"purpose",
										"numberE164",
										"revision",
										"createdAt",
										"lines",
										"carrierSource",
										"carrierPriceDate",
										"repeatReview"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations/{id}/submit": {
			"post": {
				"summary": "Accept a saved quote and submit SMS registration",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"quoteId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"confirmed": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"quoteId",
									"confirmed"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gb_mobile",
												"us_10dlc",
												"us_tollfree"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitting",
												"pending",
												"action_required",
												"approved"
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"phoneNumberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"brandStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"feedback": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ukReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"details": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"business": {
															"type": "object",
															"properties": {
																"entityType": {
																	"type": "string",
																	"enum": [
																		"PRIVATE_PROFIT",
																		"PUBLIC_PROFIT",
																		"NON_PROFIT",
																		"GOVERNMENT",
																		"SOLE_PROPRIETOR"
																	]
																},
																"legalName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"displayName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"registrationNumber": {
																	"type": "string",
																	"maxLength": 20
																},
																"registrationType": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"country": {
																	"type": "string",
																	"pattern": "^[A-Z]{2}$"
																},
																"street": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"city": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"state": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"postalCode": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"firstName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"lastName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"email": {
																	"type": "string",
																	"maxLength": 100
																},
																"phone": {
																	"type": "string",
																	"maxLength": 16
																},
																"mobilePhone": {
																	"type": "string",
																	"maxLength": 16
																},
																"website": {
																	"type": "string",
																	"maxLength": 100
																},
																"stockSymbol": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"stockExchange": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 20
																}
															},
															"additionalProperties": false
														},
														"campaign": {
															"type": "object",
															"properties": {
																"usecase": {
																	"type": "string",
																	"enum": [
																		"CUSTOMER_CARE",
																		"ACCOUNT_NOTIFICATION",
																		"MIXED",
																		"SOLE_PROPRIETOR"
																	]
																},
																"subUsecases": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"enum": [
																			"CUSTOMER_CARE",
																			"ACCOUNT_NOTIFICATION",
																			"MARKETING"
																		]
																	}
																},
																"description": {
																	"type": "string",
																	"maxLength": 500
																},
																"consentFlow": {
																	"type": "string",
																	"maxLength": 500
																},
																"sample1": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"sample2": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"helpMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"optinMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"optoutMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"privacyPolicyUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"termsUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"embeddedLink": {
																	"type": "boolean"
																},
																"embeddedPhone": {
																	"type": "boolean"
																},
																"embeddedLinkSample": {
																	"type": "string",
																	"maxLength": 500
																},
																"monthlyVolume": {
																	"type": "string",
																	"enum": [
																		"10",
																		"100",
																		"1,000",
																		"10,000",
																		"100,000",
																		"250,000",
																		"500,000",
																		"750,000",
																		"1,000,000",
																		"5,000,000",
																		"10,000,000+"
																	]
																},
																"optinEvidenceUrls": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"maxLength": 500
																	}
																}
															},
															"additionalProperties": false
														},
														"amendmentReason": {
															"type": "string",
															"minLength": 1,
															"maxLength": 1000
														},
														"ukFields": {
															"default": [],
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"requirementId": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 128
																	},
																	"value": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 4000
																	}
																},
																"required": [
																	"requirementId",
																	"value"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"business",
														"ukFields"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedQuote": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"registrationId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"purpose": {
															"type": "string",
															"enum": [
																"registration",
																"number"
															]
														},
														"numberE164": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"pattern": "^\\+[1-9][0-9]{7,14}$"
																},
																{
																	"type": "null"
																}
															]
														},
														"revision": {
															"type": "integer",
															"exclusiveMinimum": 0,
															"maximum": 9007199254740991
														},
														"createdAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"lines": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"code": {
																		"type": "string",
																		"enum": [
																			"brand",
																			"campaign_review",
																			"campaign_subscription",
																			"number_rental"
																		]
																	},
																	"currency": {
																		"type": "string",
																		"enum": [
																			"USD",
																			"GBP"
																		]
																	},
																	"amountMinor": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"interval": {
																		"type": "string",
																		"enum": [
																			"once",
																			"month"
																		]
																	},
																	"prepaidMonths": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"nonrefundable": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"code",
																	"currency",
																	"amountMinor",
																	"interval",
																	"prepaidMonths",
																	"nonrefundable"
																],
																"additionalProperties": false
															}
														},
														"carrierSource": {
															"type": "string",
															"format": "uri"
														},
														"carrierPriceDate": {
															"type": "string"
														},
														"repeatReview": {
															"type": "boolean"
														}
													},
													"required": [
														"id",
														"registrationId",
														"purpose",
														"numberE164",
														"revision",
														"createdAt",
														"lines",
														"carrierSource",
														"carrierPriceDate",
														"repeatReview"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"canAmend": {
											"type": "boolean"
										},
										"campaignSubmitted": {
											"type": "boolean"
										},
										"campaignAutoRenewal": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignRenewalDate": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"status",
										"revision",
										"phoneNumberId",
										"brandStatus",
										"campaignStatus",
										"feedback",
										"ukReview",
										"details",
										"acceptedQuote",
										"canAmend",
										"campaignSubmitted",
										"campaignAutoRenewal",
										"campaignRenewalDate"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations/{id}/refresh": {
			"post": {
				"summary": "Refresh SMS carrier review or resume interrupted setup",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gb_mobile",
												"us_10dlc",
												"us_tollfree"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitting",
												"pending",
												"action_required",
												"approved"
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"phoneNumberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"brandStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"feedback": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ukReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"details": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"business": {
															"type": "object",
															"properties": {
																"entityType": {
																	"type": "string",
																	"enum": [
																		"PRIVATE_PROFIT",
																		"PUBLIC_PROFIT",
																		"NON_PROFIT",
																		"GOVERNMENT",
																		"SOLE_PROPRIETOR"
																	]
																},
																"legalName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"displayName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"registrationNumber": {
																	"type": "string",
																	"maxLength": 20
																},
																"registrationType": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"country": {
																	"type": "string",
																	"pattern": "^[A-Z]{2}$"
																},
																"street": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"city": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"state": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"postalCode": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"firstName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"lastName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"email": {
																	"type": "string",
																	"maxLength": 100
																},
																"phone": {
																	"type": "string",
																	"maxLength": 16
																},
																"mobilePhone": {
																	"type": "string",
																	"maxLength": 16
																},
																"website": {
																	"type": "string",
																	"maxLength": 100
																},
																"stockSymbol": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"stockExchange": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 20
																}
															},
															"additionalProperties": false
														},
														"campaign": {
															"type": "object",
															"properties": {
																"usecase": {
																	"type": "string",
																	"enum": [
																		"CUSTOMER_CARE",
																		"ACCOUNT_NOTIFICATION",
																		"MIXED",
																		"SOLE_PROPRIETOR"
																	]
																},
																"subUsecases": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"enum": [
																			"CUSTOMER_CARE",
																			"ACCOUNT_NOTIFICATION",
																			"MARKETING"
																		]
																	}
																},
																"description": {
																	"type": "string",
																	"maxLength": 500
																},
																"consentFlow": {
																	"type": "string",
																	"maxLength": 500
																},
																"sample1": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"sample2": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"helpMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"optinMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"optoutMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"privacyPolicyUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"termsUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"embeddedLink": {
																	"type": "boolean"
																},
																"embeddedPhone": {
																	"type": "boolean"
																},
																"embeddedLinkSample": {
																	"type": "string",
																	"maxLength": 500
																},
																"monthlyVolume": {
																	"type": "string",
																	"enum": [
																		"10",
																		"100",
																		"1,000",
																		"10,000",
																		"100,000",
																		"250,000",
																		"500,000",
																		"750,000",
																		"1,000,000",
																		"5,000,000",
																		"10,000,000+"
																	]
																},
																"optinEvidenceUrls": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"maxLength": 500
																	}
																}
															},
															"additionalProperties": false
														},
														"amendmentReason": {
															"type": "string",
															"minLength": 1,
															"maxLength": 1000
														},
														"ukFields": {
															"default": [],
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"requirementId": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 128
																	},
																	"value": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 4000
																	}
																},
																"required": [
																	"requirementId",
																	"value"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"business",
														"ukFields"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedQuote": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"registrationId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"purpose": {
															"type": "string",
															"enum": [
																"registration",
																"number"
															]
														},
														"numberE164": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"pattern": "^\\+[1-9][0-9]{7,14}$"
																},
																{
																	"type": "null"
																}
															]
														},
														"revision": {
															"type": "integer",
															"exclusiveMinimum": 0,
															"maximum": 9007199254740991
														},
														"createdAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"lines": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"code": {
																		"type": "string",
																		"enum": [
																			"brand",
																			"campaign_review",
																			"campaign_subscription",
																			"number_rental"
																		]
																	},
																	"currency": {
																		"type": "string",
																		"enum": [
																			"USD",
																			"GBP"
																		]
																	},
																	"amountMinor": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"interval": {
																		"type": "string",
																		"enum": [
																			"once",
																			"month"
																		]
																	},
																	"prepaidMonths": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"nonrefundable": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"code",
																	"currency",
																	"amountMinor",
																	"interval",
																	"prepaidMonths",
																	"nonrefundable"
																],
																"additionalProperties": false
															}
														},
														"carrierSource": {
															"type": "string",
															"format": "uri"
														},
														"carrierPriceDate": {
															"type": "string"
														},
														"repeatReview": {
															"type": "boolean"
														}
													},
													"required": [
														"id",
														"registrationId",
														"purpose",
														"numberE164",
														"revision",
														"createdAt",
														"lines",
														"carrierSource",
														"carrierPriceDate",
														"repeatReview"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"canAmend": {
											"type": "boolean"
										},
										"campaignSubmitted": {
											"type": "boolean"
										},
										"campaignAutoRenewal": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignRenewalDate": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"status",
										"revision",
										"phoneNumberId",
										"brandStatus",
										"campaignStatus",
										"feedback",
										"ukReview",
										"details",
										"acceptedQuote",
										"canAmend",
										"campaignSubmitted",
										"campaignAutoRenewal",
										"campaignRenewalDate"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations/{id}/otp": {
			"post": {
				"summary": "Verify the mobile owner for a US sole proprietor brand",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"code": {
										"type": "string",
										"pattern": "^[0-9]{6}$"
									}
								},
								"required": [
									"code"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gb_mobile",
												"us_10dlc",
												"us_tollfree"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitting",
												"pending",
												"action_required",
												"approved"
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"phoneNumberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"brandStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"feedback": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ukReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"details": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"business": {
															"type": "object",
															"properties": {
																"entityType": {
																	"type": "string",
																	"enum": [
																		"PRIVATE_PROFIT",
																		"PUBLIC_PROFIT",
																		"NON_PROFIT",
																		"GOVERNMENT",
																		"SOLE_PROPRIETOR"
																	]
																},
																"legalName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"displayName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"registrationNumber": {
																	"type": "string",
																	"maxLength": 20
																},
																"registrationType": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"country": {
																	"type": "string",
																	"pattern": "^[A-Z]{2}$"
																},
																"street": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"city": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"state": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"postalCode": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"firstName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"lastName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"email": {
																	"type": "string",
																	"maxLength": 100
																},
																"phone": {
																	"type": "string",
																	"maxLength": 16
																},
																"mobilePhone": {
																	"type": "string",
																	"maxLength": 16
																},
																"website": {
																	"type": "string",
																	"maxLength": 100
																},
																"stockSymbol": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"stockExchange": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 20
																}
															},
															"additionalProperties": false
														},
														"campaign": {
															"type": "object",
															"properties": {
																"usecase": {
																	"type": "string",
																	"enum": [
																		"CUSTOMER_CARE",
																		"ACCOUNT_NOTIFICATION",
																		"MIXED",
																		"SOLE_PROPRIETOR"
																	]
																},
																"subUsecases": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"enum": [
																			"CUSTOMER_CARE",
																			"ACCOUNT_NOTIFICATION",
																			"MARKETING"
																		]
																	}
																},
																"description": {
																	"type": "string",
																	"maxLength": 500
																},
																"consentFlow": {
																	"type": "string",
																	"maxLength": 500
																},
																"sample1": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"sample2": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"helpMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"optinMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"optoutMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"privacyPolicyUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"termsUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"embeddedLink": {
																	"type": "boolean"
																},
																"embeddedPhone": {
																	"type": "boolean"
																},
																"embeddedLinkSample": {
																	"type": "string",
																	"maxLength": 500
																},
																"monthlyVolume": {
																	"type": "string",
																	"enum": [
																		"10",
																		"100",
																		"1,000",
																		"10,000",
																		"100,000",
																		"250,000",
																		"500,000",
																		"750,000",
																		"1,000,000",
																		"5,000,000",
																		"10,000,000+"
																	]
																},
																"optinEvidenceUrls": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"maxLength": 500
																	}
																}
															},
															"additionalProperties": false
														},
														"amendmentReason": {
															"type": "string",
															"minLength": 1,
															"maxLength": 1000
														},
														"ukFields": {
															"default": [],
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"requirementId": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 128
																	},
																	"value": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 4000
																	}
																},
																"required": [
																	"requirementId",
																	"value"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"business",
														"ukFields"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedQuote": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"registrationId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"purpose": {
															"type": "string",
															"enum": [
																"registration",
																"number"
															]
														},
														"numberE164": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"pattern": "^\\+[1-9][0-9]{7,14}$"
																},
																{
																	"type": "null"
																}
															]
														},
														"revision": {
															"type": "integer",
															"exclusiveMinimum": 0,
															"maximum": 9007199254740991
														},
														"createdAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"lines": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"code": {
																		"type": "string",
																		"enum": [
																			"brand",
																			"campaign_review",
																			"campaign_subscription",
																			"number_rental"
																		]
																	},
																	"currency": {
																		"type": "string",
																		"enum": [
																			"USD",
																			"GBP"
																		]
																	},
																	"amountMinor": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"interval": {
																		"type": "string",
																		"enum": [
																			"once",
																			"month"
																		]
																	},
																	"prepaidMonths": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"nonrefundable": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"code",
																	"currency",
																	"amountMinor",
																	"interval",
																	"prepaidMonths",
																	"nonrefundable"
																],
																"additionalProperties": false
															}
														},
														"carrierSource": {
															"type": "string",
															"format": "uri"
														},
														"carrierPriceDate": {
															"type": "string"
														},
														"repeatReview": {
															"type": "boolean"
														}
													},
													"required": [
														"id",
														"registrationId",
														"purpose",
														"numberE164",
														"revision",
														"createdAt",
														"lines",
														"carrierSource",
														"carrierPriceDate",
														"repeatReview"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"canAmend": {
											"type": "boolean"
										},
										"campaignSubmitted": {
											"type": "boolean"
										},
										"campaignAutoRenewal": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignRenewalDate": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"status",
										"revision",
										"phoneNumberId",
										"brandStatus",
										"campaignStatus",
										"feedback",
										"ukReview",
										"details",
										"acceptedQuote",
										"canAmend",
										"campaignSubmitted",
										"campaignAutoRenewal",
										"campaignRenewalDate"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations/{id}/otp/resend": {
			"post": {
				"summary": "Request another registration code for a sole proprietor",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"requestKey": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"requestKey"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gb_mobile",
												"us_10dlc",
												"us_tollfree"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitting",
												"pending",
												"action_required",
												"approved"
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"phoneNumberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"brandStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"feedback": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ukReview": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/DialerKycReview"
												},
												{
													"type": "null"
												}
											]
										},
										"details": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"business": {
															"type": "object",
															"properties": {
																"entityType": {
																	"type": "string",
																	"enum": [
																		"PRIVATE_PROFIT",
																		"PUBLIC_PROFIT",
																		"NON_PROFIT",
																		"GOVERNMENT",
																		"SOLE_PROPRIETOR"
																	]
																},
																"legalName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"displayName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"registrationNumber": {
																	"type": "string",
																	"maxLength": 20
																},
																"registrationType": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"country": {
																	"type": "string",
																	"pattern": "^[A-Z]{2}$"
																},
																"street": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"city": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"state": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"postalCode": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"firstName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"lastName": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 100
																},
																"email": {
																	"type": "string",
																	"maxLength": 100
																},
																"phone": {
																	"type": "string",
																	"maxLength": 16
																},
																"mobilePhone": {
																	"type": "string",
																	"maxLength": 16
																},
																"website": {
																	"type": "string",
																	"maxLength": 100
																},
																"stockSymbol": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 10
																},
																"stockExchange": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 20
																}
															},
															"additionalProperties": false
														},
														"campaign": {
															"type": "object",
															"properties": {
																"usecase": {
																	"type": "string",
																	"enum": [
																		"CUSTOMER_CARE",
																		"ACCOUNT_NOTIFICATION",
																		"MIXED",
																		"SOLE_PROPRIETOR"
																	]
																},
																"subUsecases": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"enum": [
																			"CUSTOMER_CARE",
																			"ACCOUNT_NOTIFICATION",
																			"MARKETING"
																		]
																	}
																},
																"description": {
																	"type": "string",
																	"maxLength": 500
																},
																"consentFlow": {
																	"type": "string",
																	"maxLength": 500
																},
																"sample1": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"sample2": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"helpMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 255
																},
																"optinMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"optoutMessage": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																},
																"privacyPolicyUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"termsUrl": {
																	"type": "string",
																	"maxLength": 500
																},
																"embeddedLink": {
																	"type": "boolean"
																},
																"embeddedPhone": {
																	"type": "boolean"
																},
																"embeddedLinkSample": {
																	"type": "string",
																	"maxLength": 500
																},
																"monthlyVolume": {
																	"type": "string",
																	"enum": [
																		"10",
																		"100",
																		"1,000",
																		"10,000",
																		"100,000",
																		"250,000",
																		"500,000",
																		"750,000",
																		"1,000,000",
																		"5,000,000",
																		"10,000,000+"
																	]
																},
																"optinEvidenceUrls": {
																	"type": "array",
																	"items": {
																		"type": "string",
																		"maxLength": 500
																	}
																}
															},
															"additionalProperties": false
														},
														"amendmentReason": {
															"type": "string",
															"minLength": 1,
															"maxLength": 1000
														},
														"ukFields": {
															"default": [],
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"requirementId": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 128
																	},
																	"value": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 4000
																	}
																},
																"required": [
																	"requirementId",
																	"value"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"business",
														"ukFields"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedQuote": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"registrationId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"purpose": {
															"type": "string",
															"enum": [
																"registration",
																"number"
															]
														},
														"numberE164": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"pattern": "^\\+[1-9][0-9]{7,14}$"
																},
																{
																	"type": "null"
																}
															]
														},
														"revision": {
															"type": "integer",
															"exclusiveMinimum": 0,
															"maximum": 9007199254740991
														},
														"createdAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"lines": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"code": {
																		"type": "string",
																		"enum": [
																			"brand",
																			"campaign_review",
																			"campaign_subscription",
																			"number_rental"
																		]
																	},
																	"currency": {
																		"type": "string",
																		"enum": [
																			"USD",
																			"GBP"
																		]
																	},
																	"amountMinor": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"interval": {
																		"type": "string",
																		"enum": [
																			"once",
																			"month"
																		]
																	},
																	"prepaidMonths": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"nonrefundable": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"code",
																	"currency",
																	"amountMinor",
																	"interval",
																	"prepaidMonths",
																	"nonrefundable"
																],
																"additionalProperties": false
															}
														},
														"carrierSource": {
															"type": "string",
															"format": "uri"
														},
														"carrierPriceDate": {
															"type": "string"
														},
														"repeatReview": {
															"type": "boolean"
														}
													},
													"required": [
														"id",
														"registrationId",
														"purpose",
														"numberE164",
														"revision",
														"createdAt",
														"lines",
														"carrierSource",
														"carrierPriceDate",
														"repeatReview"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"canAmend": {
											"type": "boolean"
										},
										"campaignSubmitted": {
											"type": "boolean"
										},
										"campaignAutoRenewal": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"campaignRenewalDate": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"status",
										"revision",
										"phoneNumberId",
										"brandStatus",
										"campaignStatus",
										"feedback",
										"ukReview",
										"details",
										"acceptedQuote",
										"canAmend",
										"campaignSubmitted",
										"campaignAutoRenewal",
										"campaignRenewalDate"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/uk-requirements": {
			"get": {
				"summary": "Get the UK's mobile-number registration requirements",
				"tags": [
					"Channel connections"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"requirements": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DialerKycRequirement"
											}
										},
										"defaults": {
											"default": [],
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"requirementId": {
														"type": "string",
														"minLength": 1,
														"maxLength": 128
													},
													"value": {
														"type": "string",
														"minLength": 1,
														"maxLength": 4000
													}
												},
												"required": [
													"requirementId",
													"value"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"requirements",
										"defaults"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/numbers/{id}/activate": {
			"post": {
				"summary": "Connect an eligible number to the approved SMS registration",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"e164": {
											"type": "string"
										},
										"name": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string"
										},
										"purpose": {
											"type": "string"
										},
										"country": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"numberType": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"eligible": {
											"type": "boolean"
										},
										"reason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"registrationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"connectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"ready": {
											"type": "boolean"
										},
										"setupStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"setupMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"e164",
										"name",
										"status",
										"purpose",
										"country",
										"numberType",
										"eligible",
										"reason",
										"registrationId",
										"connectionId",
										"ready",
										"setupStatus",
										"setupMessage"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/numbers/{id}/check": {
			"post": {
				"summary": "Check whether an owned number can send and receive SMS",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"e164": {
											"type": "string"
										},
										"name": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string"
										},
										"purpose": {
											"type": "string"
										},
										"country": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"numberType": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"eligible": {
											"type": "boolean"
										},
										"reason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"registrationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"connectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"ready": {
											"type": "boolean"
										},
										"setupStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"setupMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"e164",
										"name",
										"status",
										"purpose",
										"country",
										"numberType",
										"eligible",
										"reason",
										"registrationId",
										"connectionId",
										"ready",
										"setupStatus",
										"setupMessage"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/numbers/search": {
			"get": {
				"summary": "Find available UK mobile or US local SMS numbers",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "contains",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 16,
							"pattern": "^[0-9+]*$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"e164": {
														"type": "string",
														"minLength": 1,
														"pattern": "^\\+[1-9][0-9]{7,14}$"
													},
													"region": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"phoneNumberType": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"e164",
													"region",
													"phoneNumberType"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/registrations/{id}/number-quote": {
			"post": {
				"summary": "Review rental for an SMS number without the Voice add-on",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"e164": {
										"type": "string",
										"minLength": 1,
										"pattern": "^\\+[1-9][0-9]{7,14}$"
									}
								},
								"required": [
									"e164"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"registrationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"purpose": {
											"type": "string",
											"enum": [
												"registration",
												"number"
											]
										},
										"numberE164": {
											"anyOf": [
												{
													"type": "string",
													"minLength": 1,
													"pattern": "^\\+[1-9][0-9]{7,14}$"
												},
												{
													"type": "null"
												}
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lines": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"code": {
														"type": "string",
														"enum": [
															"brand",
															"campaign_review",
															"campaign_subscription",
															"number_rental"
														]
													},
													"currency": {
														"type": "string",
														"enum": [
															"USD",
															"GBP"
														]
													},
													"amountMinor": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"interval": {
														"type": "string",
														"enum": [
															"once",
															"month"
														]
													},
													"prepaidMonths": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"nonrefundable": {
														"type": "boolean"
													}
												},
												"required": [
													"code",
													"currency",
													"amountMinor",
													"interval",
													"prepaidMonths",
													"nonrefundable"
												],
												"additionalProperties": false
											}
										},
										"carrierSource": {
											"type": "string",
											"format": "uri"
										},
										"carrierPriceDate": {
											"type": "string"
										},
										"repeatReview": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"registrationId",
										"purpose",
										"numberE164",
										"revision",
										"createdAt",
										"lines",
										"carrierSource",
										"carrierPriceDate",
										"repeatReview"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/numbers/purchase": {
			"post": {
				"summary": "Accept an SMS number rental and begin the durable order",
				"tags": [
					"Channel connections"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"quoteId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"confirmed": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"quoteId",
									"confirmed"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"numberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"numberId",
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/sms/numbers/{id}": {
			"delete": {
				"summary": "Release a standalone SMS number and end its rental",
				"tags": [
					"Channel connections"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/telnyx-sms": {
			"post": {
				"summary": "Enable texting from a Voice number",
				"tags": [
					"settings"
				],
				"description": "Assigns the practice's Voice number to the platform messaging profile and creates (or returns) the sms/telnyx connection that sends from it and routes its replies to the inbox. Idempotent per number. US numbers also need 10DLC registration before carriers deliver.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"phoneNumberId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"phoneNumberId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChannelConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/meta/oauth/start": {
			"post": {
				"summary": "Start the Messenger/Instagram/comments connect",
				"tags": [
					"settings"
				],
				"description": "Mints a single-use OAuth handshake and returns Meta's Login for Business URL. Connections are created by the callback for every Page the user grants.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"authorizeUrl": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"authorizeUrl"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/tiktok/oauth/start": {
			"post": {
				"summary": "Start the TikTok Business Messaging connect",
				"tags": [
					"settings"
				],
				"description": "Mints a single-use OAuth handshake and returns TikTok's authorize URL. The callback creates the TikTok channel connection for the granted Business Account.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"authorizeUrl": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"authorizeUrl"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/whatsapp/embedded-signup": {
			"post": {
				"summary": "Complete WhatsApp Embedded Signup",
				"tags": [
					"settings"
				],
				"description": "Exchanges the popup's code, validates the grant covers the posted assets, and walks the resumable onboarding (subscribe, verify, register, activate). Re-posting the same payload resumes after a provider hiccup.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"code": {
										"type": "string",
										"minLength": 1,
										"maxLength": 16384
									},
									"wabaId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"phoneNumberId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"coexistence": {
										"default": false,
										"type": "boolean"
									},
									"pin": {
										"type": "string",
										"pattern": "^\\d{6}$"
									}
								},
								"required": [
									"code",
									"wabaId"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChannelConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/{id}/whatsapp/resume": {
			"post": {
				"summary": "Resume WhatsApp setup with the saved grant",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"pin": {
										"type": "string",
										"pattern": "^\\d{6}$"
									}
								},
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChannelConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/mailbox/oauth/start": {
			"post": {
				"summary": "Start a Gmail/Outlook mailbox connect",
				"tags": [
					"settings"
				],
				"description": "Mints a single-use PKCE handshake and returns the provider's authorize URL. The callback creates the email-channel connection and starts the forward-only sync.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"enum": [
											"gmail",
											"outlook"
										]
									}
								},
								"required": [
									"provider"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"authorizeUrl": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"authorizeUrl"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/{id}": {
			"get": {
				"summary": "Get a channel connection",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChannelConnection"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a channel connection",
				"tags": [
					"settings"
				],
				"description": "Set status=disconnected to pause sends/receives without archiving. Passing credentials replaces the stored set.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"address": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"externalId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"externalMeta": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									},
									"credentials": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"type": "string"
										}
									},
									"status": {
										"type": "string",
										"enum": [
											"pending",
											"active",
											"error",
											"disconnected"
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChannelConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/{id}/archive": {
			"post": {
				"summary": "Archive a channel connection",
				"tags": [
					"settings"
				],
				"description": "Sets archivedAt; inbound webhooks answer 200-and-drop, sends are rejected. Conversation history is kept. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChannelConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/{id}/test": {
			"post": {
				"summary": "Test a channel connection",
				"tags": [
					"settings"
				],
				"description": "Pings the provider with the stored credentials and reports reachability.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean"
										},
										"detail": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"ok",
										"detail"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains": {
			"get": {
				"summary": "List sending domains",
				"tags": [
					"settings"
				],
				"description": "Includes archived domains whose removal has not finished at the provider, so a stuck teardown stays visible.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"domains": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/EmailSendingDomain"
											}
										}
									},
									"required": [
										"domains"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Connect a sending domain",
				"tags": [
					"settings"
				],
				"description": "Creates the domain at the email provider and returns it with the DNS records to publish. Verification is asynchronous — poll the domain until it reports verified.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"domain": {
										"type": "string",
										"minLength": 3,
										"maxLength": 253
									}
								},
								"required": [
									"domain"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EmailSendingDomain"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains/{id}": {
			"get": {
				"summary": "Get one sending domain",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EmailSendingDomain"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains/{id}/verify": {
			"post": {
				"summary": "Check a sending domain again",
				"tags": [
					"settings"
				],
				"description": "Asks the provider to re-read DNS. Use after publishing or correcting the records; a domain that gave up waiting is re-armed by the same call.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"proof": {
										"type": "string",
										"maxLength": 2048
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EmailSendingDomain"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains/{id}/retry-teardown": {
			"post": {
				"summary": "Retry removing a sending domain",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EmailSendingDomain"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains/{id}/archive": {
			"post": {
				"summary": "Stop using a sending domain",
				"tags": [
					"settings"
				],
				"description": "Sends fall back to the shared platform domain immediately. The domain is handed back to the provider in the background.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EmailSendingDomain"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains/{id}/dns-host": {
			"get": {
				"summary": "Find out where this domain's DNS is managed",
				"tags": [
					"settings"
				],
				"description": "Reads public DNS to name the provider and say which automatic routes are open. Proves nothing about whether the records are published — only a verify does that.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EmailSendingDomainDnsHost"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains/{id}/domain-connect-url": {
			"post": {
				"summary": "Get the one-click link to the practice's DNS provider",
				"tags": [
					"settings"
				],
				"description": "Returns a signed, single-purpose link the practice follows to approve our records at their own DNS host. The link carries the DKIM key and can be replayed by anyone with a session there, so it is minted behind a write permission and never cached.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"url": {
											"type": "string"
										}
									},
									"required": [
										"url"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/email-domains/{id}/cloudflare-apply": {
			"post": {
				"summary": "Publish the records with a Cloudflare API token",
				"tags": [
					"settings"
				],
				"description": "Uses the token for this one setup — a zone lookup, a read of each name, one batch write and a read-back — and then discards it. It is never stored, logged or returned. Only empty names are written to: anything already published is left alone and reported.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"apiToken": {
										"type": "string",
										"minLength": 1,
										"maxLength": 4096
									}
								},
								"required": [
									"apiToken"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EmailSendingDomainDnsApply"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/connections": {
			"get": {
				"summary": "List every external provider connection",
				"tags": [
					"settings"
				],
				"description": "One health board over the ad, SEO, reputation, inbox, PMS and dialer grants. Read-only: each row deep-links to the page that owns its connect and disconnect flow. Credentials, tokens and account identifiers beyond a display name are never exposed.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connections": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"key": {
														"type": "string"
													},
													"platform": {
														"type": "string",
														"enum": [
															"google",
															"meta",
															"tiktok",
															"microsoft",
															"other"
														]
													},
													"provider": {
														"type": "string"
													},
													"feature": {
														"type": "string"
													},
													"label": {
														"type": "string"
													},
													"account": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"health": {
														"type": "string",
														"enum": [
															"connected",
															"connecting",
															"expiring",
															"attention",
															"disconnected"
														]
													},
													"detail": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"lastCheckedAt": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"expiresAt": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"manageHref": {
														"type": "string"
													}
												},
												"required": [
													"key",
													"platform",
													"provider",
													"feature",
													"label",
													"account",
													"health",
													"detail",
													"lastCheckedAt",
													"expiresAt",
													"manageHref"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"connections"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/system-of-record": {
			"get": {
				"summary": "The clinical system of record",
				"tags": [
					"settings"
				],
				"description": "Which system holds the clinical record — Smileline or the connected PMS — and the adoption in progress, if one is.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"systemOfRecord": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"connectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authorityGeneration": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"openAdoption": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/PmsAdoption"
												},
												{
													"type": "null"
												}
											]
										},
										"capabilityProfileVersion": {
											"type": "string",
											"enum": [
												"uk_private_v1",
												"us_private_v1"
											]
										}
									},
									"required": [
										"systemOfRecord",
										"connectionId",
										"authorityGeneration",
										"openAdoption",
										"capabilityProfileVersion"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/adoptions": {
			"post": {
				"summary": "Start a system-of-record adoption",
				"tags": [
					"settings"
				],
				"description": "Opens the adoption (started); one open adoption per practice. Freezing, the owner's fresh approval, draining, reconciling and completing follow as separate steps, each recorded.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"external_to_native",
											"native_to_external"
										]
									},
									"connectionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"connectionId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"external_to_native",
												"native_to_external"
											]
										},
										"capabilityProfileVersion": {
											"type": "string"
										},
										"fromSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"toSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"connectionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"started",
												"frozen",
												"drained",
												"reconciled",
												"completed",
												"aborted"
											]
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"frozenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"drainedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"abortedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"actorUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"approvedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ownerReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"report": {
											"anyOf": [
												{},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"capabilityProfileVersion",
										"fromSystem",
										"toSystem",
										"connectionId",
										"generation",
										"status",
										"startedAt",
										"frozenAt",
										"drainedAt",
										"reconciledAt",
										"completedAt",
										"abortedAt",
										"actorUserId",
										"approvedByUserId",
										"ownerReauthenticatedAt",
										"report"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/adoptions/{id}/advance": {
			"post": {
				"summary": "Move the adoption to its next state",
				"tags": [
					"settings"
				],
				"description": "started → frozen → drained → reconciled, in order; draining needs the owner's approval first.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"to": {
										"type": "string",
										"enum": [
											"frozen",
											"drained",
											"reconciled"
										]
									},
									"report": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									}
								},
								"required": [
									"to"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"external_to_native",
												"native_to_external"
											]
										},
										"capabilityProfileVersion": {
											"type": "string"
										},
										"fromSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"toSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"connectionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"started",
												"frozen",
												"drained",
												"reconciled",
												"completed",
												"aborted"
											]
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"frozenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"drainedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"abortedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"actorUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"approvedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ownerReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"report": {
											"anyOf": [
												{},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"capabilityProfileVersion",
										"fromSystem",
										"toSystem",
										"connectionId",
										"generation",
										"status",
										"startedAt",
										"frozenAt",
										"drainedAt",
										"reconciledAt",
										"completedAt",
										"abortedAt",
										"actorUserId",
										"approvedByUserId",
										"ownerReauthenticatedAt",
										"report"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/adoptions/{id}/approve": {
			"post": {
				"summary": "Approve the adoption (owner, freshly re-authenticated)",
				"tags": [
					"settings"
				],
				"description": "The owner's approval, with a fresh re-authentication, before the adoption drains.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"external_to_native",
												"native_to_external"
											]
										},
										"capabilityProfileVersion": {
											"type": "string"
										},
										"fromSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"toSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"connectionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"started",
												"frozen",
												"drained",
												"reconciled",
												"completed",
												"aborted"
											]
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"frozenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"drainedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"abortedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"actorUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"approvedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ownerReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"report": {
											"anyOf": [
												{},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"capabilityProfileVersion",
										"fromSystem",
										"toSystem",
										"connectionId",
										"generation",
										"status",
										"startedAt",
										"frozenAt",
										"drainedAt",
										"reconciledAt",
										"completedAt",
										"abortedAt",
										"actorUserId",
										"approvedByUserId",
										"ownerReauthenticatedAt",
										"report"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/adoptions/{id}/complete": {
			"post": {
				"summary": "Complete the adoption",
				"tags": [
					"settings"
				],
				"description": "Flips the system of record, installs the new authority generation so stale provider work parks, and refreshes every member's session.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"external_to_native",
												"native_to_external"
											]
										},
										"capabilityProfileVersion": {
											"type": "string"
										},
										"fromSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"toSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"connectionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"started",
												"frozen",
												"drained",
												"reconciled",
												"completed",
												"aborted"
											]
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"frozenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"drainedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"abortedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"actorUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"approvedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ownerReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"report": {
											"anyOf": [
												{},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"capabilityProfileVersion",
										"fromSystem",
										"toSystem",
										"connectionId",
										"generation",
										"status",
										"startedAt",
										"frozenAt",
										"drainedAt",
										"reconciledAt",
										"completedAt",
										"abortedAt",
										"actorUserId",
										"approvedByUserId",
										"ownerReauthenticatedAt",
										"report"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/adoptions/{id}/abort": {
			"post": {
				"summary": "Abort the adoption",
				"tags": [
					"settings"
				],
				"description": "Any non-terminal adoption may be aborted; nothing already flipped is undone.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"external_to_native",
												"native_to_external"
											]
										},
										"capabilityProfileVersion": {
											"type": "string"
										},
										"fromSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"toSystem": {
											"type": "string",
											"enum": [
												"native",
												"external"
											]
										},
										"connectionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"started",
												"frozen",
												"drained",
												"reconciled",
												"completed",
												"aborted"
											]
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"frozenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"drainedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"abortedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"actorUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"approvedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ownerReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"report": {
											"anyOf": [
												{},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"capabilityProfileVersion",
										"fromSystem",
										"toSystem",
										"connectionId",
										"generation",
										"status",
										"startedAt",
										"frozenAt",
										"drainedAt",
										"reconciledAt",
										"completedAt",
										"abortedAt",
										"actorUserId",
										"approvedByUserId",
										"ownerReauthenticatedAt",
										"report"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections": {
			"get": {
				"summary": "List PMS connections",
				"tags": [
					"settings"
				],
				"description": "All non-deleted connections including pending requests. Provider-managed poll timing is diagnostic; credentials, lease tokens and sync cursors are never exposed.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsConnection"
											}
										},
										"systemOfRecord": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/SystemOfRecord"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"systemOfRecord"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Connect (or request) a PMS",
				"tags": [
					"settings"
				],
				"description": "One connection per provider covers the whole account. Created in pending_vendor_activation: Dentally activates when the partner OAuth flow completes (which also seeds the site→location map); CareStack and Open Dental activate through the credentials endpoint; every other connectable provider records an integration request.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"enum": [
											"dentally",
											"aerona",
											"exact",
											"carestream_r4",
											"systems_for_dentists",
											"pearl",
											"dentrix",
											"eaglesoft",
											"open_dental",
											"denticon",
											"sensei",
											"curve_dental",
											"carestack",
											"tab32",
											"archy",
											"oryx"
										]
									}
								},
								"required": [
									"provider"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}": {
			"get": {
				"summary": "Get a PMS connection",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/sites/{siteId}": {
			"patch": {
				"summary": "Map a PMS site to a location",
				"tags": [
					"settings"
				],
				"description": "Points a provider site at a location (null unmaps) or parks it (enabled=false). Mapping releases inbound records held for that site.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "siteId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"enabled": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/pause": {
			"post": {
				"summary": "Pause a PMS connection",
				"tags": [
					"settings"
				],
				"description": "Sync stops (webhooks are staged but not processed).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/resume": {
			"post": {
				"summary": "Resume a paused PMS connection",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/credentials": {
			"post": {
				"summary": "Activate a PMS connection with its credentials",
				"tags": [
					"settings"
				],
				"description": "Providers that take practice-supplied keys: CareStack (account subdomain, account id, account key) and Open Dental (customer key, optional eConnector workstation). Proves the credentials against the practice's own site list, seeds the site map from it and moves the connection to connecting, which starts the historical import; Open Dental also registers its change subscriptions. CareStack rotation is allowed only onto the same account; a different account is a disconnect. An organization may operate one PMS at a time, so activation is refused while another provider is live.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"provider": {
												"type": "string",
												"const": "carestack"
											},
											"account": {
												"type": "string",
												"minLength": 1,
												"maxLength": 63
											},
											"accountId": {
												"type": "string",
												"minLength": 1
											},
											"accountKey": {
												"type": "string",
												"minLength": 1
											},
											"expectedCredentialGeneration": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"provider",
											"account",
											"accountId",
											"accountKey"
										]
									},
									{
										"type": "object",
										"properties": {
											"provider": {
												"type": "string",
												"const": "open_dental"
											},
											"customerKey": {
												"type": "string",
												"minLength": 1
											},
											"workstation": {
												"type": "string",
												"minLength": 1
											},
											"expectedCredentialGeneration": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"provider",
											"customerKey"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/practitioners": {
			"get": {
				"summary": "List provider clinicians nobody has named yet",
				"tags": [
					"settings"
				],
				"description": "A provider that publishes no directory names its clinicians only by id inside appointments, so the sync engine holds an inactive placeholder for each. Their appointments still import and still block that column of the diary, but an inactive practitioner is in no booking roster. Name and activate them under Settings -> Practitioners to make them bookable.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsUnresolvedPractitioner"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/receipts": {
			"get": {
				"summary": "List a connection's webhook receipts",
				"tags": [
					"settings"
				],
				"description": "Every signed webhook delivery the connection received, newest first, with its ingress state. A receipt's raw body is captured before it is parsed, so a completed receipt can be replayed on demand while the capture is inside retention.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsWebhookReceipt"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/receipts/{receiptId}/replay": {
			"post": {
				"summary": "Replay a completed webhook receipt from its captured body",
				"tags": [
					"settings"
				],
				"description": "Re-parses the captured body through the provider adapter and re-stages its events (rows that still exist are untouched), then re-arms the receipt's processing. Parked and rejected receipts are replayed from the review queue instead.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "receiptId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"staged": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"publication": {
											"type": "string",
											"enum": [
												"queued",
												"failed",
												"parked",
												"not-due",
												"already-queued",
												"missing"
											]
										}
									},
									"required": [
										"staged",
										"publication"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"410": {
						"description": "Gone",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/connections/{id}/disconnect": {
			"post": {
				"summary": "Disconnect a PMS connection",
				"tags": [
					"settings"
				],
				"description": "Also cancels a pending integration request. Synced data and links are kept. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/appointment-corrections": {
			"get": {
				"summary": "List pending PMS appointment corrections",
				"tags": [
					"settings"
				],
				"description": "Lists bounded, cursor-paginated provider facts that would rewrite a terminal or backwards appointment state.",
				"parameters": [
					{
						"name": "connectionId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "before",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 200
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 50
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsAppointmentCorrection"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/appointment-corrections/{id}/resolve": {
			"post": {
				"summary": "Resolve a PMS appointment correction",
				"tags": [
					"settings"
				],
				"description": "Appointment editors can accept the provider projection or keep SmileLine's local fact. Acceptance preserves external-effect evidence and opens an urgent manual follow-up task.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"resolution": {
										"type": "string",
										"enum": [
											"accept",
											"keep_local"
										]
									},
									"expectedAppointmentVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"resolution",
									"expectedAppointmentVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"connectionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"state": {
											"type": "string",
											"enum": [
												"pending",
												"accepted",
												"kept_local",
												"superseded"
											]
										},
										"manualFollowUpTaskId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"connectionId",
										"appointmentId",
										"state",
										"manualFollowUpTaskId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/matches": {
			"get": {
				"summary": "List patient match candidates",
				"tags": [
					"settings"
				],
				"description": "Probabilistic PMS↔CRM patient matches awaiting review (55–89 score band).",
				"parameters": [
					{
						"name": "connectionId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "state",
						"in": "query",
						"required": false,
						"schema": {
							"default": "suggested",
							"type": "string",
							"enum": [
								"suggested",
								"accepted",
								"rejected"
							]
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsMatchCandidate"
											}
										},
										"total": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/matches/{id}/accept": {
			"post": {
				"summary": "Accept a match candidate",
				"tags": [
					"settings"
				],
				"description": "Links the CRM patient to the PMS record and retires competing suggestions. Held sync rows re-process.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsMatchCandidate"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/pms/matches/{id}/reject": {
			"post": {
				"summary": "Reject a match candidate",
				"tags": [
					"settings"
				],
				"description": "When no suggestion remains for the PMS record it becomes a new CRM patient.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsMatchCandidate"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/patients/{patientId}/search": {
			"get": {
				"summary": "Search PMS patients to link",
				"tags": [
					"pms"
				],
				"description": "Searches recently synced PMS patient records (staging window) for manual linking.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 2
						}
					},
					{
						"name": "connectionId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsExternalPatientPreview"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/patients/{patientId}/provider-matches": {
			"get": {
				"summary": "Find this patient in the PMS itself",
				"tags": [
					"pms"
				],
				"description": "Asks the provider for records carrying the patient's stored email or mobile number (never free text), so a person can link the right one before anything is created. Also says whether the patient can be created there and which fields are still missing.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "connectionId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsProviderMatches"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/patients/{patientId}/link": {
			"post": {
				"summary": "Link a patient to a PMS record",
				"tags": [
					"pms"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"connectionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"externalId": {
										"type": "string",
										"minLength": 1
									}
								},
								"required": [
									"externalId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsLinkSummary"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/patients/{patientId}/unlink": {
			"post": {
				"summary": "Unlink a patient from its PMS record",
				"tags": [
					"pms"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsLinkSummary"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/patients/{patientId}/push": {
			"post": {
				"summary": "Create the patient in the PMS",
				"tags": [
					"pms"
				],
				"description": "Creates the patient in Dentally and links the two, at most once: the provider is searched first and a chart this patient already created is adopted; the create is claimed durably before it is sent, so an unknown outcome is never sent again on its own (409/502 PMS_PATIENT_CREATE_UNCONFIRMED — `recreate` is a person's decision). 422 PMS_PATIENT_FIELDS_MISSING names what the provider still requires.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"connectionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"sex": {
										"type": "string",
										"enum": [
											"male",
											"female"
										]
									},
									"recreate": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsLinkSummary"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/connections/{id}/availability": {
			"get": {
				"summary": "Search PMS appointment availability",
				"tags": [
					"pms"
				],
				"description": "Proxies the PMS availability search (cached ~2 min; provider budget 200/hr). Range capped at 7 days.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "practitionerId",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "durationMin",
						"in": "query",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 5,
							"maximum": 240
						}
					},
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date-time",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date-time",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"slots": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"startsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"endsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"required": [
													"startsAt",
													"endsAt"
												],
												"additionalProperties": false
											}
										},
										"fetchedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"slots",
										"fetchedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/patients/{patientId}/book": {
			"post": {
				"summary": "Book an appointment in the PMS",
				"tags": [
					"pms"
				],
				"description": "Creates a local pending appointment and durable provider operation, then returns immediately. Retry the same eventId safely and poll the operation until completed, rejected, or review_required.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"eventId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"practitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"startsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"endsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentTypeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"eventId",
									"practitionerId",
									"startsAt",
									"endsAt"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsAppointmentOperation"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms/appointment-operations/{id}": {
			"get": {
				"summary": "Get a PMS appointment operation",
				"tags": [
					"pms"
				],
				"description": "Returns the durable state of a provider appointment creation. submitted, ambiguous and reconciling operations are never re-posted; they are recovered by stable SmileLine appointment UID.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsAppointmentOperation"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations": {
			"get": {
				"summary": "List sequences and reminder rules",
				"tags": [
					"automations"
				],
				"description": "The automations settings page's single data call: every sequence (with steps, archived included) plus the reminder rule cards.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"sequences": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Sequence"
											}
										},
										"reminderRules": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReminderRule"
											}
										}
									},
									"required": [
										"sequences",
										"reminderRules"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/sequences": {
			"post": {
				"summary": "Create a sequence",
				"tags": [
					"automations"
				],
				"description": "Starts with no steps. treatmentIds empty (or omitted) makes the fallback/default sequence for its trigger×stage. Rejects when another enabled sequence with the same trigger and stage already covers one of the treatments.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"trigger": {
										"type": "string",
										"enum": [
											"journey_created",
											"stage_entered",
											"journey_won",
											"journey_lost"
										]
									},
									"stageId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentIds": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"name",
									"trigger"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Sequence"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/sequences/{id}": {
			"get": {
				"summary": "Get a sequence with its steps",
				"tags": [
					"automations"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Sequence"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a sequence's settings",
				"tags": [
					"automations"
				],
				"description": "Partial update of name/trigger/stage/treatments/stop-conditions/enabled. Disabling freezes active enrollments in place (nothing sends, nobody is ejected); re-enabling resumes them. Edits apply to journeys currently mid-sequence.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"trigger": {
										"type": "string",
										"enum": [
											"journey_created",
											"stage_entered",
											"journey_won",
											"journey_lost"
										]
									},
									"stageId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentIds": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"stopOnReply": {
										"type": "boolean"
									},
									"stopOnStageChange": {
										"type": "boolean"
									},
									"enabled": {
										"type": "boolean"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Sequence"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/sequences/{id}/steps": {
			"put": {
				"summary": "Replace a sequence's step list",
				"tags": [
					"automations"
				],
				"description": "Whole ordered list; the server diffs by step id (rows with an id are updated in place so live enrollments keep their position, rows without are inserted, missing ones are deleted — journeys mid-sequence skip deleted steps).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"steps": {
										"maxItems": 50,
										"type": "array",
										"items": {
											"oneOf": [
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"paused": {
															"default": false,
															"type": "boolean"
														},
														"kind": {
															"type": "string",
															"const": "send_message"
														},
														"config": {
															"type": "object",
															"properties": {
																"channel": {
																	"type": "string",
																	"enum": [
																		"email",
																		"sms",
																		"whatsapp"
																	]
																},
																"templateId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"templateParams": {
																	"anyOf": [
																		{
																			"maxItems": 10,
																			"type": "array",
																			"items": {
																				"type": "string",
																				"maxLength": 200
																			}
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"required": [
																"channel",
																"templateId",
																"templateParams"
															]
														}
													},
													"required": [
														"kind",
														"config"
													]
												},
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"paused": {
															"default": false,
															"type": "boolean"
														},
														"kind": {
															"type": "string",
															"const": "wait"
														},
														"config": {
															"type": "object",
															"properties": {
																"waitMinutes": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 527040
																},
																"businessHoursOnly": {
																	"type": "boolean"
																}
															},
															"required": [
																"waitMinutes",
																"businessHoursOnly"
															]
														}
													},
													"required": [
														"kind",
														"config"
													]
												},
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"paused": {
															"default": false,
															"type": "boolean"
														},
														"kind": {
															"type": "string",
															"const": "create_task"
														},
														"config": {
															"type": "object",
															"properties": {
																"title": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 200
																},
																"note": {
																	"anyOf": [
																		{
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 2000
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"assigneeId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"minLength": 1
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"dueOffsetMinutes": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 527040
																},
																"priority": {
																	"type": "string",
																	"enum": [
																		"normal",
																		"urgent"
																	]
																}
															},
															"required": [
																"title",
																"note",
																"assigneeId",
																"dueOffsetMinutes",
																"priority"
															]
														}
													},
													"required": [
														"kind",
														"config"
													]
												},
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"paused": {
															"default": false,
															"type": "boolean"
														},
														"kind": {
															"type": "string",
															"const": "move_stage"
														},
														"config": {
															"type": "object",
															"properties": {
																"stageId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"required": [
																"stageId"
															]
														}
													},
													"required": [
														"kind",
														"config"
													]
												},
												{
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"paused": {
															"default": false,
															"type": "boolean"
														},
														"kind": {
															"type": "string",
															"const": "add_note"
														},
														"config": {
															"type": "object",
															"properties": {
																"body": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 2000
																}
															},
															"required": [
																"body"
															]
														}
													},
													"required": [
														"kind",
														"config"
													]
												}
											]
										}
									}
								},
								"required": [
									"expectedVersion",
									"steps"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Sequence"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/sequences/{id}/archive": {
			"post": {
				"summary": "Archive a sequence",
				"tags": [
					"automations"
				],
				"description": "Sets archivedAt and stops its active enrollments. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Sequence"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/sequences/{id}/restore": {
			"post": {
				"summary": "Restore an archived sequence",
				"tags": [
					"automations"
				],
				"description": "Clears archivedAt; past enrollments stay ended. Re-runs the trigger×stage×treatment conflict check.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Sequence"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/enrollments/{id}/stop": {
			"post": {
				"summary": "Stop a journey's active enrollment",
				"tags": [
					"automations"
				],
				"description": "Manual stop (reason `manual`) — the lead drops out of the sequence immediately. Requires journey:update (not sequence:update): coordinators stop automations on leads they work.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SequenceEnrollment"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/reminders": {
			"post": {
				"summary": "Create a reminder rule",
				"tags": [
					"automations"
				],
				"description": "Several pre_visit cards (48h + 24h) is the normal configuration. Scheduling applies to appointments booked from then on.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"booking_confirmation",
											"pre_visit",
											"post_visit",
											"no_show_followup",
											"cancellation",
											"reschedule_confirmation"
										]
									},
									"offsetMinutes": {
										"default": 0,
										"type": "integer",
										"minimum": -43200,
										"maximum": 43200
									},
									"channel": {
										"type": "string",
										"enum": [
											"email",
											"sms",
											"whatsapp"
										]
									},
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"enabled": {
										"default": true,
										"type": "boolean"
									}
								},
								"required": [
									"kind",
									"channel",
									"templateId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReminderRule"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/reminders/{id}": {
			"patch": {
				"summary": "Update a reminder rule",
				"tags": [
					"automations"
				],
				"description": "Edits apply when future reminder ledger rows are created. Disabling cancels deliveries that have not started; existing delivery snapshots and history remain unchanged.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"offsetMinutes": {
										"default": 0,
										"type": "integer",
										"minimum": -43200,
										"maximum": 43200
									},
									"channel": {
										"type": "string",
										"enum": [
											"email",
											"sms",
											"whatsapp"
										]
									},
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"enabled": {
										"default": true,
										"type": "boolean"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReminderRule"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a reminder rule",
				"tags": [
					"automations"
				],
				"description": "Archives the card and cancels deliveries that have not started. Immutable send history and semantic idempotency records are retained.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice": {
			"get": {
				"summary": "Get the practice identity/brand settings",
				"tags": [
					"settings"
				],
				"description": "Answers defaults for organizations that never saved settings. legalCountry and accountingCurrency are non-null values derived from the immutable organization country. Retention defaults to Forever for message content, activity detail and patient detail in audit history, and 90 days for recordings. Shorter windows apply progressively to existing rows and immediately to new rows.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PracticeSettings"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update the practice identity/brand settings",
				"tags": [
					"settings"
				],
				"description": "Partial update; creates the settings row on first save. Country and currency are derived organization facts and cannot be patched here. Omitted retention fields are unchanged and null means Forever. Shortening creates bounded progressive restamp work; extending a window never increases an already-materialized expiry or restores redacted data.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"website": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"socials": {
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"platform": {
													"type": "string",
													"enum": [
														"instagram",
														"facebook",
														"tiktok",
														"youtube",
														"linkedin",
														"x",
														"google"
													]
												},
												"url": {
													"type": "string",
													"maxLength": 500,
													"format": "uri"
												}
											},
											"required": [
												"platform",
												"url"
											]
										}
									},
									"emailSignature": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"emailLogoUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"smsSenderName": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[A-Za-z0-9 ]{1,11}$"
											},
											{
												"type": "null"
											}
										]
									},
									"brandColor": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-fA-F]{6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"vatNumber": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 32
											},
											{
												"type": "null"
											}
										]
									},
									"fiscalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 32
											},
											{
												"type": "null"
											}
										]
									},
									"timezone": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"automationLocationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"gdprConsentMode": {
										"type": "string",
										"enum": [
											"legitimate_interest",
											"explicit_consent"
										]
									},
									"marketingEligibilityMode": {
										"type": "string",
										"enum": [
											"explicit_only",
											"explicit_or_soft_opt_in"
										]
									},
									"sendWindow": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"days": {
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"mon",
																"tue",
																"wed",
																"thu",
																"fri",
																"sat",
																"sun"
															]
														}
													},
													"start": {
														"type": "string"
													},
													"end": {
														"type": "string"
													}
												},
												"required": [
													"days",
													"start",
													"end"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"aiCallingWindow": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"days": {
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"mon",
																"tue",
																"wed",
																"thu",
																"fri",
																"sat",
																"sun"
															]
														}
													},
													"start": {
														"type": "string"
													},
													"end": {
														"type": "string"
													}
												},
												"required": [
													"days",
													"start",
													"end"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"monthlyRevenueTargetCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 1000000000
											},
											{
												"type": "null"
											}
										]
									},
									"messageRetentionDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 30,
												"maximum": 3650
											},
											{
												"type": "null"
											}
										]
									},
									"activityRetentionDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 30,
												"maximum": 3650
											},
											{
												"type": "null"
											}
										]
									},
									"auditDetailRetentionDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 30,
												"maximum": 3650
											},
											{
												"type": "null"
											}
										]
									},
									"recordingRetentionDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 7,
												"maximum": 3650
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PracticeSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/organization/website-profile": {
			"post": {
				"summary": "Read a practice website into location details",
				"tags": [
					"organization"
				],
				"description": "Fetches the public site server-side and extracts its phone, email, address, nation/state, timezone and opening hours with AI. Best-effort by contract: anything the site does not state, and any failure, answers null. Stores nothing; account-scoped so onboarding can call it while the organization is still being created.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"website": {
										"type": "string",
										"maxLength": 500,
										"format": "uri"
									},
									"country": {
										"type": "string",
										"enum": [
											"AT",
											"BE",
											"BG",
											"CY",
											"DE",
											"EE",
											"ES",
											"FI",
											"FR",
											"GB",
											"GR",
											"IE",
											"IT",
											"LT",
											"LU",
											"LV",
											"MT",
											"NL",
											"PT",
											"SI",
											"SK",
											"US"
										]
									}
								},
								"required": [
									"website",
									"country"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WebsiteProfile"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pitch": {
			"get": {
				"summary": "Get the practice-wide sales pitch",
				"tags": [
					"settings"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PracticePitch"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Replace the practice-wide sales pitch",
				"tags": [
					"settings"
				],
				"description": "Whole-document write; creates the settings row on first save. null clears the pitch.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"doc": {
										"anyOf": [
											{},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"doc"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PracticePitch"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pitch/{treatmentId}": {
			"get": {
				"summary": "Get the practice-wide pitch and one treatment's, together",
				"tags": [
					"settings"
				],
				"description": "What the Today work panel shows while a rep is on the call. Both halves are null until someone writes them.",
				"parameters": [
					{
						"name": "treatmentId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadPitch"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/payments": {
			"get": {
				"summary": "Get Stripe Connect status and deposit configuration",
				"tags": [
					"payments"
				],
				"description": "Answers defaults for organizations that never configured payments. Connect state mirrors Stripe webhooks and may lag a few seconds.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PaymentSettings"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update the deposit configuration",
				"tags": [
					"payments"
				],
				"description": "Partial update; creates the payments row on first save. Connect state fields are read-only (webhook-mirrored).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"depositsEnabled": {
										"type": "boolean"
									},
									"defaultDepositAmountCents": {
										"type": "integer",
										"minimum": 100,
										"maximum": 500000
									},
									"noShowPolicy": {
										"type": "string",
										"enum": [
											"forfeit",
											"manual"
										]
									},
									"linkExpiryDays": {
										"type": "integer",
										"minimum": 1,
										"maximum": 30
									},
									"depositWhatsappTemplateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PaymentSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/payments/connect": {
			"post": {
				"summary": "Authorize a Stripe Connect account",
				"tags": [
					"payments"
				],
				"description": "Creates a single-use OAuth state and returns Stripe's authorization URL. A different account remains pending until it is explicitly confirmed.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"returnTo": {
										"type": "string",
										"maxLength": 2048
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"url": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"url"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/payments/connect/confirm": {
			"post": {
				"summary": "Confirm a pending Stripe account switch",
				"tags": [
					"payments"
				],
				"description": "Re-verifies the pending account and atomically makes it active. Existing deposits and refunds retain their frozen account identity.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PaymentSettings"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/payments/connect/cancel": {
			"post": {
				"summary": "Cancel a pending Stripe account switch",
				"tags": [
					"payments"
				],
				"description": "Deauthorizes only the pending account and preserves the currently active account.",
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests": {
			"post": {
				"summary": "Create a deposit request and send the payment link",
				"tags": [
					"deposits"
				],
				"description": "Freezes the amount (explicit → treatment override → org default), mints the short payment link and sends it on every selected channel. Per-channel failures are reported in the response, not thrown. Only one pending request may exist for the same journey, appointment, or patient-only subject.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"amountCents": {
										"type": "integer",
										"minimum": 100,
										"maximum": 500000
									},
									"channels": {
										"minItems": 1,
										"maxItems": 3,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"sms",
												"email",
												"whatsapp"
											]
										}
									}
								},
								"required": [
									"patientId",
									"channels"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositSendResult"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"get": {
				"summary": "List deposit requests",
				"tags": [
					"deposits"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "journeyId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"pending",
								"paid",
								"paid_external",
								"expired",
								"cancelled",
								"refund_pending",
								"refunded",
								"refund_failed",
								"review_required",
								"forfeited"
							]
						}
					},
					{
						"name": "flaggedForReview",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DepositRequest"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}": {
			"get": {
				"summary": "Get a deposit request",
				"tags": [
					"deposits"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositRequest"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}/resend": {
			"post": {
				"summary": "Re-send the payment link on the selected channels",
				"tags": [
					"deposits"
				],
				"description": "Pending requests only. Reuse clientRef when retrying the same command; a different channel set with that clientRef returns 409.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"channels": {
										"minItems": 1,
										"maxItems": 3,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"sms",
												"email",
												"whatsapp"
											]
										}
									}
								},
								"required": [
									"clientRef",
									"channels"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositSendResult"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}/cancel": {
			"post": {
				"summary": "Cancel a pending deposit request",
				"tags": [
					"deposits"
				],
				"description": "Voids the payment link; any open Checkout session is expired best-effort. A payment that still lands is auto-refunded.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositRequest"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}/mark-external": {
			"post": {
				"summary": "Mark the deposit as collected at the practice",
				"tags": [
					"deposits"
				],
				"description": "Cash/card taken in person. Terminal: attendance refunds must then be settled at the practice too.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositRequest"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}/refund": {
			"post": {
				"summary": "Refund a paid deposit",
				"tags": [
					"deposits"
				],
				"description": "Enqueues a full refund on the practice's connected account. Also retries a failed refund.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositRequest"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}/forfeit": {
			"post": {
				"summary": "Forfeit a paid deposit (no-show)",
				"tags": [
					"deposits"
				],
				"description": "The practice keeps the money; clears any review flag.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositRequest"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/referral-program": {
			"get": {
				"summary": "Get the referral programme",
				"tags": [
					"referrals"
				],
				"description": "Returns the org's referral programme configuration (provisioned lazily with defaults on first read).",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralProgram"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Update the referral programme",
				"tags": [
					"referrals"
				],
				"description": "Upserts the programme config. Enabling requires non-empty terms & conditions (400 TERMS_REQUIRED) — significant conditions must be published with the offer. Reward config is frozen into rewards at qualification, so edits never rewrite already-minted rewards.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"enabled": {
										"type": "boolean"
									},
									"headline": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"description": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 1000
											},
											{
												"type": "null"
											}
										]
									},
									"termsText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 10000
											},
											{
												"type": "null"
											}
										]
									},
									"privacyNoticeText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 5000
											},
											{
												"type": "null"
											}
										]
									},
									"shareMessage": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"advocateRewardType": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"credit",
													"voucher",
													"donation",
													"custom"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"advocateRewardAmountCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 100000
											},
											{
												"type": "null"
											}
										]
									},
									"advocateRewardCustomText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"friendRewardType": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"credit",
													"voucher",
													"donation",
													"custom"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"friendRewardAmountCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 100000
											},
											{
												"type": "null"
											}
										]
									},
									"friendRewardCustomText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"holdDays": {
										"type": "integer",
										"minimum": 0,
										"maximum": 365
									},
									"minTreatmentValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"qualifyWindowDays": {
										"type": "integer",
										"minimum": 7,
										"maximum": 730
									},
									"voucherExpiryMonths": {
										"type": "integer",
										"minimum": 1,
										"maximum": 36
									},
									"privateTreatmentsOnly": {
										"type": "boolean"
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralProgram"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/referral-program/regenerate-token": {
			"post": {
				"summary": "Regenerate the programme's public token",
				"tags": [
					"referrals"
				],
				"description": "Invalidates the current generic landing link (poster QR codes must be re-printed). Advocate share links are unaffected.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralProgram"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/referral": {
			"get": {
				"summary": "Patient's referral-programme view",
				"tags": [
					"referrals"
				],
				"description": "The patient page panel: advocate enrollment (share link, code, status page), referrals they've made, rewards they hold, and who referred them.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PatientReferralInfo"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{id}/referral/enroll": {
			"post": {
				"summary": "Enroll a patient as a referral advocate",
				"tags": [
					"referrals"
				],
				"description": "Creates (or re-activates) the patient's advocate record with a share link, human-readable code and status page, and sends the welcome message on their preferred channel. 400 PROGRAM_DISABLED while the programme is off.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PatientReferralInfo"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals": {
			"get": {
				"summary": "List referrals",
				"tags": [
					"referrals"
				],
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"submitted",
								"qualified",
								"disqualified",
								"expired"
							]
						}
					},
					{
						"name": "advocateId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Referral"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Record a referral attribution",
				"tags": [
					"referrals"
				],
				"description": "The front-desk name-drop path: links an existing friend patient/lead to an advocate retroactively. Auto-enrolls the advocate if needed. Idempotent — an existing live referral for the friend is returned unchanged. 409 when the friend already has a live referral from a different advocate.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"friendPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"advocatePatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"journeyId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"friendPatientId",
									"advocatePatientId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Referral"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/page": {
			"get": {
				"summary": "The referrals page in one request",
				"tags": [
					"referrals"
				],
				"description": "The approval queue (due rewards, 100), the rewards to fulfil (approved, 100) and the referral list (50) — the page's first load, collapsed into one round-trip. Filters and refreshes keep using the per-resource endpoints.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"due": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/ReferralRewardQueueItem"
													}
												},
												"total": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"limit": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"offset": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"items",
												"total",
												"limit",
												"offset"
											],
											"additionalProperties": false
										},
										"approved": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/ReferralRewardQueueItem"
													}
												},
												"total": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"limit": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"offset": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"items",
												"total",
												"limit",
												"offset"
											],
											"additionalProperties": false
										},
										"referrals": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/Referral"
													}
												},
												"total": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"limit": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"offset": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"items",
												"total",
												"limit",
												"offset"
											],
											"additionalProperties": false
										},
										"permissions": {
											"type": "object",
											"properties": {
												"report": {
													"type": "boolean"
												}
											},
											"required": [
												"report"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"due",
										"approved",
										"referrals",
										"permissions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/{id}/disqualify": {
			"post": {
				"summary": "Disqualify a referral",
				"tags": [
					"referrals"
				],
				"description": "Staff decline (fraud, self-referral, ineligible). Declines any live rewards on the referral with the given reason.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Referral"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/{id}/adjustments": {
			"post": {
				"summary": "Correct a terminal referral status",
				"tags": [
					"referrals"
				],
				"description": "Appends a correction to a disqualified or expired referral without changing its original row. The latest correction is exposed as effectiveStatus. This does not replay automation or create rewards.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"eventId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"correctedStatus": {
										"type": "string",
										"enum": [
											"submitted",
											"qualified",
											"disqualified",
											"expired"
										]
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"eventId",
									"correctedStatus",
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Referral"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/advocates": {
			"get": {
				"summary": "List referral advocates",
				"tags": [
					"referrals"
				],
				"parameters": [
					{
						"name": "query",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 200
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReferralAdvocateListItem"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/advocates/{id}/revoke": {
			"post": {
				"summary": "Revoke an advocate",
				"tags": [
					"referrals"
				],
				"description": "Soft-disables the advocate: their share link, code and status page stop resolving. Existing referrals and rewards are untouched.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralAdvocate"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/advocates/{id}/rotate-tokens": {
			"post": {
				"summary": "Rotate an advocate's tokens",
				"tags": [
					"referrals"
				],
				"description": "Mints a new share link, share code and status link (compromised-link hygiene). The old ones stop resolving immediately.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralAdvocate"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/rewards": {
			"get": {
				"summary": "List referral rewards",
				"tags": [
					"referrals"
				],
				"description": "With due=true this is the approval queue: pending rewards whose hold window has elapsed, joined with their referral context.",
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"pending",
								"approved",
								"issued",
								"declined",
								"expired"
							]
						}
					},
					{
						"name": "side",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"advocate",
								"friend"
							]
						}
					},
					{
						"name": "due",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"true",
								"false"
							]
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReferralRewardQueueItem"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/rewards/{id}/approve": {
			"post": {
				"summary": "Approve a reward",
				"tags": [
					"referrals"
				],
				"description": "Commits a pending reward once its hold window has elapsed. Re-verifies the qualifying journey is still won — a reversed win answers 409 QUALIFICATION_REVERSED and reverts the referral. Approving the advocate side sends the 'reward approved' message.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralRewardQueueItem"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/rewards/bulk-approve": {
			"post": {
				"summary": "Approve rewards in bulk",
				"tags": [
					"referrals"
				],
				"description": "Per-id compare-and-set; partial success. Each result carries ok or the per-reward error code.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"ids": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"ids"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"results": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"ok": {
														"type": "boolean"
													},
													"error": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"ok",
													"error"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"results"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/rewards/{id}/decline": {
			"post": {
				"summary": "Decline a reward",
				"tags": [
					"referrals"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralRewardQueueItem"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/rewards/{id}/issue": {
			"post": {
				"summary": "Mark a reward issued",
				"tags": [
					"referrals"
				],
				"description": "Records fulfilment (credit applied / voucher handed over / donation made). A voucher uses the expiry policy frozen onto that reward when it qualified, so later programme edits do not alter it.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"fulfillmentRef": {
										"type": "string",
										"maxLength": 200
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralRewardQueueItem"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referrals/rewards/{id}/adjustments": {
			"post": {
				"summary": "Record a reward correction",
				"tags": [
					"referrals"
				],
				"description": "Appends a signed amount change or non-financial fulfilment correction to an issued or expired reward. The original terminal reward row is never rewritten.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"eventId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"reason": {
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											"description": {
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											"fulfillmentRef": {
												"type": "string",
												"maxLength": 200
											},
											"correctionOfEventId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"adjustmentType": {
												"type": "string",
												"const": "amount_delta"
											},
											"amountDeltaCents": {
												"type": "integer",
												"minimum": -1000000000000,
												"maximum": 1000000000000
											}
										},
										"required": [
											"eventId",
											"reason",
											"description",
											"adjustmentType",
											"amountDeltaCents"
										]
									},
									{
										"type": "object",
										"properties": {
											"eventId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"reason": {
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											"description": {
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											"fulfillmentRef": {
												"type": "string",
												"maxLength": 200
											},
											"correctionOfEventId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"adjustmentType": {
												"type": "string",
												"const": "fulfillment_correction"
											}
										},
										"required": [
											"eventId",
											"reason",
											"description",
											"adjustmentType"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralRewardQueueItem"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referral/{token}/config": {
			"get": {
				"summary": "Referral landing bootstrap (advocate link)",
				"tags": [
					"referrals"
				],
				"description": "Public, CORS-open endpoint the friend landing page loads first: practice identity, the advocate's first name, the offer for both sides and the programme terms. Unknown, revoked or disabled tokens answer an identical 404. Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralLandingConfig"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referral/p/{token}/config": {
			"get": {
				"summary": "Referral landing bootstrap (programme link)",
				"tags": [
					"referrals"
				],
				"description": "The generic poster/QR landing: same shape as the advocate landing but with no advocate name — the friend enters the advocate's share code in the form. Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralLandingConfig"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referral/{token}/submit": {
			"post": {
				"summary": "Friend self-submit (advocate link)",
				"tags": [
					"referrals"
				],
				"description": "Creates the friend as an ordinary lead attributed to the advocate (channel referral_friend) plus the programme's referral record. Deliberately constant-shaped: duplicate and already-a-patient submissions answer the same generic success so nothing about existing patients leaks. Submitting the advocate's own contact details answers 400 SELF_REFERRAL. eventId makes retries idempotent. Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"eventId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"code": {
										"type": "string",
										"maxLength": 20
									},
									"firstName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"lastName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"email": {
										"type": "string",
										"maxLength": 320
									},
									"phoneMobile": {
										"type": "string",
										"minLength": 5,
										"maxLength": 32
									},
									"message": {
										"type": "string",
										"maxLength": 1000
									},
									"consent": {
										"type": "boolean",
										"const": true
									},
									"website": {
										"type": "string",
										"maxLength": 200
									},
									"pageUrl": {
										"type": "string",
										"maxLength": 2048
									}
								},
								"required": [
									"eventId",
									"firstName",
									"lastName",
									"consent"
								],
								"description": "Friend must provide an email address or a mobile number."
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralSubmitResult"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referral/p/{token}/submit": {
			"post": {
				"summary": "Friend self-submit (programme link)",
				"tags": [
					"referrals"
				],
				"description": "As the advocate-link submit, but the advocate resolves from the share code in the body (400 CODE_REQUIRED / CODE_UNKNOWN). Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"eventId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"code": {
										"type": "string",
										"maxLength": 20
									},
									"firstName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"lastName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"email": {
										"type": "string",
										"maxLength": 320
									},
									"phoneMobile": {
										"type": "string",
										"minLength": 5,
										"maxLength": 32
									},
									"message": {
										"type": "string",
										"maxLength": 1000
									},
									"consent": {
										"type": "boolean",
										"const": true
									},
									"website": {
										"type": "string",
										"maxLength": 200
									},
									"pageUrl": {
										"type": "string",
										"maxLength": 2048
									}
								},
								"required": [
									"eventId",
									"firstName",
									"lastName",
									"consent"
								],
								"description": "Friend must provide an email address or a mobile number."
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralSubmitResult"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/referral/status/{token}": {
			"get": {
				"summary": "Advocate status page",
				"tags": [
					"referrals"
				],
				"description": "The advocate's private 'my referrals' view, addressed by their status token (never the share token): share link/code/QR context, referrals in patient-friendly coarse statuses (friend first names only, never clinical detail) and their reward balance. Rate limited; unknown or revoked tokens answer 404.",
				"security": [],
				"parameters": [
					{
						"name": "token",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReferralAdvocateStatus"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/settings": {
			"get": {
				"summary": "Get the organization's dialer configuration",
				"tags": [
					"dialer"
				],
				"description": "Numbers, UK verification state, recording policy and any provider writes still in flight. Requires dialer:manage.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DialerSettings"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update dialer settings",
				"tags": [
					"dialer"
				],
				"description": "Recording policy and the default caller ID. Provider resource changes have their own endpoints.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"recordingEnabled": {
										"type": "boolean"
									},
									"defaultNumberId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DialerSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/provision": {
			"post": {
				"summary": "Provision or repair the dialer's provider account objects",
				"tags": [
					"dialer"
				],
				"description": "Validates that the platform Telnyx account is reachable with the configured credentials and object ids.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DialerSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/numbers/search": {
			"get": {
				"summary": "Search purchasable local numbers",
				"tags": [
					"dialer"
				],
				"description": "Numbers are searched in the practice's own country — inventory follows the org's legal country.",
				"parameters": [
					{
						"name": "contains",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 10
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 10,
							"type": "integer",
							"minimum": 1,
							"maximum": 25
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"numbers": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"e164": {
														"type": "string"
													},
													"region": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"phoneNumberType": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"e164",
													"region",
													"phoneNumberType"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"numbers"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/numbers": {
			"post": {
				"summary": "Order a local number",
				"tags": [
					"dialer"
				],
				"description": "Requires approved verification where the country demands it (GB does; US local numbers do not). Asynchronous: the order is staged durably and reported through GET /dialer/operations/:id, because regulatory review can take days. A `voice` number becomes the caller ID automatically if the practice has no default yet and bills as a Voice extra once active; a `tracking` number joins its call-tracking pool and bills per number (core, no add-on).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"e164": {
										"type": "string",
										"minLength": 8,
										"maxLength": 20
									},
									"purpose": {
										"default": "voice",
										"type": "string",
										"enum": [
											"voice",
											"tracking"
										]
									},
									"trackingPoolId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"emergencyLocationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"e164"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"number": {
											"$ref": "#/components/schemas/PhoneNumber"
										},
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"number",
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/numbers/{id}": {
			"delete": {
				"summary": "Release a number",
				"tags": [
					"dialer"
				],
				"description": "Refused while the number is the default caller ID. Asynchronous: the release is staged durably and reported through GET /dialer/operations/:id. Releasing is irreversible and stops the per-number billing item (Voice extra or call-tracking number alike).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/numbers/{id}/role": {
			"patch": {
				"summary": "Change a number's role",
				"tags": [
					"dialer"
				],
				"description": "Moves one number between its three roles — Voice line, rotating member of a tracking pool, or static tracking number pinned to a lead source. Synchronous and atomic; billing quantities move with the purpose in the same staged revision. Refused while anything still depends on the number's current role: the default caller ID, a desk-phone line, carrier backup forwarding, a live provider operation or port-out review, anything forwarding to it, or a website visitor still holding it (the error names when it frees). Past calls keep the attribution they were captured with.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "voice"
											}
										},
										"required": [
											"kind"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "pooled"
											},
											"trackingPoolId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"kind",
											"trackingPoolId"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "static"
											},
											"leadSourceId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"treatmentId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"locationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"forwardE164": {
												"default": null,
												"anyOf": [
													{
														"type": "string"
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"kind",
											"leadSourceId",
											"treatmentId",
											"locationId"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"numberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"role": {
											"type": "string",
											"enum": [
												"voice",
												"pooled",
												"static"
											]
										},
										"purposeChanged": {
											"type": "boolean"
										}
									},
									"required": [
										"numberId",
										"role",
										"purposeChanged"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/kyc/requirements": {
			"get": {
				"summary": "List UK regulatory requirements for number ordering",
				"tags": [
					"dialer"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"requirements": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DialerKycRequirement"
											}
										}
									},
									"required": [
										"requirements"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/kyc": {
			"put": {
				"summary": "Submit UK regulatory (KYC) details",
				"tags": [
					"dialer"
				],
				"description": "Creates the provider requirement group used by subsequent number orders. Document-typed fields take document ids from the raw upload endpoint POST /dialer/kyc/documents.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"fields": {
										"minItems": 1,
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"requirementId": {
													"type": "string",
													"minLength": 1
												},
												"value": {
													"type": "string",
													"minLength": 1,
													"maxLength": 2000
												}
											},
											"required": [
												"requirementId",
												"value"
											]
										}
									}
								},
								"required": [
									"fields"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"kycStatus": {
											"type": "string",
											"enum": [
												"none",
												"submitted",
												"pending",
												"approved",
												"declined",
												"expired"
											]
										},
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"kycStatus",
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update declined UK regulatory (KYC) details",
				"tags": [
					"dialer"
				],
				"description": "Replaces only the cited requirement values on the existing requirement group and sends it back for review; approved details keep their approval. Document-typed fields take document ids from POST /dialer/kyc/documents.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"fields": {
										"minItems": 1,
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"requirementId": {
													"type": "string",
													"minLength": 1
												},
												"value": {
													"type": "string",
													"minLength": 1,
													"maxLength": 2000
												}
											},
											"required": [
												"requirementId",
												"value"
											]
										}
									}
								},
								"required": [
									"fields"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"kycStatus": {
											"type": "string",
											"enum": [
												"none",
												"submitted",
												"pending",
												"approved",
												"declined",
												"expired"
											]
										},
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"kycStatus",
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/kyc/refresh": {
			"post": {
				"summary": "Re-read the UK verification review from the provider now",
				"tags": [
					"dialer"
				],
				"description": "Reads the requirement group and its comment thread immediately instead of waiting for the six-hourly check. Returns the settings with the refreshed review.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DialerSettings"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/kyc/comments": {
			"post": {
				"summary": "Reply on the UK verification review thread",
				"tags": [
					"dialer"
				],
				"description": "Posts a message to the provider's reviewers on the current requirement group. Returns the settings with the thread refreshed.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"body": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DialerSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/operations/{id}": {
			"get": {
				"summary": "Get the state of an in-flight provider operation",
				"tags": [
					"dialer"
				],
				"description": "Number orders and UK verification are asynchronous provider workflows; this reports where one has reached. Errors are classified codes, never the provider's own response body.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"sms_profile_create",
												"sms_registration_submit",
												"sms_number_assign",
												"address_create",
												"document_upload",
												"requirement_group_create",
												"number_order",
												"number_release",
												"number_forwarding_set",
												"raw_line_enable",
												"raw_line_disable",
												"raw_line_rotate_credentials",
												"emergency_enable",
												"portout_authorize",
												"portout_reject",
												"porting_order_create",
												"porting_child_setup",
												"porting_order_submit",
												"porting_order_amend",
												"porting_child_cancel",
												"porting_number_adopt",
												"porting_child_reconcile"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"queued",
												"claimed",
												"submitted",
												"ambiguous",
												"reconciling",
												"confirmed",
												"completed",
												"rejected",
												"review_required",
												"superseded"
											]
										},
										"numberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"stalled": {
											"type": "boolean"
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"kind",
										"status",
										"numberId",
										"lastError",
										"stalled",
										"createdAt",
										"resolvedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/portouts/{id}/rejection-codes": {
			"get": {
				"summary": "List the carrier's allowed rejection reasons for a port-out",
				"tags": [
					"dialer"
				],
				"description": "A rejection must cite one of the losing process's allowed codes; this lists the ones the provider will accept for this specific request.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"codes": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"code": {
														"type": "string"
													},
													"label": {
														"type": "string"
													}
												},
												"required": [
													"code",
													"label"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"codes"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/portouts/{id}/authorize": {
			"post": {
				"summary": "Approve a carrier's request to move numbers away",
				"tags": [
					"dialer"
				],
				"description": "Practice owner or manager (dialer:manage). Stages the fenced provider authorization; the transfer itself completes on the carrier's schedule and the numbers settle to ported_out when it does.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/portouts/{id}/reject": {
			"post": {
				"summary": "Reject a carrier's request to move numbers away",
				"tags": [
					"dialer"
				],
				"description": "Practice owner or manager (dialer:manage). The rejection must cite one of the allowed codes from GET /dialer/portouts/:id/rejection-codes; the carrier may dispute it through its own process.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"rejectionCode": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									}
								},
								"required": [
									"rejectionCode"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/portouts/{id}/rearm": {
			"post": {
				"summary": "Retry a port-out request SmileLine parked for review",
				"tags": [
					"dialer"
				],
				"description": "Practice owner or manager (dialer:manage). A transfer request whose automated carrier polling exhausted its budget is parked for review rather than dropped. Retry clears the park and opens a fresh polling window; the carrier is read again on the next hourly check. 409 when the request is not parked.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoicePortoutRequest"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting/checks": {
			"post": {
				"summary": "Check whether numbers can port into SmileLine Voice",
				"tags": [
					"dialer"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"e164s": {
										"minItems": 1,
										"maxItems": 30,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 5,
											"maxLength": 20
										}
									}
								},
								"required": [
									"e164s"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"verdicts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"e164": {
														"type": "string"
													},
													"portable": {
														"type": "boolean"
													},
													"reason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"e164",
													"portable",
													"reason"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"verdicts"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting": {
			"post": {
				"summary": "Start porting existing numbers into SmileLine Voice",
				"tags": [
					"dialer"
				],
				"description": "Owner-only. Stages the whole request durably — number rows, capacity, the encrypted account details — before any provider call, then answers 202: a port is a multi-week carrier workflow, not a request/response. Numbers are read in the practice's own country.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"e164s": {
										"minItems": 1,
										"maxItems": 30,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 5,
											"maxLength": 20
										}
									},
									"carrierName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"accountNumber": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"accountHolderName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"signatoryName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"billingPhoneNumber": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 5,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"pinPasscode": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 32
											},
											{
												"type": "null"
											}
										]
									},
									"streetAddress": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"extendedAddress": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"locality": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"administrativeArea": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"type": "string",
										"minLength": 1,
										"maxLength": 16
									},
									"remainderRanges": {
										"default": [],
										"maxItems": 5,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"startE164": {
													"type": "string",
													"minLength": 5,
													"maxLength": 20
												},
												"endE164": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 5,
															"maxLength": 20
														},
														{
															"type": "null"
														}
													]
												},
												"action": {
													"type": "string",
													"enum": [
														"keep",
														"disconnect"
													]
												}
											},
											"required": [
												"startE164",
												"endE164",
												"action"
											]
										}
									},
									"btnE164": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 5,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"requestedFocAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"adoptAsDefault": {
										"default": false,
										"type": "boolean"
									},
									"emergencyLocationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"e164s",
									"carrierName",
									"accountNumber",
									"accountHolderName",
									"signatoryName",
									"streetAddress",
									"locality",
									"postalCode"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"portingOrderId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"portingOrderId",
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting/{id}": {
			"get": {
				"summary": "Get one port-in request with its carrier orders",
				"tags": [
					"dialer"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoicePortingOrder"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a port-in's account details, documents, requirement answers, or switch date",
				"tags": [
					"dialer"
				],
				"description": "Owner-only, before submission (and between rejection rounds). The losing-account details, requirement answers, document references, the port-out PIN and the state merge into the encrypted request details; requirement answers merge per requirement type. An amend after a rejection re-files the merged account details with the carrier.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"carrierName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"accountHolderName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"accountNumber": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"signatoryName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"billingPhoneNumber": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 5,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"streetAddress": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"extendedAddress": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"locality": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"postalCode": {
										"type": "string",
										"minLength": 1,
										"maxLength": 16
									},
									"requirementValues": {
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"requirementTypeId": {
													"type": "string",
													"minLength": 1,
													"maxLength": 128
												},
												"fieldValue": {
													"type": "string",
													"minLength": 1,
													"maxLength": 2000
												}
											},
											"required": [
												"requirementTypeId",
												"fieldValue"
											]
										}
									},
									"loaDocumentId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 128
									},
									"invoiceDocumentId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 128
									},
									"pinPasscode": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 32
											},
											{
												"type": "null"
											}
										]
									},
									"administrativeArea": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									},
									"requestedFocAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"adoptAsDefault": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoicePortingOrder"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting/{id}/requirements/refresh": {
			"post": {
				"summary": "Refresh the carrier's dynamic requirements for a port-in",
				"tags": [
					"dialer"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoicePortingOrder"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting/{id}/submit": {
			"post": {
				"summary": "Submit a port-in to the carrier network",
				"tags": [
					"dialer"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationIds": {
											"type": "array",
											"items": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										}
									},
									"required": [
										"operationIds"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting/{id}/orders/{childId}/amend": {
			"post": {
				"summary": "Fix and resubmit a rejected port order",
				"tags": [
					"dialer"
				],
				"description": "Rejections are the NORMAL porting path (mismatched account details). Update the details first, then amend; each rejection round allows a bounded number of retries before support takes over.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "childId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting/{id}/rearm": {
			"post": {
				"summary": "Retry a port-in SmileLine parked for review",
				"tags": [
					"dialer"
				],
				"description": "Owner-only. A port whose automated carrier polling exhausted its budget is parked for review rather than failed. Retry clears the park and opens a fresh polling window; the carrier is read again on the next hourly check. 409 when the port is not parked.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoicePortingOrder"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/capacity/rearm": {
			"post": {
				"summary": "Retry a billing capacity sync SmileLine parked for review",
				"tags": [
					"dialer"
				],
				"description": "dialer:manage. A number or line change whose Stripe update could not be applied is parked (the numbers page says billing has not caught up). Retry opens a fresh attempt budget on the same revision; the billing healer applies it within minutes. 409 when nothing is parked.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"capacitySync": {
											"type": "string",
											"enum": [
												"ready",
												"pending",
												"parked"
											]
										}
									},
									"required": [
										"capacitySync"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/porting/{id}/cancel": {
			"post": {
				"summary": "Ask the carrier network to cancel a port-in",
				"tags": [
					"dialer"
				],
				"description": "Cancellation is asynchronous: the request enters cancel-pending and the numbers stay reserved until the carrier's verdict arrives. Unavailable within 48 hours of a confirmed switch date — contact support then.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationIds": {
											"type": "array",
											"items": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										}
									},
									"required": [
										"operationIds"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/sessions": {
			"post": {
				"summary": "Start a dialing session",
				"tags": [
					"dialer"
				],
				"description": "Mints the agent WebRTC credential and opens the session. The credential attempt is durably consumed before the provider call, so a lost response can never orphan a second credential.",
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DialerSessionStart"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/sessions/{id}/token": {
			"post": {
				"summary": "Refresh the session's WebRTC login token",
				"tags": [
					"dialer"
				],
				"description": "Issues a fresh WebRTC login token for an active session.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DialerToken"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls": {
			"get": {
				"summary": "List call logs",
				"tags": [
					"dialer"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "sessionId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"inbound",
								"outbound"
							]
						}
					},
					{
						"name": "hasRecording",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "aiOnly",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "from",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date-time",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date-time",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 120
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CallLog"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls/{id}": {
			"patch": {
				"summary": "Write a call's note or disposition",
				"tags": [
					"dialer"
				],
				"description": "dialer:use. Sets the wrap-up note and/or disposition on one of the practice's calls; absent fields are left alone, null clears. 404 for another practice's call.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"disposition": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 80
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"disposition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"note",
										"disposition"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls/{id}/quality": {
			"patch": {
				"summary": "Report the quality of a leg this device carried",
				"tags": [
					"dialer"
				],
				"description": "dialer:use, and only by the member who was on that leg (the call's own user, or a device of theirs named by the leg key). One measurement per leg key, insert-once: a repeat is write-free; at most 16 legs per call. No queue — one request per answered leg.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"legKey": {
										"type": "string",
										"minLength": 3,
										"maxLength": 128,
										"pattern": "^[A-Za-z0-9:_-]+$"
									},
									"mos": {
										"type": "number",
										"minimum": 1,
										"maximum": 5
									},
									"jitterMs": {
										"type": "number",
										"minimum": 0,
										"maximum": 10000
									},
									"packetLossPct": {
										"type": "number",
										"minimum": 0,
										"maximum": 100
									},
									"rttMs": {
										"type": "number",
										"minimum": 0,
										"maximum": 60000
									}
								},
								"required": [
									"legKey",
									"mos",
									"jitterMs",
									"packetLossPct",
									"rttMs"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"quality": {
											"type": "object",
											"propertyNames": {
												"type": "string"
											},
											"additionalProperties": {
												"$ref": "#/components/schemas/CallLegQuality"
											}
										}
									},
									"required": [
										"id",
										"quality"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls/{id}/recording": {
			"get": {
				"summary": "Stream a call recording",
				"tags": [
					"dialer"
				],
				"description": "Streams the stored MP3. Requires the dialer:media permission; every access is written to the audit log. 404 until the recording is stored; recordings are deleted after the org's retention window.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"audio/mpeg": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls/{id}/transcript": {
			"get": {
				"summary": "The call's transcript",
				"tags": [
					"dialer"
				],
				"description": "Assembled post-call transcript (SmileLine Voice). Requires the dialer:media permission; every access is written to the audit log. 404 until transcription completes; transcripts expire with their recording.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"callLogId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"source": {
											"type": "string",
											"enum": [
												"recording",
												"voicemail"
											]
										},
										"language": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"text": {
											"type": "string"
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"callLogId",
										"source",
										"language",
										"text",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls/{id}/summary": {
			"get": {
				"summary": "The AI agent's call summary",
				"tags": [
					"dialer"
				],
				"description": "The AI voice agent's structured summary and disposition for a call. Requires the dialer:media permission; every access is written to the audit log. 404 until the summary is stored.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"callLogId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"disposition": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"answered",
														"no_answer",
														"busy",
														"voicemail",
														"failed",
														"transferred"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"summary": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"structured": {
											"anyOf": [
												{},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"callLogId",
										"disposition",
										"summary",
										"structured",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/endpoints": {
			"post": {
				"summary": "Ensure this user's calling endpoint for a device kind",
				"tags": [
					"voice"
				],
				"description": "Idempotent per (user, device kind): returns the existing endpoint or provisions one on the platform account. Provisioning claims the slot durably before the provider call; a lost provider response is recovered by deterministic-name lookup, so the slot can never wedge. 409 while a concurrent provision for the same slot is in flight.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"deviceKind": {
										"type": "string",
										"enum": [
											"browser",
											"desktop",
											"mobile",
											"extension"
										]
									},
									"reenable": {
										"type": "boolean"
									}
								},
								"required": [
									"deviceKind"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"endpoint": {
											"$ref": "#/components/schemas/VoiceEndpoint"
										}
									},
									"required": [
										"endpoint"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"get": {
				"summary": "List calling endpoints",
				"tags": [
					"voice"
				],
				"description": "dialer:use sees the caller's own endpoints; dialer:manage sees every member's, for the devices card in settings.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"endpoints": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceEndpoint"
											}
										}
									},
									"required": [
										"endpoints"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/endpoints/{id}/token": {
			"post": {
				"summary": "Mint a WebRTC login token for an endpoint the caller owns",
				"tags": [
					"voice"
				],
				"description": "Fails closed: the endpoint must be the caller's own, active, and the practice still Voice-entitled — losing dialer:use or the add-on locks the softphone out at the next mint. The token is the provider's ~24h JWT; clients cache it until expiry rather than minting per page load.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"token": {
											"type": "string"
										},
										"expiresAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"sipUsername": {
											"type": "string"
										}
									},
									"required": [
										"token",
										"expiresAt",
										"sipUsername"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/endpoints/{id}": {
			"delete": {
				"summary": "Revoke a calling endpoint",
				"tags": [
					"voice"
				],
				"description": "Own endpoint with dialer:use; anyone's with dialer:manage. The row is marked immediately (ring resolution and token minting stop at once); the provider credential is deleted by the bounded deactivation healer.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"endpoint": {
											"$ref": "#/components/schemas/VoiceEndpoint"
										}
									},
									"required": [
										"endpoint"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/endpoints/{id}/restore": {
			"post": {
				"summary": "Hand a manager-revoked endpoint back to its member",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. The endpoint stays revoked until its member turns calling on again on that device; this only records that the member may. 404 unless the endpoint is revoked.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"endpoint": {
											"$ref": "#/components/schemas/VoiceEndpoint"
										}
									},
									"required": [
										"endpoint"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/endpoints/{id}/location": {
			"post": {
				"summary": "Set where a calling endpoint is physically located",
				"tags": [
					"voice"
				],
				"description": "Own endpoints only. The location's validated Voice number becomes the caller ID of an emergency (999/112/911) dial from this device, so responders are sent to the right address. Nomadic devices (laptops, the desktop app) should update it when they move.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"endpoint": {
											"$ref": "#/components/schemas/VoiceEndpoint"
										}
									},
									"required": [
										"endpoint"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/colleagues": {
			"get": {
				"summary": "Members a live call can be transferred to",
				"tags": [
					"voice"
				],
				"description": "dialer:use. Members other than the caller who hold an active calling endpoint, with their do-not-disturb state. The transfer itself picks the freshest registered device server-side.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"colleagues": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceColleague"
											}
										}
									},
									"required": [
										"colleagues"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/presence": {
			"post": {
				"summary": "Presence beat for a registered endpoint",
				"tags": [
					"voice"
				],
				"description": "Sent every ~60s while the softphone is registered, and on demand to flip availability (do-not-disturb). The availability flag persists; the liveness beat feeds the VoiceRouter's ring resolution with a short TTL.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"endpointId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"available": {
										"type": "boolean"
									}
								},
								"required": [
									"endpointId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/calls": {
			"post": {
				"summary": "Start an outbound call (click-to-dial)",
				"tags": [
					"voice"
				],
				"description": "Rings the caller's own registered device first, dials the destination when they pick up, and bridges. Destinations are domestic-only for the practice's country. The practice country's own emergency numbers (GB 999/112, US 911) take a dedicated path: the caller ID is the validated Voice number of the location the device is calling from (see POST /voice/endpoints/:id/location), the practice's managers are notified, and 422 EMERGENCY_NUMBER_UNSUPPORTED answers when that location has no validated number — or from a mobile device, which uses the phone's own dialler. 409 ALL_LINES_BUSY when every line is in use or reserved; 409 NO_REGISTERED_ENDPOINT until the caller enables calling on a device; 422 DESTINATION_NOT_ALLOWED outside the domestic policy.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"to": {
										"type": "string",
										"minLength": 3,
										"maxLength": 20
									},
									"patientId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"numberId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"deviceKind": {
										"type": "string",
										"enum": [
											"browser",
											"desktop",
											"mobile",
											"extension"
										]
									}
								},
								"required": [
									"to"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"callLogId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"callLogId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/calls/{id}/command": {
			"post": {
				"summary": "Command a live call: hold, transfer, voicemail, or hang up",
				"tags": [
					"voice"
				],
				"description": "Fenced in the org's call router — replays and races collapse. Only the member on the call (or a manager) may command it; transfer destinations follow the same domestic policy as dialing. An attended transfer keeps one target live at a time (a second is refused with 409) and is bounded by the number's ring window; `transfer-voicemail` is inbound-only.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "hold"
											},
											"on": {
												"type": "boolean"
											}
										},
										"required": [
											"kind",
											"on"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "transfer"
											},
											"to": {
												"type": "string",
												"minLength": 3,
												"maxLength": 20
											},
											"toUserId": {
												"type": "string",
												"minLength": 1
											},
											"mode": {
												"default": "blind",
												"type": "string",
												"enum": [
													"blind",
													"attended"
												]
											}
										},
										"required": [
											"kind"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "transfer-complete"
											}
										},
										"required": [
											"kind"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "transfer-cancel"
											}
										},
										"required": [
											"kind"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "transfer-voicemail"
											}
										},
										"required": [
											"kind"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "recording"
											},
											"on": {
												"type": "boolean"
											}
										},
										"required": [
											"kind",
											"on"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "hangup"
											}
										},
										"required": [
											"kind"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean"
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/caller-ids": {
			"get": {
				"summary": "Numbers an outbound call can present",
				"tags": [
					"voice"
				],
				"description": "dialer:use. The practice's active Voice numbers (desk-phone lines excluded) with the location each one's routing serves. Without an explicit numberId, POST /voice/calls presents the number routed to the caller's own location, else the practice default.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"numbers": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceCallerId"
											}
										}
									},
									"required": [
										"numbers"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/voicemails": {
			"get": {
				"summary": "The practice's voicemail inbox",
				"tags": [
					"voice"
				],
				"description": "Voicemails newest first with caller identity and heard state, one page at a time — pass nextCursor back as cursor to load older messages. Filter by the number (`numberId`) or every number at a location (`locationId`); archived messages are hidden unless `archived=true`. Playback rides GET /voice/voicemails/:id/audio — the audio IS the call's recording, gated like this inbox.",
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "numberId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "archived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"voicemails": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Voicemail"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"unheardCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"numbers": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoicemailNumber"
											}
										}
									},
									"required": [
										"voicemails",
										"nextCursor",
										"unheardCount",
										"numbers"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/voicemails/{id}/heard": {
			"post": {
				"summary": "Mark a voicemail heard",
				"tags": [
					"voice"
				],
				"description": "Stamped by the first listener (playback marks automatically); replays are write-free.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/voicemails/{id}": {
			"patch": {
				"summary": "Assign, mark unheard, or archive a voicemail",
				"tags": [
					"voice"
				],
				"description": "Mailbox actions on one message: assign it to a colleague (must be a member of the practice — 422 otherwise), flip its heard state, or archive/restore it. Returns the updated row.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"assignedToUserId": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"heard": {
										"type": "boolean"
									},
									"archived": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Voicemail"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/voicemails/{id}/audio": {
			"get": {
				"summary": "Stream a voicemail's audio",
				"tags": [
					"voice"
				],
				"description": "Streams the message's stored MP3 — the same artifact as the call's recording, but gated like the inbox (calling access) rather than dialer:media, so every role that can see a message can hear it; the transcript stays dialer:media. Every access is written to the audit log. 404 once the recording's retention window expired.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"audio/mpeg": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing": {
			"get": {
				"summary": "Routing overview: numbers, their configs, ring groups, closures",
				"tags": [
					"voice"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"numbers": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceRoutingNumber"
											}
										},
										"configs": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceRoutingConfig"
											}
										},
										"ringGroups": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceRingGroup"
											}
										},
										"closures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceClosure"
											}
										}
									},
									"required": [
										"numbers",
										"configs",
										"ringGroups",
										"closures"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}": {
			"put": {
				"summary": "Set how calls to a number route",
				"tags": [
					"voice"
				],
				"description": "Upserts the number's routing config (hours source, open/closed actions, greeting, ring timeout, caller rules). A forward target must be a domestic number outside SmileLine (422 otherwise); a location whose weekly hours are empty cannot be followed (400). Config errors at call time always fail closed to voicemail — a broken menu never drops a patient call.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"hoursMode": {
										"type": "string",
										"enum": [
											"location",
											"always_open",
											"custom"
										]
									},
									"customHours": {
										"anyOf": [
											{
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {}
											},
											{
												"type": "null"
											}
										]
									},
									"timezoneOverride": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									},
									"openAction": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ring"
													},
													"ringGroupId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"onNoAnswer": {
														"oneOf": [
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "ring"
																	},
																	"ringGroupId": {
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	}
																},
																"required": [
																	"kind",
																	"ringGroupId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "voicemail"
																	}
																},
																"required": [
																	"kind"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "forward"
																	},
																	"to": {
																		"type": "string",
																		"minLength": 3,
																		"maxLength": 20
																	},
																	"presentCallerId": {
																		"type": "string",
																		"enum": [
																			"caller",
																			"practice"
																		]
																	}
																},
																"required": [
																	"kind",
																	"to",
																	"presentCallerId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "announce"
																	},
																	"text": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 500
																	}
																},
																"required": [
																	"kind",
																	"text"
																]
															}
														]
													}
												},
												"required": [
													"kind",
													"ringGroupId"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "forward"
													},
													"to": {
														"type": "string",
														"minLength": 3,
														"maxLength": 20
													},
													"presentCallerId": {
														"type": "string",
														"enum": [
															"caller",
															"practice"
														]
													}
												},
												"required": [
													"kind",
													"to",
													"presentCallerId"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "announce"
													},
													"text": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"kind",
													"text"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ai_agent"
													},
													"fallback": {
														"oneOf": [
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "ring"
																	},
																	"ringGroupId": {
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	}
																},
																"required": [
																	"kind",
																	"ringGroupId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "voicemail"
																	}
																},
																"required": [
																	"kind"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "forward"
																	},
																	"to": {
																		"type": "string",
																		"minLength": 3,
																		"maxLength": 20
																	},
																	"presentCallerId": {
																		"type": "string",
																		"enum": [
																			"caller",
																			"practice"
																		]
																	}
																},
																"required": [
																	"kind",
																	"to",
																	"presentCallerId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "announce"
																	},
																	"text": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 500
																	}
																},
																"required": [
																	"kind",
																	"text"
																]
															}
														]
													}
												},
												"required": [
													"kind",
													"fallback"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ivr"
													},
													"prompt": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													},
													"menu": {
														"minItems": 1,
														"maxItems": 10,
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"digit": {
																	"type": "string",
																	"pattern": "^[0-9]$"
																},
																"action": {
																	"oneOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "ring"
																				},
																				"ringGroupId": {
																					"type": "string",
																					"format": "uuid",
																					"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																				}
																			},
																			"required": [
																				"kind",
																				"ringGroupId"
																			]
																		},
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "voicemail"
																				}
																			},
																			"required": [
																				"kind"
																			]
																		},
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "forward"
																				},
																				"to": {
																					"type": "string",
																					"minLength": 3,
																					"maxLength": 20
																				},
																				"presentCallerId": {
																					"type": "string",
																					"enum": [
																						"caller",
																						"practice"
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"to",
																				"presentCallerId"
																			]
																		},
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "announce"
																				},
																				"text": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 500
																				}
																			},
																			"required": [
																				"kind",
																				"text"
																			]
																		}
																	]
																},
																"leadPath": {
																	"type": "boolean"
																}
															},
															"required": [
																"digit",
																"action"
															]
														}
													}
												},
												"required": [
													"kind",
													"prompt",
													"menu"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "voicemail"
													}
												},
												"required": [
													"kind"
												]
											}
										]
									},
									"closedAction": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ring"
													},
													"ringGroupId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"onNoAnswer": {
														"oneOf": [
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "ring"
																	},
																	"ringGroupId": {
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	}
																},
																"required": [
																	"kind",
																	"ringGroupId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "voicemail"
																	}
																},
																"required": [
																	"kind"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "forward"
																	},
																	"to": {
																		"type": "string",
																		"minLength": 3,
																		"maxLength": 20
																	},
																	"presentCallerId": {
																		"type": "string",
																		"enum": [
																			"caller",
																			"practice"
																		]
																	}
																},
																"required": [
																	"kind",
																	"to",
																	"presentCallerId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "announce"
																	},
																	"text": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 500
																	}
																},
																"required": [
																	"kind",
																	"text"
																]
															}
														]
													}
												},
												"required": [
													"kind",
													"ringGroupId"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "forward"
													},
													"to": {
														"type": "string",
														"minLength": 3,
														"maxLength": 20
													},
													"presentCallerId": {
														"type": "string",
														"enum": [
															"caller",
															"practice"
														]
													}
												},
												"required": [
													"kind",
													"to",
													"presentCallerId"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "announce"
													},
													"text": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"kind",
													"text"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ai_agent"
													},
													"fallback": {
														"oneOf": [
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "ring"
																	},
																	"ringGroupId": {
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	}
																},
																"required": [
																	"kind",
																	"ringGroupId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "voicemail"
																	}
																},
																"required": [
																	"kind"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "forward"
																	},
																	"to": {
																		"type": "string",
																		"minLength": 3,
																		"maxLength": 20
																	},
																	"presentCallerId": {
																		"type": "string",
																		"enum": [
																			"caller",
																			"practice"
																		]
																	}
																},
																"required": [
																	"kind",
																	"to",
																	"presentCallerId"
																]
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "announce"
																	},
																	"text": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 500
																	}
																},
																"required": [
																	"kind",
																	"text"
																]
															}
														]
													}
												},
												"required": [
													"kind",
													"fallback"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ivr"
													},
													"prompt": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													},
													"menu": {
														"minItems": 1,
														"maxItems": 10,
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"digit": {
																	"type": "string",
																	"pattern": "^[0-9]$"
																},
																"action": {
																	"oneOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "ring"
																				},
																				"ringGroupId": {
																					"type": "string",
																					"format": "uuid",
																					"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																				}
																			},
																			"required": [
																				"kind",
																				"ringGroupId"
																			]
																		},
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "voicemail"
																				}
																			},
																			"required": [
																				"kind"
																			]
																		},
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "forward"
																				},
																				"to": {
																					"type": "string",
																					"minLength": 3,
																					"maxLength": 20
																				},
																				"presentCallerId": {
																					"type": "string",
																					"enum": [
																						"caller",
																						"practice"
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"to",
																				"presentCallerId"
																			]
																		},
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"const": "announce"
																				},
																				"text": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 500
																				}
																			},
																			"required": [
																				"kind",
																				"text"
																			]
																		}
																	]
																},
																"leadPath": {
																	"type": "boolean"
																}
															},
															"required": [
																"digit",
																"action"
															]
														}
													}
												},
												"required": [
													"kind",
													"prompt",
													"menu"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "voicemail"
													}
												},
												"required": [
													"kind"
												]
											}
										]
									},
									"voicemailGreeting": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"closedGreeting": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"ringTimeoutSec": {
										"type": "integer",
										"minimum": 10,
										"maximum": 60
									},
									"callerRules": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"blocklist": {
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 3,
															"maxLength": 20
														}
													},
													"anonymousToVoicemail": {
														"type": "boolean"
													},
													"knownPatientAction": {
														"anyOf": [
															{
																"oneOf": [
																	{
																		"type": "object",
																		"properties": {
																			"kind": {
																				"type": "string",
																				"const": "ring"
																			},
																			"ringGroupId": {
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			}
																		},
																		"required": [
																			"kind",
																			"ringGroupId"
																		]
																	},
																	{
																		"type": "object",
																		"properties": {
																			"kind": {
																				"type": "string",
																				"const": "voicemail"
																			}
																		},
																		"required": [
																			"kind"
																		]
																	},
																	{
																		"type": "object",
																		"properties": {
																			"kind": {
																				"type": "string",
																				"const": "forward"
																			},
																			"to": {
																				"type": "string",
																				"minLength": 3,
																				"maxLength": 20
																			},
																			"presentCallerId": {
																				"type": "string",
																				"enum": [
																					"caller",
																					"practice"
																				]
																			}
																		},
																		"required": [
																			"kind",
																			"to",
																			"presentCallerId"
																		]
																	},
																	{
																		"type": "object",
																		"properties": {
																			"kind": {
																				"type": "string",
																				"const": "announce"
																			},
																			"text": {
																				"type": "string",
																				"minLength": 1,
																				"maxLength": 500
																			}
																		},
																		"required": [
																			"kind",
																			"text"
																		]
																	}
																]
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"blocklist",
													"anonymousToVoicemail",
													"knownPatientAction"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"hoursMode",
									"openAction",
									"closedAction",
									"ringTimeoutSec"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"config": {
											"$ref": "#/components/schemas/VoiceRoutingConfig"
										}
									},
									"required": [
										"config"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/greeting-audio": {
			"get": {
				"summary": "Whether the number has a recorded greeting",
				"tags": [
					"voice"
				],
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"present": {
											"type": "boolean"
										},
										"updatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"present",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Upload a recorded greeting for the number",
				"tags": [
					"voice"
				],
				"description": "multipart/form-data with one `file` field: an MP3 or WAV of at most 5 MiB (a memory/body bound — a greeting is seconds long). Replaces any earlier recording. The number must already have a routing config (404 otherwise). Callers hear it in place of the spoken voicemail greeting; remove it to go back to the text.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"present": {
											"type": "boolean"
										},
										"updatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"present",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Remove the number's recorded greeting",
				"tags": [
					"voice"
				],
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"present": {
											"type": "boolean"
										},
										"updatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"present",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/greeting-audio/audio": {
			"get": {
				"summary": "Play the number's recorded greeting",
				"tags": [
					"voice"
				],
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"audio/mpeg": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/closures": {
			"post": {
				"summary": "Close a location for a day range",
				"tags": [
					"voice"
				],
				"description": "Adds a closure (a bank holiday, a training day, \"closed today\") for one location, inclusive of both dates. Numbers whose routing follows that location's hours take their closed action on those days, the booking page offers no slots there, and the AI receptionist reads the practice as closed. dialer:manage.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"startsOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"endsOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"spokenText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"locationId",
									"startsOn",
									"endsOn"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"closure": {
											"$ref": "#/components/schemas/VoiceClosure"
										}
									},
									"required": [
										"closure"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/closures/{id}": {
			"delete": {
				"summary": "Remove a closure",
				"tags": [
					"voice"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/backup": {
			"post": {
				"summary": "Set or clear a number's backup",
				"tags": [
					"voice"
				],
				"description": "Stages the number's backup destination: if SmileLine cannot take a call, it is forwarded there — for numbers on SmileLine by the standalone rescue service, and for desk-phone lines by carrier-side on-failure forwarding (Telnyx refuses that config on Call-Control numbers). The backup must be an ordinary domestic phone outside SmileLine that the practice controls; a forwarded call bypasses ring groups, voicemail, recording, AI and call history. 202 — poll the returned operation.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"forwardsTo": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 8,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"forwardsTo"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/raw-line": {
			"post": {
				"summary": "Move a number onto a physical desk phone (raw line)",
				"tags": [
					"voice"
				],
				"description": "Stages the provider change: the number leaves SmileLine entirely — no ring groups, screen pop, voicemail, recording, AI receptionist or call history — and instead rings SIP handsets registered with the line's credentials. Starts inbound-only; outbound activates via emergency registration. 202 — poll the returned operation.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Move a desk-phone number back onto SmileLine",
				"tags": [
					"voice"
				],
				"description": "Stages the ordered teardown: outbound detaches, the number returns to SmileLine call handling (unconfigured, like a new number), and the line's SIP credentials stop working. 202 — poll the returned operation.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/raw-line/rotate": {
			"post": {
				"summary": "Reset a desk-phone line's SIP password",
				"tags": [
					"voice"
				],
				"description": "Stages a password change at the provider. Registered handsets stop ringing until the new password is entered on each of them. 202 — poll the returned operation.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/raw-line/credentials": {
			"get": {
				"summary": "Reveal a desk-phone line's SIP credentials",
				"tags": [
					"voice"
				],
				"description": "Owner-only. Returns the registration triple a handset needs (server, username, password). Every reveal is audit-logged.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"server": {
											"type": "string"
										},
										"username": {
											"type": "string"
										},
										"password": {
											"type": "string"
										}
									},
									"required": [
										"server",
										"username",
										"password"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/raw-line/registration": {
			"get": {
				"summary": "Whether the desk phone is currently registered on its line",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. One live read of the credential connection's SIP registration, so a handset with a mistyped password reads as not registered rather than Live. `unknown` when the provider has not confirmed a state.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"registered",
												"unregistered",
												"failed",
												"unknown"
											]
										},
										"lastRegistrationAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"status",
										"lastRegistrationAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/raw-line/emergency": {
			"post": {
				"summary": "Register emergency calling for a desk-phone line",
				"tags": [
					"voice"
				],
				"description": "Two-way service legally requires emergency dialing, so outbound activates only once this registration is validated at the carrier — until then the line stays inbound-only. Provide the handset's physical address (or an existing validated address id). 202 — poll the returned operation.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"emergencyAddressId": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											}
										},
										"required": [
											"emergencyAddressId"
										]
									},
									{
										"type": "object",
										"properties": {
											"address": {
												"type": "object",
												"properties": {
													"businessName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"firstName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"lastName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"streetAddress": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"extendedAddress": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 200
															},
															{
																"type": "null"
															}
														]
													},
													"locality": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"administrativeArea": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 100
															},
															{
																"type": "null"
															}
														]
													},
													"postalCode": {
														"type": "string",
														"minLength": 1,
														"maxLength": 20
													}
												},
												"required": [
													"businessName",
													"firstName",
													"lastName",
													"streetAddress",
													"locality",
													"postalCode"
												]
											}
										},
										"required": [
											"address"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing/numbers/{numberId}/emergency-location": {
			"patch": {
				"summary": "Assign the location a Voice number serves and register it for emergency calling",
				"tags": [
					"voice"
				],
				"description": "Records the location the number physically serves and, for an active number on SmileLine, stages the carrier's emergency-address registration from that location's address (the same request re-stages a rejected registration once the address is corrected). A pending order or port registers automatically when the number goes live. The location's street address, town and postcode must be complete; US locations also need a state. 202 — poll the returned operation; 200 when the number is not live yet and only the choice was recorded.",
				"parameters": [
					{
						"name": "numberId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "null"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"operationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"required": [
										"operationId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/ring-groups": {
			"post": {
				"summary": "Create or update a ring group",
				"tags": [
					"voice"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"mode": {
										"type": "string",
										"enum": [
											"members",
											"location_staff"
										]
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"memberUserIds": {
										"maxItems": 50,
										"type": "array",
										"items": {
											"type": "string"
										}
									}
								},
								"required": [
									"name",
									"mode"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ringGroup": {
											"$ref": "#/components/schemas/VoiceRingGroup"
										}
									},
									"required": [
										"ringGroup"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/ring-groups/{id}": {
			"delete": {
				"summary": "Delete a ring group",
				"tags": [
					"voice"
				],
				"description": "409 while any routing action still points at it.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer-connections": {
			"get": {
				"summary": "The practice's phone-provider connections",
				"tags": [
					"dialer-connections"
				],
				"description": "One row per provider, with its directory mapping. Capability-token plaintexts are never included — they are shown once, when minted or rotated.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connections": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DialerConnection"
											}
										}
									},
									"required": [
										"connections"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Connect a phone provider",
				"tags": [
					"dialer-connections"
				],
				"description": "Proves the credentials against the vendor before storing anything, then mints both capability tokens. The two plaintexts in this response are the only copies — SmileLine keeps keyed digests. 422 when the vendor rejects the credentials; 502 when it cannot be reached.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"const": "voicestack"
									},
									"username": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"password": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"required": [
									"provider",
									"username",
									"password"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connection": {
											"$ref": "#/components/schemas/DialerConnection"
										},
										"webhookUrl": {
											"type": "string"
										},
										"leadApiUrl": {
											"type": "string"
										}
									},
									"required": [
										"connection",
										"webhookUrl",
										"leadApiUrl"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer-connections/{id}/status": {
			"post": {
				"summary": "Pause, resume or disconnect a phone provider",
				"tags": [
					"dialer-connections"
				],
				"description": "A paused connection stops answering the vendor's lookups and post-call deliveries; already-imported calls stay. Disconnecting is the practice's own off switch — call history is never removed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"active",
											"paused",
											"disconnected"
										]
									}
								},
								"required": [
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connection": {
											"$ref": "#/components/schemas/DialerConnection"
										}
									},
									"required": [
										"connection"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer-connections/{id}/sync": {
			"post": {
				"summary": "Re-read the provider's sites and agents",
				"tags": [
					"dialer-connections"
				],
				"description": "Refreshes the mapping table and auto-maps agents whose vendor email matches a member exactly. Manual mappings are never overwritten. Runs daily on its own too.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connection": {
											"$ref": "#/components/schemas/DialerConnection"
										},
										"autoMappedAgents": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"connection",
										"autoMappedAgents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer-connections/{id}/agents/{agentId}": {
			"post": {
				"summary": "Map a provider agent to a SmileLine member",
				"tags": [
					"dialer-connections"
				],
				"description": "A manual mapping wins over every later automatic pass. Sending no member clears the mapping.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "agentId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"userId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"userId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connection": {
											"$ref": "#/components/schemas/DialerConnection"
										}
									},
									"required": [
										"connection"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer-connections/{id}/tokens": {
			"post": {
				"summary": "Rotate a capability token",
				"tags": [
					"dialer-connections"
				],
				"description": "Mints a replacement and keeps the previous one working for 24 hours, so updating the vendor's configuration is never a race. The plaintext in this response is the only copy.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"token": {
										"type": "string",
										"enum": [
											"webhook",
											"lead-api"
										]
									}
								},
								"required": [
									"token"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"url": {
											"type": "string"
										},
										"connection": {
											"$ref": "#/components/schemas/DialerConnection"
										}
									},
									"required": [
										"url",
										"connection"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer-connections/interest": {
			"post": {
				"summary": "Register interest in a provider SmileLine does not integrate yet",
				"tags": [
					"dialer-connections"
				],
				"description": "Records that this practice wants JustCall or Aircall support. Nothing is connected; the row is the demand signal.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"enum": [
											"justcall",
											"aircall"
										]
									}
								},
								"required": [
									"provider"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connection": {
											"$ref": "#/components/schemas/DialerConnection"
										}
									},
									"required": [
										"connection"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/demo-data": {
			"get": {
				"summary": "Demo data status",
				"tags": [
					"settings"
				],
				"description": "Whether the organization currently holds seeded demo data, with per-entity counts.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DemoDataStatus"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Seed demo data",
				"tags": [
					"settings"
				],
				"description": "Fills the organization with realistic marked sample data — patients in every status, journeys in every pipeline stage, appointments past and future, tasks and timeline activity. Answers 409 when demo data is already present.",
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DemoDataStatus"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Remove demo data",
				"tags": [
					"settings"
				],
				"description": "Deletes an unchanged sample set. If ordinary activity history was added to the sample graph, archives the linked sample records and disables its integrations instead so immutable evidence is preserved. Answers 404 when no demo data is present.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DemoDataStatus"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/demo-data/clinical": {
			"post": {
				"summary": "Add clinical demo data (one step)",
				"tags": [
					"settings"
				],
				"description": "Runs the next step of the v4 clinical top-up on a seeded v3 organization — charts, treatment plans, three months of diaries, notes, ledger, recalls, perio exams, forms and images — and records it, so a repeated call resumes where the last one stopped. Answers 404 outside the stage cell or for a member who is not a platform admin, 409 when nothing is seeded or the top-up is already complete.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DemoClinicalStep"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/audit-log": {
			"get": {
				"summary": "Org activity log",
				"tags": [
					"audit-log"
				],
				"description": "Org-wide audit trail of who changed what, sorted by createdAt DESC with cursor pagination. Owner/manager only. `filters` is URL-encoded JSON (AuditLogFilters); date presets resolve in the practice timezone.",
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "lookups"
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 4000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AuditLogEntry"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"actors": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AuditLogActor"
											}
										},
										"entityTypes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/audit-log/actors": {
			"get": {
				"summary": "People who appear in the activity log",
				"tags": [
					"audit-log"
				],
				"description": "Distinct actors recorded in the org's activity log, newest first, so the actor filter can offer staff who have since left the practice. Bounded; current members come from the bootstrap payload.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AuditLogActor"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/jobs": {
			"get": {
				"summary": "List import & export jobs",
				"tags": [
					"data-transfer"
				],
				"description": "Recent import and export jobs plus the org-wide count of import match candidates awaiting review. Owner/manager only.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TransferJobs"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}": {
			"get": {
				"summary": "Import job detail",
				"tags": [
					"data-transfer"
				],
				"description": "Full wizard state for one import job: mapping, auto-suggestion, a sample of the file, value scan and the latest validation report.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJobDetail"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/mapping": {
			"put": {
				"summary": "Save the column mapping",
				"tags": [
					"data-transfer"
				],
				"description": "Persists the wizard's column/value mapping. Only allowed while the job is in mapping or validated state.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/ImportMapping"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJobDetail"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/scan": {
			"post": {
				"summary": "Scan distinct values",
				"tags": [
					"data-transfer"
				],
				"description": "Streams the uploaded file once and collects the distinct source values of every vocabulary-mapped column (stages, treatments, sources, tags…) for the wizard's value-mapping step.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJobDetail"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/validate": {
			"post": {
				"summary": "Dry-run validation",
				"tags": [
					"data-transfer"
				],
				"description": "Queues an async dry run: coerces every row, checks duplicates and reports per-code error counts without writing. Progress arrives via the transfer.changed org event.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/commit": {
			"post": {
				"summary": "Commit the import",
				"tags": [
					"data-transfer"
				],
				"description": "Queues the actual import. Rows write in batches with a persisted cursor; ambiguous duplicates become match candidates for review. Requires a completed dry run.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/cancel": {
			"post": {
				"summary": "Cancel an import job",
				"tags": [
					"data-transfer"
				],
				"description": "Stops further processing at the next step boundary. Rows already written stay (audit trail); the job records how far it got.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/errors": {
			"get": {
				"summary": "Import row errors",
				"tags": [
					"data-transfer"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ImportRowError"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/candidates": {
			"get": {
				"summary": "Import match candidates",
				"tags": [
					"data-transfer"
				],
				"description": "Rows the duplicate scorer held for human review (score 55–89 against an existing patient).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "state",
						"in": "query",
						"required": false,
						"schema": {
							"default": "suggested",
							"type": "string",
							"enum": [
								"suggested",
								"accepted",
								"rejected"
							]
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ImportMatchCandidate"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/candidates/{candidateId}/accept": {
			"post": {
				"summary": "Accept a match candidate",
				"tags": [
					"data-transfer"
				],
				"description": "Merges the imported row into the matched patient (fills blanks only) and creates its journey/attribution. The row is not duplicated.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "candidateId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/candidates/{candidateId}/reject": {
			"post": {
				"summary": "Reject a match candidate",
				"tags": [
					"data-transfer"
				],
				"description": "Declares the imported row a different person: it is written as a brand-new patient.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "candidateId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/export/{entity}": {
			"get": {
				"summary": "Export an entity as CSV",
				"tags": [
					"data-transfer"
				],
				"description": "Synchronous CSV download (UTF-8 BOM, CRLF), capped at 10,000 rows — larger sets return EXPORT_TOO_LARGE and should use an async export job. Money cells carry the locked uppercase ISO accounting-currency code so a later import cannot reinterpret them in another currency. Patients export via GET /patients/export.",
				"parameters": [
					{
						"name": "entity",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"journeys",
								"appointments",
								"tasks",
								"treatments",
								"tags",
								"lead_sources",
								"lost_reasons",
								"cancellation_reasons",
								"contact_methods",
								"appointment_types"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"text/csv; charset=utf-8": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/exports": {
			"post": {
				"summary": "Start an async export",
				"tags": [
					"data-transfer"
				],
				"description": "Starts the async fallback for an oversized entity CSV export. Money cells carry the locked uppercase ISO accounting-currency code. The artifact expires after 7 days.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"entity": {
										"type": "string",
										"enum": [
											"journeys",
											"appointments",
											"tasks",
											"treatments",
											"tags",
											"lead_sources",
											"lost_reasons",
											"cancellation_reasons",
											"contact_methods",
											"appointment_types"
										]
									}
								},
								"required": [
									"entity"
								],
								"description": "Creates a background CSV export for an entity that exceeds the synchronous row limit."
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ExportJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/exports/{id}": {
			"get": {
				"summary": "Export job status",
				"tags": [
					"data-transfer"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/exports/{id}/download": {
			"get": {
				"summary": "Download an export artifact",
				"tags": [
					"data-transfer"
				],
				"description": "Streams a finished entity CSV from storage. Returns 410 EXPIRED after the artifact's 7-day retention window.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"410": {
						"description": "Gone",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-exports": {
			"post": {
				"summary": "Start a Core Practice Transfer export",
				"tags": [
					"data-transfer"
				],
				"description": "Creates an owner-only, best-effort live migration package. This is not a point-in-time backup; the source practice remains writable and the completed relationship graph is validated before download.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"acknowledgeBestEffort": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"acknowledgeBestEffort"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CoreTransferJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-imports": {
			"post": {
				"summary": "Create a Core Practice Transfer upload",
				"tags": [
					"data-transfer"
				],
				"description": "Creates a private, expiring upload job for an owner importing into a fresh, seed-only practice.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"fileName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 255
									},
									"fileSize": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 83886080
									}
								},
								"required": [
									"fileName",
									"fileSize"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"job": {
											"$ref": "#/components/schemas/CoreTransferJob"
										},
										"partSize": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"maxParts": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"job",
										"partSize",
										"maxParts"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-imports/{id}/parts/{partNumber}": {
			"put": {
				"summary": "Upload a Core Practice Transfer part",
				"tags": [
					"data-transfer"
				],
				"description": "Stores one fixed-size application/octet-stream part as an immutable, digest-verified object. Repeating the same bytes is idempotent; changing an accepted part is rejected.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "partNumber",
						"in": "path",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 10
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/octet-stream": {
							"schema": {
								"type": "string",
								"description": "Binary transfer package part",
								"format": "binary"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"partNumber": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"size": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"partNumber",
										"size"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-imports/{id}/upload-complete": {
			"post": {
				"summary": "Complete and validate a Core Practice Transfer upload",
				"tags": [
					"data-transfer"
				],
				"description": "Composes the exact accepted parts into the transfer package, verifies the destination is seed-only, quarantines it, and queues complete package validation before any CRM rows are written.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CoreTransferJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-jobs/{id}": {
			"get": {
				"summary": "Get a Core Practice Transfer job",
				"tags": [
					"data-transfer"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CoreTransferJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-imports/{id}/commit": {
			"post": {
				"summary": "Commit a validated Core Practice Transfer",
				"tags": [
					"data-transfer"
				],
				"description": "Replaces the destination's seed CRM rows, imports the validated core graph with deterministic destination identifiers, verifies it, and atomically releases quarantine.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CoreTransferJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-jobs/{id}/cancel": {
			"post": {
				"summary": "Cancel or reset a Core Practice Transfer",
				"tags": [
					"data-transfer"
				],
				"description": "Cancels an export or upload. A partially imported destination is cleaned, reseeded, and only then released from quarantine.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CoreTransferJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/core-exports/{id}/download": {
			"get": {
				"summary": "Download a Core Practice Transfer package",
				"tags": [
					"data-transfer"
				],
				"description": "Streams an authenticated migration package from private storage. Packages expire after seven days.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/zip": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"410": {
						"description": "Gone",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads": {
			"get": {
				"summary": "Get native lead-ad setup and exception overview",
				"tags": [
					"lead-ads"
				],
				"description": "Returns provider connectivity, selected accounts/assets, form mappings and bounded exception counts. embed=openAlerts folds in the unresolved managed-campaign alerts envelope (GET /ads/alerts). Credentials, provider cursors and raw provider payloads are never returned.",
				"parameters": [
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "openAlerts"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdsOverview"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/oauth/{provider}/start": {
			"post": {
				"summary": "Start a provider OAuth connection",
				"tags": [
					"lead-ads"
				],
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "googleCustomerId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(?:\\d{10}|\\d{3}-\\d{3}-\\d{4})$"
						}
					},
					{
						"name": "googleLoginCustomerId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(?:\\d{10}|\\d{3}-\\d{3}-\\d{4})$"
						}
					},
					{
						"name": "returnTo",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2048
						}
					},
					{
						"name": "purpose",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"ads_management"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"authorizeUrl": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"authorizeUrl"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/chatgpt/connect": {
			"post": {
				"summary": "Connect ChatGPT Ads with an Ads API key",
				"tags": [
					"lead-ads"
				],
				"description": "Validates the key against the OpenAI Ads API before anything is written, then stores it encrypted as the practice's ChatGPT connection and queues account discovery. Pasting a key again rotates it; a key for a different ad account discards the previous account's provisioned conversion resources.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"apiKey": {
										"type": "string",
										"minLength": 1
									}
								},
								"required": [
									"apiKey"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/connections/{id}/sync": {
			"post": {
				"summary": "Sync provider accounts, forms, campaigns and reporting",
				"tags": [
					"lead-ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/connections/{id}/disconnect": {
			"post": {
				"summary": "Disconnect a provider grant",
				"tags": [
					"lead-ads"
				],
				"description": "Immediately removes the local live capability, increments its generation fence and durably schedules remote webhook/subscription cleanup. Idempotent.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/accounts/{id}": {
			"patch": {
				"summary": "Select an external account and set its intake defaults",
				"tags": [
					"lead-ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"active": {
										"type": "boolean"
									},
									"defaultLocationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultLeadSourceId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultOwnerId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 255
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdAccount"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/forms/{id}/mapping": {
			"put": {
				"summary": "Replace and validate a lead-form mapping",
				"tags": [
					"lead-ads"
				],
				"description": "Before enabling, validates question ids, contact coverage, tenant-owned defaults, treatment answer mappings and explicit per-channel consent evidence.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"mapping": {
										"$ref": "#/components/schemas/LeadAdFormMapping"
									},
									"enabled": {
										"type": "boolean"
									}
								},
								"required": [
									"mapping",
									"enabled"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdForm"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/forms/{id}/test": {
			"post": {
				"summary": "Arm receipt of a provider test lead for a mapped form",
				"tags": [
					"lead-ads"
				],
				"description": "Marks the mapped form as awaiting a test sent from the provider's own testing tool. Test leads never materialize CRM patients, journeys, activities or automation.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"pending",
												"passed",
												"failed"
											]
										},
										"form": {
											"$ref": "#/components/schemas/LeadAdForm"
										}
									},
									"required": [
										"status",
										"form"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/google-ads/webhook-credential/rotate": {
			"post": {
				"summary": "Rotate the Google lead-form webhook credential",
				"tags": [
					"lead-ads"
				],
				"description": "Returns the new plaintext credential once. Normal responses retain only its digest and version.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"webhookCredential": {
											"type": "string",
											"minLength": 32,
											"maxLength": 256
										},
										"webhookUrl": {
											"type": "string",
											"format": "uri"
										},
										"credentialVersion": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"webhookCredential",
										"webhookUrl",
										"credentialVersion"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/submissions": {
			"get": {
				"summary": "List native lead-ad submissions and exceptions",
				"tags": [
					"lead-ads"
				],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "provider",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"pending",
								"processing",
								"captured",
								"needs_mapping",
								"needs_identity",
								"invalid",
								"retrying",
								"failed",
								"ignored",
								"test"
							]
						}
					},
					{
						"name": "accountId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "formId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "historical",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "test",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LeadAdSubmission"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/submissions/{id}/replay": {
			"post": {
				"summary": "Replay a durable lead-ad submission",
				"tags": [
					"lead-ads"
				],
				"description": "Requeues the existing staged row under its provider identity aliases; it never creates a second submission or bypasses current form validation.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdSubmission"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/submissions/{id}/resolve-identity": {
			"post": {
				"summary": "Resolve a lead submission as create, attach or ignore",
				"tags": [
					"lead-ads"
				],
				"description": "The decision applies only to this durable submission. It never creates a reusable email/phone-to-patient alias; normal contact matching remains authoritative for future leads.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"resolution": {
												"type": "string",
												"const": "create"
											}
										},
										"required": [
											"resolution"
										]
									},
									{
										"type": "object",
										"properties": {
											"resolution": {
												"type": "string",
												"const": "attach"
											},
											"patientId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"resolution",
											"patientId"
										]
									},
									{
										"type": "object",
										"properties": {
											"resolution": {
												"type": "string",
												"const": "ignore"
											}
										},
										"required": [
											"resolution"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdSubmission"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/connections/{id}/backfills": {
			"post": {
				"summary": "Create a bounded provider lead backfill",
				"tags": [
					"lead-ads"
				],
				"description": "Imports historical leads for a connection, one enabled account or one enabled form within the provider's retention window. TikTok direct-message leads arrive live only (the provider offers no export), so a direct-message form answers 409 TIKTOK_DM_BACKFILL_UNAVAILABLE and account-wide imports skip it.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"accountId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"formId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"fromAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"toAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									}
								},
								"required": [
									"fromAt",
									"toAt"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdBackfill"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/backfills/{id}": {
			"get": {
				"summary": "Get lead-ad backfill status",
				"tags": [
					"lead-ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdBackfill"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/{provider}/conversions": {
			"get": {
				"summary": "Get conversion-feedback setup and checklist",
				"tags": [
					"lead-ads"
				],
				"description": "The derived checklist a platform page renders: connection, scopes, auto-provisioned resources, verification and health, plus bounded delivery counts. Never gated on the SEO & Ads add-on.",
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ConversionFeedback"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Enable or disable conversion feedback",
				"tags": [
					"lead-ads"
				],
				"description": "First enable stamps the backfill fence. resourceSelection records the explicit account-bound reuse/create choices and queues idempotent setup. Google repairs compatible upload goals; Meta and TikTok reuse selected resources or create new ones. Provider permissions, category review and restricted resources may require action in the platform. A grant without the required scopes answers with reauthRequired.",
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"resourceSelection": {
										"type": "object",
										"properties": {
											"requestId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"accountId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"choices": {
												"type": "object",
												"properties": {
													"lead": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 512
															},
															{
																"type": "null"
															}
														]
													},
													"booked": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 512
															},
															{
																"type": "null"
															}
														]
													},
													"won": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 512
															},
															{
																"type": "null"
															}
														]
													},
													"dataset": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 512
															},
															{
																"type": "null"
															}
														]
													},
													"pixel": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 512
															},
															{
																"type": "null"
															}
														]
													},
													"crm": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 128
															},
															{
																"type": "null"
															}
														]
													}
												},
												"additionalProperties": false
											}
										},
										"required": [
											"requestId",
											"accountId",
											"choices"
										]
									},
									"sendValues": {
										"type": "boolean"
									},
									"testEventCode": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									},
									"metaAdAccountId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"metaDatasetId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 512
											},
											{
												"type": "null"
											}
										]
									},
									"tiktokCrmEventSetId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 128
											},
											{
												"type": "null"
											}
										]
									},
									"tiktokAdvertiserAccountId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"enabled",
									"sendValues"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ConversionFeedback"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/tiktok/conversions/crm-event-sets": {
			"get": {
				"summary": "List TikTok CRM Event Sets",
				"tags": [
					"lead-ads"
				],
				"description": "Lists CRM Event Sets visible to the selected TikTok advertiser so an owner can bind native-lead lifecycle feedback to the exact provider resource.",
				"parameters": [
					{
						"name": "advertiserAccountId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TikTokCrmEventSets"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/meta/conversions/crm-datasets": {
			"get": {
				"summary": "List Meta CRM datasets",
				"tags": [
					"lead-ads"
				],
				"description": "Lists dedicated CRM datasets visible to one active Meta ad account. Generic web Pixels and unavailable datasets are excluded.",
				"parameters": [
					{
						"name": "accountId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MetaCrmDatasets"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/{provider}/conversions/resources": {
			"get": {
				"summary": "Choose conversion resources",
				"tags": [
					"lead-ads"
				],
				"description": "Inspect the active account's goals, CRM datasets and Pixels before choosing existing resources or creating new ones. Incompatible resources remain visible but cannot be selected.",
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "accountId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accounts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										},
										"groups": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"slot": {
														"type": "string",
														"enum": [
															"lead",
															"booked",
															"won",
															"dataset",
															"pixel",
															"crm"
														]
													},
													"selectedId": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"options": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string"
																},
																"name": {
																	"type": "string"
																},
																"compatible": {
																	"type": "boolean"
																}
															},
															"required": [
																"id",
																"name",
																"compatible"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"slot",
													"selectedId",
													"options"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"accountId",
										"accounts",
										"groups"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/agreements": {
			"get": {
				"summary": "Legal agreements in place for the practice",
				"tags": [
					"agreements"
				],
				"description": "Per document (terms, privacy, DPA): the published version, whether the practice is up to date, the latest acceptance and the full acceptance history (who agreed, when). Owner/manager only.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AgreementList"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/agreements/pending": {
			"get": {
				"summary": "Agreements the caller still has to accept",
				"tags": [
					"agreements"
				],
				"description": "User-level documents (terms, privacy) pending for the caller, plus org-level documents (DPA) pending for the active organization. Used by onboarding and the re-accept gate.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AgreementsPending"
								}
							}
						}
					}
				}
			}
		},
		"/agreements/accept": {
			"post": {
				"summary": "Record acceptance of legal agreements",
				"tags": [
					"agreements"
				],
				"description": "Appends minimized acceptance records for the given documents at their current published version (stale versions are rejected). Terms and privacy bind the calling user as account holder; the DPA binds the active organization, records organization-owner signing capacity, and requires the owner role. IP address and user agent are not attached to the acceptance.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"agreements": {
										"minItems": 1,
										"maxItems": 6,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"type": {
													"type": "string",
													"enum": [
														"terms",
														"privacy",
														"dpa",
														"baa",
														"eu-addendum",
														"us-comms"
													]
												},
												"version": {
													"type": "string",
													"minLength": 1,
													"maxLength": 20
												}
											},
											"required": [
												"type",
												"version"
											]
										}
									}
								},
								"required": [
									"agreements"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AgreementsAccepted"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatments": {
			"get": {
				"summary": "List treatments",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Treatment"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a treatment",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"slug": {
										"description": "Derived from name when omitted; unique per organization.",
										"type": "string",
										"minLength": 1,
										"maxLength": 80,
										"pattern": "^[a-z0-9-]+$"
									},
									"name": {
										"type": "string",
										"minLength": 1
									},
									"patientFacingName": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"category": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultPriceCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"depositAmountCents": {
										"description": "Booking-deposit override; null falls back to the org default.",
										"anyOf": [
											{
												"type": "integer",
												"minimum": 100,
												"maximum": 500000
											},
											{
												"type": "null"
											}
										]
									},
									"defaultDurationMin": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"consultationPractitionerIds": {
										"description": "Practitioners who take this treatment's consultations; empty = everyone at the site. Every id must be an active practitioner of the organization.",
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"defaultPipelineId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"pitchDoc": {
										"anyOf": [
											{},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Treatment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatments/{id}": {
			"patch": {
				"summary": "Update a treatment",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"slug": {
										"description": "Derived from name when omitted; unique per organization.",
										"type": "string",
										"minLength": 1,
										"maxLength": 80,
										"pattern": "^[a-z0-9-]+$"
									},
									"name": {
										"type": "string",
										"minLength": 1
									},
									"patientFacingName": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"category": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"defaultPriceCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"depositAmountCents": {
										"description": "Booking-deposit override; null falls back to the org default.",
										"anyOf": [
											{
												"type": "integer",
												"minimum": 100,
												"maximum": 500000
											},
											{
												"type": "null"
											}
										]
									},
									"defaultDurationMin": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"consultationPractitionerIds": {
										"description": "Practitioners who take this treatment's consultations; empty = everyone at the site. Every id must be an active practitioner of the organization.",
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"defaultPipelineId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"pitchDoc": {
										"anyOf": [
											{},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Treatment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatments/{id}/archive": {
			"post": {
				"summary": "Archive a treatment",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Treatment"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatments/{id}/restore": {
			"post": {
				"summary": "Restore an archived treatment",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Treatment"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatments/reorder": {
			"post": {
				"summary": "Reorder treatments",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Treatment"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lead-sources": {
			"get": {
				"summary": "List lead sources",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LeadSource"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a lead source",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"channel": {
										"type": "string",
										"enum": [
											"paid_search",
											"paid_social",
											"organic_search",
											"social",
											"referral_website",
											"referral_friend",
											"referral_practice",
											"existing_patient",
											"email",
											"chat",
											"direct",
											"phone",
											"walk_in",
											"print",
											"other",
											"unknown",
											"ai",
											"paid_ai"
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadSource"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lead-sources/{id}": {
			"patch": {
				"summary": "Update a lead source",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"channel": {
										"type": "string",
										"enum": [
											"paid_search",
											"paid_social",
											"organic_search",
											"social",
											"referral_website",
											"referral_friend",
											"referral_practice",
											"existing_patient",
											"email",
											"chat",
											"direct",
											"phone",
											"walk_in",
											"print",
											"other",
											"unknown",
											"ai",
											"paid_ai"
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadSource"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lead-sources/{id}/archive": {
			"post": {
				"summary": "Archive a lead source",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadSource"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lead-sources/{id}/restore": {
			"post": {
				"summary": "Restore an archived lead source",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadSource"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lead-sources/reorder": {
			"post": {
				"summary": "Reorder lead sources",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LeadSource"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lost-reasons": {
			"get": {
				"summary": "List lost reasons",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LostReason"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a lost reason",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"marksJunk": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"label"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LostReason"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lost-reasons/{id}": {
			"patch": {
				"summary": "Update a lost reason",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"marksJunk": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LostReason"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lost-reasons/{id}/archive": {
			"post": {
				"summary": "Archive a lost reason",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LostReason"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lost-reasons/{id}/restore": {
			"post": {
				"summary": "Restore an archived lost reason",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LostReason"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/lost-reasons/reorder": {
			"post": {
				"summary": "Reorder lost reasons",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LostReason"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/cancellation-reasons": {
			"get": {
				"summary": "List cancellation reasons",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CancellationReason"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a cancellation reason",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"type": {
										"type": "string",
										"enum": [
											"cancelled",
											"no_show"
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"label"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CancellationReason"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/cancellation-reasons/{id}": {
			"patch": {
				"summary": "Update a cancellation reason",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"type": {
										"type": "string",
										"enum": [
											"cancelled",
											"no_show"
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CancellationReason"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/cancellation-reasons/{id}/archive": {
			"post": {
				"summary": "Archive a cancellation reason",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CancellationReason"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/cancellation-reasons/{id}/restore": {
			"post": {
				"summary": "Restore an archived cancellation reason",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CancellationReason"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/cancellation-reasons/reorder": {
			"post": {
				"summary": "Reorder cancellation reasons",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CancellationReason"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/contact-methods": {
			"get": {
				"summary": "List contact methods",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ContactMethod"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a contact method",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"label"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactMethod"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/contact-methods/{id}": {
			"patch": {
				"summary": "Update a contact method",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactMethod"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/contact-methods/{id}/archive": {
			"post": {
				"summary": "Archive a contact method",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactMethod"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/contact-methods/{id}/restore": {
			"post": {
				"summary": "Restore an archived contact method",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactMethod"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/contact-methods/reorder": {
			"post": {
				"summary": "Reorder contact methods",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ContactMethod"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/tags": {
			"get": {
				"summary": "List tags",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Tag"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a tag",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"label"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Tag"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/tags/{id}": {
			"patch": {
				"summary": "Update a tag",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Tag"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/tags/{id}/archive": {
			"post": {
				"summary": "Archive a tag",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Tag"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/tags/{id}/restore": {
			"post": {
				"summary": "Restore an archived tag",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Tag"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/tags/reorder": {
			"post": {
				"summary": "Reorder tags",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Tag"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/appointment-types": {
			"get": {
				"summary": "List appointment types",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AppointmentType"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a appointment type",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"durationMin": {
										"type": "integer",
										"minimum": 5,
										"maximum": 9007199254740991
									},
									"bufferBeforeMin": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"bufferAfterMin": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"minNoticeMin": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"requiresConfirmation": {
										"type": "boolean"
									},
									"isOnlineBookable": {
										"type": "boolean"
									},
									"depositAmountCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 100,
												"maximum": 500000
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AppointmentType"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/appointment-types/{id}": {
			"patch": {
				"summary": "Update a appointment type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"durationMin": {
										"type": "integer",
										"minimum": 5,
										"maximum": 9007199254740991
									},
									"bufferBeforeMin": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"bufferAfterMin": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"minNoticeMin": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"requiresConfirmation": {
										"type": "boolean"
									},
									"isOnlineBookable": {
										"type": "boolean"
									},
									"depositAmountCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 100,
												"maximum": 500000
											},
											{
												"type": "null"
											}
										]
									},
									"defaultTreatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AppointmentType"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/appointment-types/{id}/archive": {
			"post": {
				"summary": "Archive a appointment type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AppointmentType"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/appointment-types/{id}/restore": {
			"post": {
				"summary": "Restore an archived appointment type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AppointmentType"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/appointment-types/reorder": {
			"post": {
				"summary": "Reorder appointment types",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AppointmentType"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/locations": {
			"get": {
				"summary": "List locations",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Location"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a location",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"timezone": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"phone": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"email": {
										"anyOf": [
											{
												"type": "string",
												"format": "email",
												"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"province": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"country": {
										"type": "string",
										"enum": [
											"AD",
											"AE",
											"AF",
											"AG",
											"AI",
											"AL",
											"AM",
											"AO",
											"AQ",
											"AR",
											"AS",
											"AT",
											"AU",
											"AW",
											"AX",
											"AZ",
											"BA",
											"BB",
											"BD",
											"BE",
											"BF",
											"BG",
											"BH",
											"BI",
											"BJ",
											"BL",
											"BM",
											"BN",
											"BO",
											"BQ",
											"BR",
											"BS",
											"BT",
											"BV",
											"BW",
											"BY",
											"BZ",
											"CA",
											"CC",
											"CD",
											"CF",
											"CG",
											"CH",
											"CI",
											"CK",
											"CL",
											"CM",
											"CN",
											"CO",
											"CR",
											"CU",
											"CV",
											"CW",
											"CX",
											"CY",
											"CZ",
											"DE",
											"DJ",
											"DK",
											"DM",
											"DO",
											"DZ",
											"EC",
											"EE",
											"EG",
											"EH",
											"ER",
											"ES",
											"ET",
											"FI",
											"FJ",
											"FK",
											"FM",
											"FO",
											"FR",
											"GA",
											"GB",
											"GD",
											"GE",
											"GF",
											"GG",
											"GH",
											"GI",
											"GL",
											"GM",
											"GN",
											"GP",
											"GQ",
											"GR",
											"GS",
											"GT",
											"GU",
											"GW",
											"GY",
											"HK",
											"HM",
											"HN",
											"HR",
											"HT",
											"HU",
											"ID",
											"IE",
											"IL",
											"IM",
											"IN",
											"IO",
											"IQ",
											"IR",
											"IS",
											"IT",
											"JE",
											"JM",
											"JO",
											"JP",
											"KE",
											"KG",
											"KH",
											"KI",
											"KM",
											"KN",
											"KP",
											"KR",
											"KW",
											"KY",
											"KZ",
											"LA",
											"LB",
											"LC",
											"LI",
											"LK",
											"LR",
											"LS",
											"LT",
											"LU",
											"LV",
											"LY",
											"MA",
											"MC",
											"MD",
											"ME",
											"MF",
											"MG",
											"MH",
											"MK",
											"ML",
											"MM",
											"MN",
											"MO",
											"MP",
											"MQ",
											"MR",
											"MS",
											"MT",
											"MU",
											"MV",
											"MW",
											"MX",
											"MY",
											"MZ",
											"NA",
											"NC",
											"NE",
											"NF",
											"NG",
											"NI",
											"NL",
											"NO",
											"NP",
											"NR",
											"NU",
											"NZ",
											"OM",
											"PA",
											"PE",
											"PF",
											"PG",
											"PH",
											"PK",
											"PL",
											"PM",
											"PN",
											"PR",
											"PS",
											"PT",
											"PW",
											"PY",
											"QA",
											"RE",
											"RO",
											"RS",
											"RU",
											"RW",
											"SA",
											"SB",
											"SC",
											"SD",
											"SE",
											"SG",
											"SH",
											"SI",
											"SJ",
											"SK",
											"SL",
											"SM",
											"SN",
											"SO",
											"SR",
											"SS",
											"ST",
											"SV",
											"SX",
											"SY",
											"SZ",
											"TC",
											"TD",
											"TF",
											"TG",
											"TH",
											"TJ",
											"TK",
											"TL",
											"TM",
											"TN",
											"TO",
											"TR",
											"TT",
											"TV",
											"TW",
											"TZ",
											"UA",
											"UG",
											"UM",
											"US",
											"UY",
											"UZ",
											"VA",
											"VC",
											"VE",
											"VG",
											"VI",
											"VN",
											"VU",
											"WF",
											"WS",
											"YE",
											"YT",
											"ZA",
											"ZM",
											"ZW"
										]
									},
									"subdivision": {
										"type": "string",
										"maxLength": 8
									},
									"requireOperatory": {
										"type": "boolean"
									},
									"coordinates": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"latitude": {
														"type": "number",
														"minimum": -90,
														"maximum": 90
													},
													"longitude": {
														"type": "number",
														"minimum": -180,
														"maximum": 180
													}
												},
												"required": [
													"latitude",
													"longitude"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"openingHours": {
										"type": "object",
										"propertyNames": {
											"type": "string",
											"enum": [
												"mon",
												"tue",
												"wed",
												"thu",
												"fri",
												"sat",
												"sun"
											]
										},
										"additionalProperties": {
											"maxItems": 4,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"open": {
														"type": "string",
														"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
													},
													"close": {
														"type": "string",
														"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
													}
												},
												"required": [
													"open",
													"close"
												]
											}
										}
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Location"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/locations/{id}": {
			"patch": {
				"summary": "Update a location",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1
									},
									"timezone": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"phone": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"email": {
										"anyOf": [
											{
												"type": "string",
												"format": "email",
												"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"province": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"country": {
										"type": "string",
										"enum": [
											"AD",
											"AE",
											"AF",
											"AG",
											"AI",
											"AL",
											"AM",
											"AO",
											"AQ",
											"AR",
											"AS",
											"AT",
											"AU",
											"AW",
											"AX",
											"AZ",
											"BA",
											"BB",
											"BD",
											"BE",
											"BF",
											"BG",
											"BH",
											"BI",
											"BJ",
											"BL",
											"BM",
											"BN",
											"BO",
											"BQ",
											"BR",
											"BS",
											"BT",
											"BV",
											"BW",
											"BY",
											"BZ",
											"CA",
											"CC",
											"CD",
											"CF",
											"CG",
											"CH",
											"CI",
											"CK",
											"CL",
											"CM",
											"CN",
											"CO",
											"CR",
											"CU",
											"CV",
											"CW",
											"CX",
											"CY",
											"CZ",
											"DE",
											"DJ",
											"DK",
											"DM",
											"DO",
											"DZ",
											"EC",
											"EE",
											"EG",
											"EH",
											"ER",
											"ES",
											"ET",
											"FI",
											"FJ",
											"FK",
											"FM",
											"FO",
											"FR",
											"GA",
											"GB",
											"GD",
											"GE",
											"GF",
											"GG",
											"GH",
											"GI",
											"GL",
											"GM",
											"GN",
											"GP",
											"GQ",
											"GR",
											"GS",
											"GT",
											"GU",
											"GW",
											"GY",
											"HK",
											"HM",
											"HN",
											"HR",
											"HT",
											"HU",
											"ID",
											"IE",
											"IL",
											"IM",
											"IN",
											"IO",
											"IQ",
											"IR",
											"IS",
											"IT",
											"JE",
											"JM",
											"JO",
											"JP",
											"KE",
											"KG",
											"KH",
											"KI",
											"KM",
											"KN",
											"KP",
											"KR",
											"KW",
											"KY",
											"KZ",
											"LA",
											"LB",
											"LC",
											"LI",
											"LK",
											"LR",
											"LS",
											"LT",
											"LU",
											"LV",
											"LY",
											"MA",
											"MC",
											"MD",
											"ME",
											"MF",
											"MG",
											"MH",
											"MK",
											"ML",
											"MM",
											"MN",
											"MO",
											"MP",
											"MQ",
											"MR",
											"MS",
											"MT",
											"MU",
											"MV",
											"MW",
											"MX",
											"MY",
											"MZ",
											"NA",
											"NC",
											"NE",
											"NF",
											"NG",
											"NI",
											"NL",
											"NO",
											"NP",
											"NR",
											"NU",
											"NZ",
											"OM",
											"PA",
											"PE",
											"PF",
											"PG",
											"PH",
											"PK",
											"PL",
											"PM",
											"PN",
											"PR",
											"PS",
											"PT",
											"PW",
											"PY",
											"QA",
											"RE",
											"RO",
											"RS",
											"RU",
											"RW",
											"SA",
											"SB",
											"SC",
											"SD",
											"SE",
											"SG",
											"SH",
											"SI",
											"SJ",
											"SK",
											"SL",
											"SM",
											"SN",
											"SO",
											"SR",
											"SS",
											"ST",
											"SV",
											"SX",
											"SY",
											"SZ",
											"TC",
											"TD",
											"TF",
											"TG",
											"TH",
											"TJ",
											"TK",
											"TL",
											"TM",
											"TN",
											"TO",
											"TR",
											"TT",
											"TV",
											"TW",
											"TZ",
											"UA",
											"UG",
											"UM",
											"US",
											"UY",
											"UZ",
											"VA",
											"VC",
											"VE",
											"VG",
											"VI",
											"VN",
											"VU",
											"WF",
											"WS",
											"YE",
											"YT",
											"ZA",
											"ZM",
											"ZW"
										]
									},
									"subdivision": {
										"type": "string",
										"maxLength": 8
									},
									"requireOperatory": {
										"type": "boolean"
									},
									"coordinates": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"latitude": {
														"type": "number",
														"minimum": -90,
														"maximum": 90
													},
													"longitude": {
														"type": "number",
														"minimum": -180,
														"maximum": 180
													}
												},
												"required": [
													"latitude",
													"longitude"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"openingHours": {
										"type": "object",
										"propertyNames": {
											"type": "string",
											"enum": [
												"mon",
												"tue",
												"wed",
												"thu",
												"fri",
												"sat",
												"sun"
											]
										},
										"additionalProperties": {
											"maxItems": 4,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"open": {
														"type": "string",
														"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
													},
													"close": {
														"type": "string",
														"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
													}
												},
												"required": [
													"open",
													"close"
												]
											}
										}
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Location"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/locations/{id}/archive": {
			"post": {
				"summary": "Archive a location",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Location"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/locations/{id}/restore": {
			"post": {
				"summary": "Restore an archived location",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Location"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/locations/reorder": {
			"post": {
				"summary": "Reorder locations",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Location"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/operatories": {
			"get": {
				"summary": "List operatories",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Operatory"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a operatory",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string",
										"minLength": 1
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"locationId",
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Operatory"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/operatories/{id}": {
			"patch": {
				"summary": "Update a operatory",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string",
										"minLength": 1
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Operatory"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/operatories/{id}/archive": {
			"post": {
				"summary": "Archive a operatory",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Operatory"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/operatories/{id}/restore": {
			"post": {
				"summary": "Restore an archived operatory",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Operatory"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/operatories/reorder": {
			"post": {
				"summary": "Reorder operatories",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Operatory"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/team": {
			"get": {
				"summary": "The Team page in one read",
				"tags": [
					"settings"
				],
				"description": "Members with their account, invitations with email delivery state, member locations and the locations to assign — everything the Team page renders. Readable by every member; the mutations stay on the better-auth organization routes.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"members": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"userId": {
														"type": "string"
													},
													"role": {
														"type": "string"
													},
													"defaultWorkspace": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"crm",
																	"pms"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"suspendedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"user": {
														"type": "object",
														"properties": {
															"name": {
																"type": "string"
															},
															"email": {
																"type": "string"
															},
															"image": {
																"anyOf": [
																	{
																		"type": "string"
																	},
																	{
																		"type": "null"
																	}
																]
															}
														},
														"required": [
															"name",
															"email",
															"image"
														],
														"additionalProperties": false
													}
												},
												"required": [
													"id",
													"userId",
													"role",
													"defaultWorkspace",
													"suspendedAt",
													"createdAt",
													"user"
												],
												"additionalProperties": false
											}
										},
										"invitations": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"email": {
														"type": "string"
													},
													"role": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"status": {
														"type": "string"
													},
													"expiresAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"inviterId": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"email",
													"role",
													"status",
													"expiresAt",
													"inviterId"
												],
												"additionalProperties": false
											}
										},
										"publications": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InvitationPublication"
											}
										},
										"memberLocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/MemberLocation"
											}
										},
										"locations": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										},
										"practitioners": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"displayName": {
														"type": "string"
													},
													"userId": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"displayName",
													"userId"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"organizationId",
										"members",
										"invitations",
										"publications",
										"memberLocations",
										"locations",
										"practitioners"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/team/member-locations": {
			"get": {
				"summary": "Which locations each member works at",
				"tags": [
					"settings"
				],
				"description": "One row per (member, location) assignment; members without a location are absent. Readable by every member, like the team list.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/MemberLocation"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/team/members/{userId}/location": {
			"put": {
				"summary": "Set the locations a member works at",
				"tags": [
					"settings"
				],
				"description": "Replaces the set of sites a member works at (an empty list clears it) — what a \"location's staff\" ring group rings. Gated like a role change. 404 for a user who is not a member of the practice or a location the practice does not own; 409 for an archived location.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationIds": {
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"locationIds"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"locationIds": {
											"type": "array",
											"items": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										}
									},
									"required": [
										"userId",
										"locationIds"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practitioners": {
			"get": {
				"summary": "List practitioners",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Practitioner"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a practitioner",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"displayName": {
										"type": "string",
										"minLength": 1
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"role": {
										"type": "string",
										"enum": [
											"dentist",
											"hygienist",
											"therapist",
											"nurse",
											"other"
										]
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"displayName"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Practitioner"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practitioners/{id}": {
			"patch": {
				"summary": "Update a practitioner",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"displayName": {
										"type": "string",
										"minLength": 1
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"role": {
										"type": "string",
										"enum": [
											"dentist",
											"hygienist",
											"therapist",
											"nurse",
											"other"
										]
									},
									"color": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Practitioner"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practitioners/{id}/archive": {
			"post": {
				"summary": "Archive a practitioner",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Practitioner"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practitioners/{id}/restore": {
			"post": {
				"summary": "Restore an archived practitioner",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Practitioner"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/r/state": {
			"post": {
				"summary": "Get neutral public review-request state",
				"tags": [
					"reputation-public"
				],
				"description": "Accepts the bearer token in a bounded request body so it never enters request-URL logs. Contains practice branding and choice state only—never patient or request identity. Every unusable token returns the same inactive shape.",
				"security": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"token": {
										"type": "string",
										"minLength": 32,
										"maxLength": 256
									}
								},
								"required": [
									"token"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"active",
												"inactive"
											]
										},
										"practice": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"name": {
															"type": "string"
														},
														"brandColor": {
															"anyOf": [
																{
																	"type": "string"
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"name",
														"brandColor"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"locale": {
											"type": "string",
											"enum": [
												"en",
												"it"
											]
										},
										"feedbackSubmitted": {
											"type": "boolean"
										}
									},
									"required": [
										"status",
										"practice",
										"locale",
										"feedbackSubmitted"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/r/feedback": {
			"post": {
				"summary": "Submit private patient feedback",
				"tags": [
					"reputation-public"
				],
				"security": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"token": {
										"type": "string",
										"minLength": 32,
										"maxLength": 256
									},
									"score": {
										"type": "integer",
										"minimum": 1,
										"maximum": 5
									},
									"comment": {
										"type": "string",
										"maxLength": 2000
									},
									"anonymousToStaff": {
										"default": false,
										"type": "boolean"
									}
								},
								"required": [
									"token",
									"score"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										},
										"feedbackSubmitted": {
											"type": "boolean",
											"const": true
										},
										"recoveryCreated": {
											"type": "boolean"
										}
									},
									"required": [
										"ok",
										"feedbackSubmitted",
										"recoveryCreated"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/r/review": {
			"post": {
				"summary": "Choose the public Google review option",
				"tags": [
					"reputation-public"
				],
				"description": "Idempotently stamps permanent future-outreach suppression before returning a validated Google-owned HTTPS URL. POST avoids browser/link-prefetch side effects.",
				"security": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"token": {
										"type": "string",
										"minLength": 32,
										"maxLength": 256
									}
								},
								"required": [
									"token"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"url": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"url"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation": {
			"get": {
				"summary": "Get the Reputation page envelope",
				"tags": [
					"reputation"
				],
				"description": "One bounded first-load response: metrics, setup/connectivity and the first page of requests, private feedback, Google reviews and reply jobs. Analyst responses are aggregate-only; every operational/setup collection is empty.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationPage"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/settings": {
			"put": {
				"summary": "Update Reputation settings and locale-aware template bindings",
				"tags": [
					"reputation"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"initialDelayHours": {
										"type": "integer",
										"minimum": 0,
										"maximum": 72
									},
									"reminderEnabled": {
										"type": "boolean"
									},
									"reminderDelayHours": {
										"type": "integer",
										"minimum": 24,
										"maximum": 336
									},
									"cooldownDays": {
										"type": "integer",
										"minimum": 30,
										"maximum": 365
									},
									"privateFeedbackThreshold": {
										"type": "integer",
										"minimum": 1,
										"maximum": 5
									},
									"enabledChannels": {
										"minItems": 1,
										"maxItems": 3,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"email",
												"sms",
												"whatsapp"
											]
										}
									},
									"defaultLocale": {
										"type": "string",
										"enum": [
											"en",
											"it"
										]
									},
									"templateBindings": {
										"maxItems": 12,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"type": "string",
													"enum": [
														"initial",
														"reminder"
													]
												},
												"channel": {
													"type": "string",
													"enum": [
														"email",
														"sms",
														"whatsapp"
													]
												},
												"locale": {
													"type": "string",
													"enum": [
														"en",
														"it"
													]
												},
												"templateId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"required": [
												"kind",
												"channel",
												"locale",
												"templateId"
											]
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/locations/{id}": {
			"patch": {
				"summary": "Map and enable a Reputation location",
				"tags": [
					"reputation"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"crmLocationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"enabled": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationLocation"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/connections/{id}/reply-authorization": {
			"post": {
				"summary": "Authorize or revoke Google review-reply publishing",
				"tags": [
					"reputation"
				],
				"description": "Records explicit organization-member authorization independently of OAuth. Revoking prevents queued jobs from being claimed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"authorized": {
										"type": "boolean"
									}
								},
								"required": [
									"authorized"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationConnection"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/requests": {
			"get": {
				"summary": "List review requests",
				"tags": [
					"reputation"
				],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"scheduled",
								"processing",
								"sent",
								"delivery_unknown",
								"completed",
								"skipped",
								"failed",
								"cancelled"
							]
						}
					},
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReputationRequest"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Send a manual review request",
				"tags": [
					"reputation"
				],
				"description": "Manual requests may target inactive patients and do not require an appointment, but still enforce age, consent, cooldown, suppression and a current mapped Google review location.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"channel": {
										"type": "string",
										"enum": [
											"email",
											"sms",
											"whatsapp"
										]
									},
									"locale": {
										"type": "string",
										"enum": [
											"en",
											"it"
										]
									}
								},
								"required": [
									"patientId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"request": {
											"$ref": "#/components/schemas/ReputationRequest"
										}
									},
									"required": [
										"request"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/feedback": {
			"get": {
				"summary": "List private patient feedback",
				"tags": [
					"reputation"
				],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "maxScore",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 5
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReputationFeedback"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/feedback/{id}/recover": {
			"post": {
				"summary": "Create or restore a recovery task for private feedback",
				"tags": [
					"reputation"
				],
				"description": "Idempotently returns the existing open recovery task or creates a replacement when the previous task is missing/closed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationFeedback"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/reviews": {
			"get": {
				"summary": "List current Google review projections",
				"tags": [
					"reputation"
				],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "offset",
						"in": "query",
						"required": false,
						"schema": {
							"default": 0,
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "rating",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 5
						}
					},
					{
						"name": "needsReply",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReputationReview"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"limit": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"offset": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"items",
										"total",
										"limit",
										"offset"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/reviews/{id}": {
			"get": {
				"summary": "Get one current Google review projection",
				"tags": [
					"reputation"
				],
				"description": "Hydrates a single review for an integration holding only its id, instead of paging the list to find the row. Google review Content is a 30-day cache (contentExpiresAt): once a location's projection window has passed the row stops being readable and this answers 404, which is the retention policy working rather than a missing review.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationReview"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/reviews/{id}/draft": {
			"post": {
				"summary": "Generate an editable AI review-reply draft",
				"tags": [
					"reputation"
				],
				"description": "Creates a drafted job only; it never authorizes or publishes a reply.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"instruction": {
										"type": "string",
										"maxLength": 500
									}
								}
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationReplyJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/reviews/{id}/reply": {
			"post": {
				"summary": "Authorize a Google review reply update or deletion",
				"tags": [
					"reputation"
				],
				"description": "Records explicit user authorization and queues provider work. AI drafts are never published without this call.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"action": {
												"type": "string",
												"const": "upsert"
											},
											"replyText": {
												"type": "string",
												"minLength": 1
											}
										},
										"required": [
											"action",
											"replyText"
										]
									},
									{
										"type": "object",
										"properties": {
											"action": {
												"type": "string",
												"const": "delete"
											}
										},
										"required": [
											"action"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationReplyJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/reply-jobs/{id}/cancel": {
			"post": {
				"summary": "Cancel an unpublished reply job",
				"tags": [
					"reputation"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReputationReplyJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/overview": {
			"get": {
				"summary": "Get the SEO Overview page envelope",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoOverviewPage"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/search-visibility": {
			"get": {
				"summary": "Get the Search Visibility page envelope",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "keywordCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "keywordLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "researchCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "researchLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoSearchVisibilityPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/grid-scans/{id}": {
			"get": {
				"summary": "Get a fixed SEO geo-grid and all of its points",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGridScanDetail"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp": {
			"get": {
				"summary": "Get the Google Business Profile page envelope",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "postCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "postLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "seriesCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "seriesLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/website": {
			"get": {
				"summary": "Get the Website SEO page envelope",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "auditLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "findingCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "findingLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "observationCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "observationLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "deliveryCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "deliveryLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoWebsitePage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/ai-visibility": {
			"get": {
				"summary": "Get the AI Visibility page envelope",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "runCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "runLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "sampleCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "sampleLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "platform",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"chatgpt",
								"gemini",
								"perplexity",
								"google_ai_mode"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoAiVisibilityPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/content": {
			"get": {
				"summary": "Get the Content Studio page envelope",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "briefCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "briefLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "documentCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "documentLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/content/documents/{id}": {
			"get": {
				"summary": "Get a Content Studio document envelope",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "revisionCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "revisionLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "generationCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "generationLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "deliveryCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "deliveryLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentDocumentPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/listings": {
			"get": {
				"summary": "Get the Listings Monitor page envelope",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "runCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "runLimit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoListingsPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/settings": {
			"patch": {
				"summary": "Update allowance-capped SEO settings",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"primaryDomain": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 253
											},
											{
												"type": "null"
											}
										]
									},
									"gridSize": {
										"anyOf": [
											{
												"type": "number",
												"const": 5
											},
											{
												"type": "number",
												"const": 7
											}
										]
									},
									"gridSpacingMeters": {
										"type": "integer",
										"minimum": 100,
										"maximum": 5000
									},
									"scanDayOfWeek": {
										"type": "integer",
										"minimum": 0,
										"maximum": 6
									},
									"trackedKeywordLimit": {
										"type": "integer",
										"minimum": 0,
										"maximum": 50
									},
									"gridKeywordLimit": {
										"type": "integer",
										"minimum": 0,
										"maximum": 20
									},
									"monthlyCostCeilingUsdMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 8000000
									},
									"autoApproveGbpPosts": {
										"type": "boolean"
									},
									"autoApproveGbpFixes": {
										"type": "boolean"
									},
									"contentReviewerPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"aiVisibilityEnabled": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/actions/{id}/gbp-review": {
			"get": {
				"summary": "Fetch an ephemeral live Google review for a GBP fix",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpFixLiveReview"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/actions/{id}/approve": {
			"post": {
				"summary": "Approve and queue an SEO action",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"idempotencyVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"clientRef",
									"idempotencyVersion"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoAction"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/actions/{id}/dismiss": {
			"post": {
				"summary": "Dismiss an SEO action",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"idempotencyVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"reason": {
										"type": "string",
										"maxLength": 500
									}
								},
								"required": [
									"idempotencyVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoAction"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/keywords": {
			"post": {
				"summary": "Create a location-scoped SEO keyword",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"phrase": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"intent": {
										"type": "string",
										"enum": [
											"local",
											"commercial",
											"informational"
										]
									},
									"tracked": {
										"default": true,
										"type": "boolean"
									},
									"gridTracked": {
										"default": false,
										"type": "boolean"
									}
								},
								"required": [
									"locationId",
									"phrase",
									"intent"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoKeyword"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/keywords/{id}": {
			"patch": {
				"summary": "Update an SEO keyword",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"phrase": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"intent": {
										"type": "string",
										"enum": [
											"local",
											"commercial",
											"informational"
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoKeyword"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Archive an SEO keyword",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/keywords/{id}/tracking": {
			"patch": {
				"summary": "Change organic and geo-grid tracking for a keyword",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"tracked": {
										"type": "boolean"
									},
									"gridTracked": {
										"type": "boolean"
									}
								},
								"required": [
									"tracked",
									"gridTracked"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoKeyword"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/competitors/{id}/tracking": {
			"patch": {
				"summary": "Change weekly tracking for a location-scoped SEO competitor",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"tracked": {
										"type": "boolean"
									}
								},
								"required": [
									"tracked"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoCompetitor"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/keywords/refresh-universe": {
			"post": {
				"summary": "Refresh CRM-derived keywords without overwriting user choices",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationIds": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"created": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"retained": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"confirmationRequired": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"created",
										"retained",
										"confirmationRequired"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/grid-scans": {
			"post": {
				"summary": "Queue a manual geo-grid scan",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"keywordId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef",
									"keywordId"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGridScan"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/keyword-research": {
			"post": {
				"summary": "Queue live, budget-gated keyword research",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"query": {
										"type": "string",
										"minLength": 1,
										"maxLength": 300
									},
									"mode": {
										"type": "string",
										"enum": [
											"ideas",
											"volumes",
											"competitor_keywords"
										]
									},
									"filters": {
										"default": {
											"limit": 100
										},
										"type": "object",
										"properties": {
											"competitorDomain": {
												"type": "string",
												"minLength": 1,
												"maxLength": 253
											},
											"minimumVolume": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"maximumDifficulty": {
												"type": "integer",
												"minimum": 0,
												"maximum": 100
											},
											"limit": {
												"default": 100,
												"type": "integer",
												"minimum": 1,
												"maximum": 100
											}
										}
									}
								},
								"required": [
									"clientRef",
									"locationId",
									"query",
									"mode"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoKeywordResearchRun"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/keyword-research/{id}": {
			"get": {
				"summary": "Get a keyword-research run and its bounded result",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoKeywordResearchRun"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/extension/domain-metrics": {
			"post": {
				"summary": "Look up cached domain metrics, fetching misses within budget",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"domains": {
										"minItems": 1,
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 4,
											"maxLength": 253,
											"pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+$"
										}
									}
								},
								"required": [
									"domains"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"metrics": {
											"maxItems": 10,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SeoDomainMetric"
											}
										},
										"pending": {
											"maxItems": 10,
											"type": "array",
											"items": {
												"type": "string",
												"minLength": 4,
												"maxLength": 253,
												"pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+$"
											}
										}
									},
									"required": [
										"metrics",
										"pending"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp/series": {
			"post": {
				"summary": "Create a recurring GBP post series",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"reputationLocationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"promptHint": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1500
									},
									"topicType": {
										"type": "string",
										"enum": [
											"update",
											"offer",
											"event"
										]
									},
									"intervalWeeks": {
										"type": "integer",
										"minimum": 1,
										"maximum": 4
									},
									"dayOfWeek": {
										"type": "integer",
										"minimum": 0,
										"maximum": 6
									},
									"localTime": {
										"type": "string",
										"pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"
									},
									"timezone": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"enabled": {
										"default": true,
										"type": "boolean"
									}
								},
								"required": [
									"clientRef",
									"locationId",
									"reputationLocationId",
									"promptHint",
									"topicType",
									"intervalWeeks",
									"dayOfWeek",
									"localTime",
									"timezone"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPostSeries"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp/series/{id}": {
			"patch": {
				"summary": "Update a recurring GBP post series",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"promptHint": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1500
									},
									"topicType": {
										"type": "string",
										"enum": [
											"update",
											"offer",
											"event"
										]
									},
									"intervalWeeks": {
										"type": "integer",
										"minimum": 1,
										"maximum": 4
									},
									"dayOfWeek": {
										"type": "integer",
										"minimum": 0,
										"maximum": 6
									},
									"localTime": {
										"type": "string",
										"pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"
									},
									"timezone": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"enabled": {
										"default": true,
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPostSeries"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a recurring GBP post series",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp/posts": {
			"post": {
				"summary": "Create a GBP post draft or schedule",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"allOf": [
									{
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"clientRef": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"reputationLocationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"seriesId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"summary": {
														"type": "string",
														"minLength": 1,
														"maxLength": 1500
													},
													"cta": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"type": {
																		"type": "string",
																		"enum": [
																			"book",
																			"order",
																			"shop",
																			"learn_more",
																			"sign_up",
																			"call"
																		]
																	},
																	"url": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 2048,
																				"format": "uri"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"type"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assetId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"scheduledFor": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"topicType": {
														"type": "string",
														"const": "update"
													}
												},
												"required": [
													"locationId",
													"reputationLocationId",
													"summary",
													"topicType"
												]
											},
											{
												"type": "object",
												"properties": {
													"clientRef": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"reputationLocationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"seriesId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"summary": {
														"type": "string",
														"minLength": 1,
														"maxLength": 1500
													},
													"cta": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"type": {
																		"type": "string",
																		"enum": [
																			"book",
																			"order",
																			"shop",
																			"learn_more",
																			"sign_up",
																			"call"
																		]
																	},
																	"url": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 2048,
																				"format": "uri"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"type"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assetId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"scheduledFor": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"topicType": {
														"type": "string",
														"const": "offer"
													},
													"offerCouponCode": {
														"type": "string",
														"maxLength": 100
													},
													"offerTerms": {
														"type": "string",
														"maxLength": 5000
													}
												},
												"required": [
													"locationId",
													"reputationLocationId",
													"summary",
													"topicType"
												]
											},
											{
												"type": "object",
												"properties": {
													"clientRef": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"reputationLocationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"seriesId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"summary": {
														"type": "string",
														"minLength": 1,
														"maxLength": 1500
													},
													"cta": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"type": {
																		"type": "string",
																		"enum": [
																			"book",
																			"order",
																			"shop",
																			"learn_more",
																			"sign_up",
																			"call"
																		]
																	},
																	"url": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 2048,
																				"format": "uri"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"type"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assetId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"scheduledFor": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"topicType": {
														"type": "string",
														"const": "event"
													},
													"eventTitle": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"eventStartsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"eventEndsAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"required": [
													"locationId",
													"reputationLocationId",
													"summary",
													"topicType",
													"eventTitle",
													"eventStartsAt",
													"eventEndsAt"
												]
											}
										]
									},
									{
										"type": "object",
										"properties": {
											"clientRef": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"clientRef"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp/posts/ai-draft": {
			"post": {
				"summary": "Generate and retain an editable GBP post draft from confirmed facts",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"reputationLocationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"promptHint": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"clientRef",
									"locationId",
									"reputationLocationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp/posts/{id}": {
			"patch": {
				"summary": "Update an unpublished GBP post",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"summary": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1500
									},
									"cta": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"enum": [
															"book",
															"order",
															"shop",
															"learn_more",
															"sign_up",
															"call"
														]
													},
													"url": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2048,
																"format": "uri"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"type"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"assetId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"scheduledFor": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"eventTitle": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"eventStartsAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"eventEndsAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"offerCouponCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"offerTerms": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 5000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a GBP post locally and remotely when published",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp/posts/{id}/publish": {
			"post": {
				"summary": "Authorize and queue GBP post publication",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/gbp/audit/run": {
			"post": {
				"summary": "Queue a manual GBP completeness audit",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"reputationLocationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef",
									"locationId",
									"reputationLocationId"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGbpAuditRun"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/media/assets": {
			"post": {
				"summary": "Create a private SEO media upload",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"filename": {
										"type": "string",
										"minLength": 1,
										"maxLength": 255
									},
									"mime": {
										"type": "string",
										"enum": [
											"image/jpeg",
											"image/png"
										]
									},
									"bytes": {
										"type": "integer",
										"minimum": 10240,
										"maximum": 5242880
									},
									"width": {
										"type": "integer",
										"minimum": 250,
										"maximum": 4096
									},
									"height": {
										"type": "integer",
										"minimum": 250,
										"maximum": 4096
									},
									"sha256": {
										"type": "string",
										"pattern": "^[0-9a-f]{64}$"
									}
								},
								"required": [
									"filename",
									"mime",
									"bytes",
									"width",
									"height",
									"sha256"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoMediaAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/media/assets/{id}/content": {
			"put": {
				"summary": "Stream bounded SEO image bytes through the Worker",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/octet-stream": {
							"schema": {
								"type": "string",
								"description": "JPEG or PNG bytes",
								"format": "binary"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoMediaAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/media/assets/{id}/finalize": {
			"post": {
				"summary": "Verify and finalize an SEO media upload",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoMediaAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/media/assets/{id}": {
			"delete": {
				"summary": "Delete an unattached SEO media asset",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/media/assets/{id}/preview": {
			"get": {
				"summary": "Preview an authenticated private SEO media asset",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/audits": {
			"post": {
				"summary": "Queue a cooldown- and budget-gated website audit",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"maxPages": {
										"default": 100,
										"type": "integer",
										"minimum": 1,
										"maximum": 500
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoSiteAudit"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/findings/{id}/send-brief": {
			"post": {
				"summary": "Render and queue a finding brief for a web developer",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"recipientEmail": {
										"type": "string",
										"maxLength": 320,
										"format": "email",
										"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
									}
								},
								"required": [
									"clientRef",
									"recipientEmail"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"oneOf": [
										{
											"type": "object",
											"properties": {
												"status": {
													"type": "string",
													"const": "queued"
												},
												"delivery": {
													"$ref": "#/components/schemas/SeoWebmasterDelivery"
												},
												"contact": {
													"$ref": "#/components/schemas/SeoWebmasterContact"
												}
											},
											"required": [
												"status",
												"delivery",
												"contact"
											],
											"additionalProperties": false
										},
										{
											"type": "object",
											"properties": {
												"status": {
													"type": "string",
													"const": "awaiting_confirmation"
												},
												"contact": {
													"$ref": "#/components/schemas/SeoWebmasterContact"
												},
												"confirmationState": {
													"type": "string",
													"enum": [
														"sent",
														"cooldown"
													]
												},
												"retryAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												}
											},
											"required": [
												"status",
												"contact",
												"confirmationState",
												"retryAt"
											],
											"additionalProperties": false
										}
									]
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/webmaster-contacts": {
			"get": {
				"summary": "List the practice's webmaster contacts and permanent capacity",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoWebmasterContacts"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/webmaster-contacts/{id}/block": {
			"put": {
				"summary": "Block a webmaster contact for this practice",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoWebmasterContact"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Remove a reversible practice block from a webmaster contact",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoWebmasterContact"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/findings/{id}/dismiss": {
			"post": {
				"summary": "Dismiss a current website finding",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"maxLength": 500
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoSiteFinding"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/ai-visibility/run": {
			"post": {
				"summary": "Queue a manual AI visibility sample run",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationIds": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"treatmentIds": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoAiSampleRun"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/briefs": {
			"post": {
				"summary": "Queue a location-scoped SEO content brief",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"keywordId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"targetPhrase": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"targetWordCountMin": {
										"default": 800,
										"type": "integer",
										"minimum": 100,
										"maximum": 10000
									},
									"targetWordCountMax": {
										"default": 1500,
										"type": "integer",
										"minimum": 100,
										"maximum": 20000
									}
								},
								"required": [
									"clientRef",
									"locationId",
									"targetPhrase"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentBrief"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents": {
			"post": {
				"summary": "Create a Content Studio document from a completed brief",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"briefId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"keywordId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 300
									},
									"contentJson": {
										"description": "TipTap document; maximum 524288 UTF-8 bytes",
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "number"
											},
											{
												"type": "boolean"
											},
											{
												"type": "null"
											},
											{
												"type": "array",
												"items": {
													"$ref": "#/components/schemas/__schema0"
												}
											},
											{
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {
													"$ref": "#/components/schemas/__schema0"
												}
											}
										],
										"$ref": "#/components/schemas/__schema0"
									},
									"editorSchemaVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"briefId",
									"locationId",
									"title",
									"contentJson",
									"editorSchemaVersion"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentDocument"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}": {
			"patch": {
				"summary": "Autosave a Content Studio document with version CAS",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 300
									},
									"contentJson": {
										"description": "TipTap document; maximum 524288 UTF-8 bytes",
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "number"
											},
											{
												"type": "boolean"
											},
											{
												"type": "null"
											},
											{
												"type": "array",
												"items": {
													"$ref": "#/components/schemas/__schema0"
												}
											},
											{
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {
													"$ref": "#/components/schemas/__schema0"
												}
											}
										],
										"$ref": "#/components/schemas/__schema0"
									},
									"editorSchemaVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"reviewerPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"reviewNote": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentDocument"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/media/{assetId}": {
			"post": {
				"summary": "Attach a ready private SEO image to a content document",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "assetId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoMediaAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/revisions": {
			"post": {
				"summary": "Cut an immutable content revision from the current draft",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentRevision"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/request-review": {
			"post": {
				"summary": "Cut a revision and request clinical review",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"reviewNote": {
										"type": "string",
										"maxLength": 4000
									}
								},
								"required": [
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentRevision"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/approve": {
			"post": {
				"summary": "Approve and clinically attest an immutable content revision",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"revisionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"reviewerPractitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"reviewNote": {
										"type": "string",
										"maxLength": 4000
									}
								},
								"required": [
									"version",
									"revisionId",
									"reviewerPractitionerId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentDocument"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/export": {
			"post": {
				"summary": "Render an approved content revision as HTML or Markdown",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"revisionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"format": {
										"type": "string",
										"enum": [
											"html",
											"markdown"
										]
									}
								},
								"required": [
									"format"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentExport"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/generate-draft": {
			"post": {
				"summary": "Queue a version-fenced AI content draft",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"version": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"instruction": {
										"type": "string",
										"maxLength": 2000
									}
								},
								"required": [
									"clientRef",
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentGenerationRun"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/generation-runs/{runId}/apply": {
			"post": {
				"summary": "Apply an AI candidate with document-version CAS",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "runId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentDocument"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/send-to-webmaster": {
			"post": {
				"summary": "Queue an approved revision for webmaster delivery",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"revisionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"recipientEmail": {
										"type": "string",
										"maxLength": 320,
										"format": "email",
										"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
									},
									"format": {
										"type": "string",
										"enum": [
											"html",
											"markdown"
										]
									}
								},
								"required": [
									"clientRef",
									"recipientEmail",
									"format"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"oneOf": [
										{
											"type": "object",
											"properties": {
												"status": {
													"type": "string",
													"const": "queued"
												},
												"delivery": {
													"$ref": "#/components/schemas/SeoWebmasterDelivery"
												},
												"contact": {
													"$ref": "#/components/schemas/SeoWebmasterContact"
												}
											},
											"required": [
												"status",
												"delivery",
												"contact"
											],
											"additionalProperties": false
										},
										{
											"type": "object",
											"properties": {
												"status": {
													"type": "string",
													"const": "awaiting_confirmation"
												},
												"contact": {
													"$ref": "#/components/schemas/SeoWebmasterContact"
												},
												"confirmationState": {
													"type": "string",
													"enum": [
														"sent",
														"cooldown"
													]
												},
												"retryAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												}
											},
											"required": [
												"status",
												"contact",
												"confirmationState",
												"retryAt"
											],
											"additionalProperties": false
										}
									]
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/listings/check": {
			"post": {
				"summary": "Queue a manual listings check for one location",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"clientRef",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoListingCheckRun"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/listings/overrides/{locationId}/{directoryKey}": {
			"put": {
				"summary": "Confirm or ignore a location's directory listing",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "locationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "directoryKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"yell",
								"thomson_local",
								"one92",
								"scoot",
								"bing_places",
								"apple_maps",
								"facebook",
								"nhs"
							]
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"confirmedUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"ignored": {
										"type": "boolean"
									}
								},
								"required": [
									"confirmedUrl",
									"ignored"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoListingOverride"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Restore monitoring for a location's directory listing",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "locationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "directoryKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"yell",
								"thomson_local",
								"one92",
								"scoot",
								"bing_places",
								"apple_maps",
								"facebook",
								"nhs"
							]
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/google/gsc/connect": {
			"get": {
				"summary": "Start the independent Search Console OAuth flow",
				"tags": [
					"seo-google"
				],
				"parameters": [
					{
						"name": "returnTo",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2048
						}
					}
				],
				"responses": {
					"302": {
						"description": ""
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/google/gsc/property": {
			"post": {
				"summary": "Select a verified Search Console property",
				"tags": [
					"seo-google"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"propertyUri": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2048
									}
								},
								"required": [
									"propertyUri"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGscConnection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/google/gsc": {
			"delete": {
				"summary": "Disconnect Search Console and fence queued syncs",
				"tags": [
					"seo-google"
				],
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo-media/{publicId}": {
			"get": {
				"summary": "Stream an attached public SEO image by opaque ID",
				"tags": [
					"seo-public"
				],
				"security": [],
				"parameters": [
					{
						"name": "publicId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"head": {
				"summary": "Read metadata for an attached public SEO image by opaque ID",
				"tags": [
					"seo-public"
				],
				"security": [],
				"parameters": [
					{
						"name": "publicId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK"
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns": {
			"get": {
				"summary": "List ad campaigns",
				"tags": [
					"ads"
				],
				"description": "Managed and external (adopted-inventory) campaigns, cursor-paginated. Reads stay open when the entitlement lapses.",
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "provider",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "view",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"managed",
								"external"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"items": {
													"maxItems": 100,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsCampaign"
													}
												},
												"nextCursor": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 1024
														},
														{
															"type": "null"
														}
													]
												},
												"openAlerts": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsAlert"
													}
												},
												"syncHealth": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsSyncHealthEntry"
													}
												}
											},
											"required": [
												"items",
												"nextCursor",
												"openAlerts",
												"syncHealth"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a campaign draft",
				"tags": [
					"ads"
				],
				"description": "Validated locally (platform budget floors, monthly projection vs the org cap) and stored as a draft. Nothing reaches the provider until launch.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"enum": [
											"meta",
											"google_ads",
											"tiktok",
											"chatgpt"
										]
									},
									"platformKind": {
										"type": "string",
										"enum": [
											"google_search",
											"google_pmax",
											"google_demand_gen",
											"meta_leads",
											"meta_website",
											"tiktok_smartplus_leadgen",
											"chatgpt_chat_card"
										],
										"description": "`external` campaigns are adopted from sync, never created"
									},
									"externalAccountId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"pageExternalAccountId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 300
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"dailyBudgetMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 1000000000000
									},
									"startAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"endAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"targeting": {
										"$ref": "#/components/schemas/AdsTargeting"
									},
									"servicesAdvertised": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"serviceKey": {
													"type": "string",
													"minLength": 1,
													"maxLength": 120
												},
												"label": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												}
											},
											"required": [
												"serviceKey",
												"label"
											]
										},
										"description": "Service keys must be unique"
									},
									"targetCplMicros": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 1000000000000
											},
											{
												"type": "null"
											}
										]
									},
									"optimizationGoal": {
										"type": "string",
										"enum": [
											"booking",
											"lead"
										]
									},
									"destinationUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"provider",
									"platformKind",
									"externalAccountId",
									"name",
									"dailyBudgetMicros",
									"targeting",
									"servicesAdvertised"
								],
								"description": "Creates a local draft only — nothing reaches the provider until launch, and nothing goes live until publish."
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}": {
			"get": {
				"summary": "Get an ad campaign",
				"tags": [
					"ads"
				],
				"description": "The campaign, its groups and ads, a bounded mutation trail, and open alerts.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"campaign": {
													"$ref": "#/components/schemas/AdsCampaign"
												},
												"adGroups": {
													"maxItems": 200,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsAdGroup"
													}
												},
												"ads": {
													"maxItems": 500,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsAd"
													}
												},
												"mutations": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsMutationSummary"
													}
												},
												"alerts": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsAlert"
													}
												}
											},
											"required": [
												"campaign",
												"adGroups",
												"ads",
												"mutations",
												"alerts"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update a campaign draft",
				"tags": [
					"ads"
				],
				"description": "Drafts only; live campaigns change through the verb routes.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"pageExternalAccountId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 300
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"dailyBudgetMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 1000000000000
									},
									"startAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"endAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"targeting": {
										"$ref": "#/components/schemas/AdsTargeting"
									},
									"servicesAdvertised": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"serviceKey": {
													"type": "string",
													"minLength": 1,
													"maxLength": 120
												},
												"label": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												}
											},
											"required": [
												"serviceKey",
												"label"
											]
										},
										"description": "Service keys must be unique"
									},
									"targetCplMicros": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 1000000000000
											},
											{
												"type": "null"
											}
										]
									},
									"optimizationGoal": {
										"type": "string",
										"enum": [
											"booking",
											"lead"
										]
									},
									"destinationUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/launch": {
			"post": {
				"summary": "Create the campaign at the provider, PAUSED",
				"tags": [
					"ads"
				],
				"description": "Queues the create mutation once launch preconditions hold (management capability, provisioned conversion resources, policy pre-flight). The campaign arrives at the provider paused; going live is the separate publish verb.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"clientRef",
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/publish": {
			"post": {
				"summary": "Set a campaign live",
				"tags": [
					"ads"
				],
				"description": "The spend-affecting verb (`ads:publish`). First publish stamps publishedAt, which anchors learning-stuck detection.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"clientRef",
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/pause": {
			"post": {
				"summary": "Pause a campaign",
				"tags": [
					"ads"
				],
				"description": "Pausing only ever stops spend, so it is `ads:manage`.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"clientRef",
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/resume": {
			"post": {
				"summary": "Resume a paused campaign",
				"tags": [
					"ads"
				],
				"description": "Resuming restarts spend, so it is `ads:publish`.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"clientRef",
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/budget": {
			"put": {
				"summary": "Change the daily budget",
				"tags": [
					"ads"
				],
				"description": "`ads:publish`. Validated against the platform's minimums and the org monthly cap; the monthly projection must be explicitly confirmed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"dailyBudgetMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 1000000000000
									},
									"confirmMonthlyProjection": {
										"type": "boolean"
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"dailyBudgetMicros",
									"confirmMonthlyProjection"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/schedule": {
			"put": {
				"summary": "Change the campaign schedule",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"startAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"endAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"startAt",
									"endAt"
								],
								"description": "endAt must be after startAt"
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/destination": {
			"put": {
				"summary": "Change the destination URL",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"destinationUrl": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"destinationUrl"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/targeting": {
			"put": {
				"summary": "Change radius targeting and age range",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"targeting": {
										"$ref": "#/components/schemas/AdsTargeting"
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"targeting"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/creative-batch": {
			"post": {
				"summary": "Review-and-apply a batch of creative changes",
				"tags": [
					"ads"
				],
				"description": "Ad text and image changes staged in the UI apply as one mutation. Policy pre-flight re-runs at validation; on Meta the learning reset must be explicitly confirmed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"changes": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"adId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"adGroupId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"headline": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 200
														},
														{
															"type": "null"
														}
													]
												},
												"primaryText": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 2000
														},
														{
															"type": "null"
														}
													]
												},
												"description": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 500
														},
														{
															"type": "null"
														}
													]
												},
												"creativeVariantId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"adId",
												"adGroupId"
											],
											"description": "Each change names an existing ad or the group to create in"
										}
									},
									"confirmLearningReset": {
										"type": "boolean"
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"changes",
									"confirmLearningReset"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/optimization-goal": {
			"put": {
				"summary": "Switch optimization between Booking and Leads",
				"tags": [
					"ads"
				],
				"description": "`ads:manage` — the learning-stuck fallback lowers ambition, it never raises spend.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"optimizationGoal": {
										"type": "string",
										"enum": [
											"booking",
											"lead"
										]
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"optimizationGoal"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/adopt": {
			"post": {
				"summary": "Adopt an externally created campaign",
				"tags": [
					"ads"
				],
				"description": "Takes management of a campaign sync discovered at the provider. Its current provider values become the desired state — external edits always win.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"clientRef",
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCampaign"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/settings": {
			"put": {
				"summary": "Update practice-level spend guard rails",
				"tags": [
					"ads"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"monthlySpendCapMicros": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 1000000000000
											},
											{
												"type": "null"
											}
										]
									},
									"generationBudgetMicros": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"monthlySpendCapMicros",
									"generationBudgetMicros"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/spend-results": {
			"get": {
				"summary": "Spend & results: platform numbers vs CRM truth",
				"tags": [
					"ads"
				],
				"description": "Per-campaign platform metrics beside CRM lead/booked/won truth, totals, a per-location split, and the speed-to-lead KPI over ad-attributed journeys.",
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"from": {
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												"to": {
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												"campaigns": {
													"maxItems": 200,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsSpendResultRow"
													}
												},
												"totals": {
													"type": "object",
													"properties": {
														"platform": {
															"type": "object",
															"properties": {
																"spendMicros": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"impressions": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"clicks": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"conversions": {
																	"type": "number",
																	"minimum": 0
																},
																"platformLeads": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"spendMicros",
																"impressions",
																"clicks",
																"conversions",
																"platformLeads"
															],
															"additionalProperties": false
														},
														"crm": {
															"type": "object",
															"properties": {
																"leads": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"booked": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"won": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"wonValueCents": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"leads",
																"booked",
																"won",
																"wonValueCents"
															],
															"additionalProperties": false
														}
													},
													"required": [
														"platform",
														"crm"
													],
													"additionalProperties": false
												},
												"openAlertCount": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"perLocation": {
													"maxItems": 500,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"locationId": {
																"anyOf": [
																	{
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"platform": {
																"type": "object",
																"properties": {
																	"spendMicros": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"impressions": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"clicks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"conversions": {
																		"type": "number",
																		"minimum": 0
																	},
																	"platformLeads": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"spendMicros",
																	"impressions",
																	"clicks",
																	"conversions",
																	"platformLeads"
																],
																"additionalProperties": false
															},
															"crm": {
																"type": "object",
																"properties": {
																	"leads": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"booked": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"won": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"wonValueCents": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"leads",
																	"booked",
																	"won",
																	"wonValueCents"
																],
																"additionalProperties": false
															}
														},
														"required": [
															"locationId",
															"platform",
															"crm"
														],
														"additionalProperties": false
													}
												},
												"responseTime": {
													"type": "object",
													"properties": {
														"journeys": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"contacted": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"averageMs": {
															"anyOf": [
																{
																	"type": "number",
																	"minimum": 0
																},
																{
																	"type": "null"
																}
															]
														},
														"medianMs": {
															"anyOf": [
																{
																	"type": "number",
																	"minimum": 0
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"journeys",
														"contacted",
														"averageMs",
														"medianMs"
													],
													"additionalProperties": false
												},
												"syncHealth": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsSyncHealthEntry"
													}
												}
											},
											"required": [
												"from",
												"to",
												"campaigns",
												"totals",
												"openAlertCount",
												"perLocation",
												"responseTime",
												"syncHealth"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/providers/{provider}/dashboard": {
			"get": {
				"summary": "One ad platform's dashboard",
				"tags": [
					"ads"
				],
				"description": "KPIs with previous-window comparison, chart series, the platform's synced campaigns beside their exact window truths (cost per booking, return on ad spend, pending changes) and an exact 'Other campaigns' remainder. `filters` is url-encoded JSON in the report filter model — only its `date` is honoured — and both truths count whole practice-local days. Reads stay open when the entitlement lapses.",
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "grain",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"day",
								"week",
								"month"
							]
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"provider": {
													"type": "string",
													"enum": [
														"meta",
														"google_ads",
														"tiktok",
														"chatgpt"
													]
												},
												"currency": {
													"type": "string",
													"enum": [
														"EUR",
														"GBP",
														"USD"
													]
												},
												"range": {
													"type": "object",
													"properties": {
														"from": {
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														"to": {
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														}
													},
													"required": [
														"from",
														"to"
													],
													"additionalProperties": false
												},
												"previousRange": {
													"type": "object",
													"properties": {
														"from": {
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														"to": {
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														}
													},
													"required": [
														"from",
														"to"
													],
													"additionalProperties": false
												},
												"grain": {
													"type": "string",
													"enum": [
														"day",
														"week",
														"month"
													]
												},
												"kpis": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/ReportKpi"
													}
												},
												"series": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/ReportSeries"
													}
												},
												"totals": {
													"type": "object",
													"properties": {
														"platform": {
															"type": "object",
															"properties": {
																"spendMicros": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"impressions": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"clicks": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"conversions": {
																	"type": "number",
																	"minimum": 0
																},
																"platformLeads": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"spendMicros",
																"impressions",
																"clicks",
																"conversions",
																"platformLeads"
															],
															"additionalProperties": false
														},
														"crm": {
															"type": "object",
															"properties": {
																"leads": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"booked": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"won": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"wonValueCents": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"leads",
																"booked",
																"won",
																"wonValueCents"
															],
															"additionalProperties": false
														}
													},
													"required": [
														"platform",
														"crm"
													],
													"additionalProperties": false
												},
												"campaigns": {
													"maxItems": 101,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsProviderCampaignRow"
													}
												},
												"openAlerts": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsAlert"
													}
												},
												"syncHealth": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsSyncHealthEntry"
													}
												}
											},
											"required": [
												"provider",
												"currency",
												"range",
												"previousRange",
												"grain",
												"kpis",
												"series",
												"totals",
												"campaigns",
												"openAlerts",
												"syncHealth"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/{id}/ads": {
			"get": {
				"summary": "A campaign's ads with window metrics",
				"tags": [
					"ads"
				],
				"description": "The campaign's synced ads with their platform metrics summed over the civil-day window, keyset-paginated on the ad id.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"items": {
													"maxItems": 100,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsProviderAdRow"
													}
												},
												"nextCursor": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 1024
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"items",
												"nextCursor"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/sync/{externalAccountId}/resume": {
			"post": {
				"summary": "Resume a parked account sync",
				"tags": [
					"ads"
				],
				"description": "Clears the park on one ad account's sync state (fresh generation, attempt counter reset, both pulls due immediately) so the next scheduler tick picks it up. A row that is not parked answers its current health unchanged.",
				"parameters": [
					{
						"name": "externalAccountId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"externalAccountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"provider": {
											"type": "string",
											"enum": [
												"meta",
												"google_ads",
												"tiktok",
												"chatgpt"
											]
										},
										"parkedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"structureDueAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"metricsDueAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"externalAccountId",
										"accountName",
										"provider",
										"parkedAt",
										"lastError",
										"structureDueAt",
										"metricsDueAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/alerts": {
			"get": {
				"summary": "List ads alerts",
				"tags": [
					"ads"
				],
				"description": "Operational alerts the sync evaluators raise (CPL spikes, delivery stopped, disapprovals, learning stuck, fatigue, ...). Without a status filter only open alerts return.",
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"acknowledged",
								"resolved",
								"expired"
							]
						}
					},
					{
						"name": "kind",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"cpl_spike",
								"delivery_stopped",
								"budget_exhausted",
								"disapproval",
								"account_health",
								"learning_stuck",
								"fatigue"
							]
						}
					},
					{
						"name": "campaignId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"items": {
													"maxItems": 100,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsAlert"
													}
												},
												"nextCursor": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 1024
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"items",
												"nextCursor"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/alerts/{id}/acknowledge": {
			"post": {
				"summary": "Acknowledge an alert",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsAlert"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/alerts/{id}/apply-action": {
			"post": {
				"summary": "Apply an alert's one-click remediation",
				"tags": [
					"ads"
				],
				"description": "Executes the alert's offered action: learning-stuck applies 'optimize on Leads temporarily' as a normal ledger mutation and resolves the alert; fatigue answers the creative-studio deep link without any server mutation. A missing or mismatched action answers 409.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"actionKind": {
										"type": "string",
										"enum": [
											"optimize_on_leads",
											"open_creative_studio"
										]
									}
								},
								"required": [
									"clientRef",
									"actionKind"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"alert": {
											"$ref": "#/components/schemas/AdsAlert"
										},
										"navigateTo": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 512
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"alert",
										"navigateTo"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/studio": {
			"get": {
				"summary": "Get the creative-studio page envelope",
				"tags": [
					"ads"
				],
				"description": "Recent generation sessions with their variants, the reusable image library, and the month's generation-budget state. Reads stay open when the add-on entitlement lapses; the envelope carries the gating instead.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"sessions": {
													"maxItems": 10,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"session": {
																"$ref": "#/components/schemas/AdsCreativeSession"
															},
															"variants": {
																"maxItems": 50,
																"type": "array",
																"items": {
																	"$ref": "#/components/schemas/AdsCreativeVariant"
																}
															}
														},
														"required": [
															"session",
															"variants"
														],
														"additionalProperties": false
													}
												},
												"assets": {
													"maxItems": 50,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsCreativeAsset"
													}
												},
												"budget": {
													"type": "object",
													"properties": {
														"ceilingMicros": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"spentMicros": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"ceilingMicros",
														"spentMicros"
													],
													"additionalProperties": false
												}
											},
											"required": [
												"sessions",
												"assets",
												"budget"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/sessions": {
			"post": {
				"summary": "Start a guided creative-generation session",
				"tags": [
					"ads"
				],
				"description": "Claims the monthly generation budget atomically, then queues one copy call plus one image call per aspect ratio. 402 when the budget is exhausted. clientRef is the caller's idempotency key.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"clientRef": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"templateKey": {
												"type": "string",
												"const": "meet-the-dentist"
											},
											"inputs": {
												"type": "object",
												"properties": {
													"dentistName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 120
													},
													"trustFact": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													}
												},
												"required": [
													"dentistName",
													"trustFact"
												],
												"additionalProperties": false
											},
											"referenceAssetId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"clientRef",
											"templateKey",
											"inputs",
											"referenceAssetId"
										]
									},
									{
										"type": "object",
										"properties": {
											"clientRef": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"templateKey": {
												"type": "string",
												"const": "offer"
											},
											"inputs": {
												"type": "object",
												"properties": {
													"treatment": {
														"type": "string",
														"minLength": 1,
														"maxLength": 120
													},
													"price": {
														"type": "string",
														"minLength": 1,
														"maxLength": 40
													},
													"endDate": {
														"type": "string",
														"format": "date",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
													}
												},
												"required": [
													"treatment",
													"price",
													"endDate"
												],
												"additionalProperties": false
											},
											"referenceAssetId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"clientRef",
											"templateKey",
											"inputs",
											"referenceAssetId"
										]
									},
									{
										"type": "object",
										"properties": {
											"clientRef": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"templateKey": {
												"type": "string",
												"const": "new-patient-welcome"
											},
											"inputs": {
												"type": "object",
												"properties": {
													"welcomePoint": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													}
												},
												"required": [
													"welcomePoint"
												],
												"additionalProperties": false
											},
											"referenceAssetId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"clientRef",
											"templateKey",
											"inputs",
											"referenceAssetId"
										]
									},
									{
										"type": "object",
										"properties": {
											"clientRef": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"templateKey": {
												"type": "string",
												"const": "treatment-spotlight"
											},
											"inputs": {
												"type": "object",
												"properties": {
													"treatment": {
														"type": "string",
														"minLength": 1,
														"maxLength": 120
													},
													"whoFor": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													}
												},
												"required": [
													"treatment",
													"whoFor"
												],
												"additionalProperties": false
											},
											"referenceAssetId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"clientRef",
											"templateKey",
											"inputs",
											"referenceAssetId"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeSession"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/sessions/{id}": {
			"get": {
				"summary": "Get a creative session and its variants",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"session": {
											"$ref": "#/components/schemas/AdsCreativeSession"
										},
										"variants": {
											"maxItems": 50,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AdsCreativeVariant"
											}
										}
									},
									"required": [
										"session",
										"variants"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/variants/{id}/select": {
			"post": {
				"summary": "Pick a variant from its session",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeVariant"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/variants/{id}/approve": {
			"post": {
				"summary": "Approve a selected variant for publication",
				"tags": [
					"ads"
				],
				"description": "Refused (409) while the variant carries blocking policy pre-flight findings. Approval alone publishes nothing — attaching to a campaign is a normal creative-batch mutation, arriving paused.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeVariant"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/assets": {
			"post": {
				"summary": "Create a private creative-asset upload",
				"tags": [
					"ads"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"filename": {
										"type": "string",
										"minLength": 1,
										"maxLength": 255
									},
									"mime": {
										"type": "string",
										"enum": [
											"image/jpeg",
											"image/png"
										]
									},
									"bytes": {
										"type": "integer",
										"minimum": 10240,
										"maximum": 5242880
									},
									"width": {
										"type": "integer",
										"minimum": 250,
										"maximum": 4096
									},
									"height": {
										"type": "integer",
										"minimum": 250,
										"maximum": 4096
									},
									"sha256": {
										"type": "string",
										"pattern": "^[0-9a-f]{64}$"
									}
								},
								"required": [
									"filename",
									"mime",
									"bytes",
									"width",
									"height",
									"sha256"
								],
								"description": "At most 16 megapixels"
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/assets/{id}/content": {
			"put": {
				"summary": "Stream bounded creative image bytes through the Worker",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/octet-stream": {
							"schema": {
								"type": "string",
								"description": "JPEG or PNG bytes",
								"format": "binary"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/assets/{id}/finalize": {
			"post": {
				"summary": "Verify and finalize a creative-asset upload",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/assets/{id}": {
			"get": {
				"summary": "Get a creative asset",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeAsset"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/creative/assets/{id}/preview": {
			"get": {
				"summary": "Preview an authenticated private creative asset",
				"tags": [
					"ads"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/day-list": {
			"get": {
				"summary": "The day list: every appointment of one practice-local day",
				"tags": [
					"pms"
				],
				"description": "The PMS day list — the calendar drill-down's appointment rows (patient name, type, treatment, status, times) for one practice-local day, optionally one location; reachable only for a signed-in member with the PMS workspace and dayList:read.",
				"parameters": [
					{
						"name": "date",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "from",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"date": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"timezone": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListItem"
											}
										},
										"working": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListInterval"
											}
										},
										"rotaPractitionerIds": {
											"type": "array",
											"items": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"absences": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListInterval"
											}
										},
										"closures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListClosure"
											}
										}
									},
									"required": [
										"date",
										"from",
										"to",
										"timezone",
										"locationId",
										"items",
										"working",
										"rotaPractitionerIds",
										"absences",
										"closures"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/day-list/load": {
			"get": {
				"summary": "How full each day is, per practitioner",
				"tags": [
					"pms"
				],
				"description": "Bookable and booked minutes per practitioner per practice-local day (up to 100 days) — what the diary's date picker tints; same gate as the day list.",
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"timezone": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedDates": {
											"type": "array",
											"items": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											}
										},
										"rows": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"date": {
														"type": "string",
														"format": "date",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
													},
													"practitionerId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"bookableMin": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"bookedMin": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"count": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"date",
													"practitionerId",
													"bookableMin",
													"bookedMin",
													"count"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"from",
										"to",
										"timezone",
										"locationId",
										"closedDates",
										"rows"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/book": {
			"post": {
				"summary": "Book an appointment from the PMS",
				"tags": [
					"pms"
				],
				"description": "Books exactly as POST /appointments does (requestId idempotency, overbook only for owners and managers) behind the PMS workspace gate.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"requestId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"startsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"endsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"journeyId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentTypeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"operatoryId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"overbookReason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									"note": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"patientInstruction": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"isFirstVisit": {
										"type": "boolean"
									},
									"treatmentPlanVisitId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"requestId",
									"patientId",
									"startsAt",
									"endsAt"
								],
								"description": "endsAt must be after startsAt. locationId may be omitted only when the organization has exactly one location."
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Appointment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patient-record/{id}": {
			"get": {
				"summary": "A patient's record as the PMS reads it",
				"tags": [
					"pms"
				],
				"description": "The patient detail bundle (same embeds as GET /patients/:id) behind the PMS workspace gate. Phase 1 is read mode: the chart, notes and ledger routers arrive with their phases.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(timeline|journeys|touches|pms|deposits|referral|marketing)(,(timeline|journeys|touches|pms|deposits|referral|marketing))*$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PatientDetail"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/pms-inbox/conversations": {
			"get": {
				"summary": "The PMS inbox",
				"tags": [
					"pms"
				],
				"description": "Same list and filters as GET /conversations behind the PMS workspace gate.",
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"pending",
								"snoozed",
								"closed"
							]
						}
					},
					{
						"name": "channel",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"whatsapp",
								"sms",
								"email",
								"webchat",
								"messenger",
								"instagram",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments"
							]
						}
					},
					{
						"name": "assignee",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "unread",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "patientId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "patientStatus",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(enquiry|lead|patient|inactive|archived|deceased)(,(enquiry|lead|patient|inactive|archived|deceased))*$"
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ConversationListItem"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/team/members/{userId}/workspace": {
			"put": {
				"summary": "Set the workspace a member lands in",
				"tags": [
					"settings"
				],
				"description": "A member sets their own default workspace freely; setting another member's needs member:update. 404 for a user who is not a member of the practice; 409 when the workspace is not visible to that member (role or practice access).",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"workspace": {
										"type": "string",
										"enum": [
											"crm",
											"pms"
										]
									}
								},
								"required": [
									"workspace"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"workspace": {
											"type": "string",
											"enum": [
												"crm",
												"pms"
											]
										}
									},
									"required": [
										"userId",
										"workspace"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/team/members/{userId}/suspension": {
			"put": {
				"summary": "Suspend or restore a member's access to the practice",
				"tags": [
					"settings"
				],
				"description": "Gated like removing a member (owners and managers; only an owner may suspend an owner). Suspending yourself is refused. Idempotent: a member already in the requested state answers 200 without a change. 403 when the caller may not act on this member; 404 for a user who is not a member of the practice; 409 SELF_SUSPENSION.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"suspended": {
										"type": "boolean"
									}
								},
								"required": [
									"suspended"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"suspendedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"userId",
										"suspendedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practitioners/{id}/user-link": {
			"post": {
				"summary": "Link or unlink the member behind a practitioner",
				"tags": [
					"settings"
				],
				"description": "Sets which signed-in member acts as this practitioner (null unlinks). Needs member:update and a browser session; 404 when the practitioner or the member is not in the practice, 409 when the member already acts as another practitioner.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"userId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"userId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Practitioner"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-categories": {
			"get": {
				"summary": "List procedure categories",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ProcedureCategory"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a procedure category",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-categories/{id}": {
			"patch": {
				"summary": "Update a procedure category",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-categories/{id}/archive": {
			"post": {
				"summary": "Archive a procedure category",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-categories/{id}/restore": {
			"post": {
				"summary": "Restore an archived procedure category",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-categories/reorder": {
			"post": {
				"summary": "Reorder procedure categories",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ProcedureCategory"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/recall-types": {
			"get": {
				"summary": "List recall types",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/RecallType"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a recall type",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"intervalMonths": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name",
									"intervalMonths"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"intervalMonths": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"intervalMonths",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/recall-types/{id}": {
			"patch": {
				"summary": "Update a recall type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"intervalMonths": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"intervalMonths": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"intervalMonths",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/recall-types/{id}/archive": {
			"post": {
				"summary": "Archive a recall type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"intervalMonths": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"intervalMonths",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/recall-types/{id}/restore": {
			"post": {
				"summary": "Restore an archived recall type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"intervalMonths": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"intervalMonths",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/recall-types/reorder": {
			"post": {
				"summary": "Reorder recall types",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/RecallType"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/note-templates": {
			"get": {
				"summary": "List note templates",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalNoteTemplate"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a note template",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"category": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"body": {},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"userId",
										"name",
										"category",
										"body",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/note-templates/{id}": {
			"patch": {
				"summary": "Update a note template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"category": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"body": {},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"userId",
										"name",
										"category",
										"body",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/note-templates/{id}/archive": {
			"post": {
				"summary": "Archive a note template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"userId",
										"name",
										"category",
										"body",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/note-templates/{id}/restore": {
			"post": {
				"summary": "Restore an archived note template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"userId",
										"name",
										"category",
										"body",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/note-templates/reorder": {
			"post": {
				"summary": "Reorder note templates",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalNoteTemplate"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-codes": {
			"get": {
				"summary": "List procedure codes",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ProcedureCode"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a procedure code",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"code": {
										"type": "string",
										"minLength": 1,
										"maxLength": 32
									},
									"kind": {
										"type": "string",
										"enum": [
											"cdt",
											"practice",
											"nhs_band_item",
											"retail",
											"finding"
										]
									},
									"standardId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"patientName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"categoryId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentArea": {
										"type": "string",
										"enum": [
											"none",
											"surface",
											"tooth",
											"root",
											"quadrant",
											"arch",
											"mouth",
											"area"
										]
									},
									"defaultDurationMin": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"recallTypeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"requiresNote": {
										"type": "boolean"
									},
									"nhsBand": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"1",
													"3",
													"2a",
													"2b",
													"2c",
													"urgent",
													"reg11",
													"fluoride_varnish",
													"ortho_assess",
													"ortho_treat",
													"free_repair"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"taxTreatment": {
										"type": "string",
										"enum": [
											"exempt",
											"standard",
											"zero",
											"none"
										]
									},
									"billToInsurance": {
										"type": "boolean"
									},
									"chartShape": {
										"type": "string",
										"enum": [
											"none",
											"surface",
											"large_circle",
											"small_circle",
											"bar",
											"post",
											"implant",
											"absent",
											"cross",
											"square",
											"triangle",
											"text"
										]
									},
									"chartColour": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-f]{6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"chartText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 12
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"code",
									"kind",
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"code": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cdt",
												"practice",
												"nhs_band_item",
												"retail",
												"finding"
											]
										},
										"isAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"cdt",
														"snomed"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categoryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentArea": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"tooth",
												"root",
												"quadrant",
												"arch",
												"mouth",
												"area"
											]
										},
										"defaultDurationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"recallTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresNote": {
											"type": "boolean"
										},
										"nhsBand": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"billToInsurance": {
											"type": "boolean"
										},
										"chartShape": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"large_circle",
												"small_circle",
												"bar",
												"post",
												"implant",
												"absent",
												"cross",
												"square",
												"triangle",
												"text"
											]
										},
										"chartColour": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"code",
										"kind",
										"isAct",
										"standardId",
										"standardSystem",
										"name",
										"patientName",
										"categoryId",
										"treatmentArea",
										"defaultDurationMin",
										"recallTypeId",
										"requiresNote",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"source",
										"active",
										"position",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-codes/{id}": {
			"patch": {
				"summary": "Update a procedure code",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"code": {
										"type": "string",
										"minLength": 1,
										"maxLength": 32
									},
									"kind": {
										"type": "string",
										"enum": [
											"cdt",
											"practice",
											"nhs_band_item",
											"retail",
											"finding"
										]
									},
									"standardId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"patientName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"categoryId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentArea": {
										"type": "string",
										"enum": [
											"none",
											"surface",
											"tooth",
											"root",
											"quadrant",
											"arch",
											"mouth",
											"area"
										]
									},
									"defaultDurationMin": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"recallTypeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"requiresNote": {
										"type": "boolean"
									},
									"nhsBand": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"1",
													"3",
													"2a",
													"2b",
													"2c",
													"urgent",
													"reg11",
													"fluoride_varnish",
													"ortho_assess",
													"ortho_treat",
													"free_repair"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"taxTreatment": {
										"type": "string",
										"enum": [
											"exempt",
											"standard",
											"zero",
											"none"
										]
									},
									"billToInsurance": {
										"type": "boolean"
									},
									"chartShape": {
										"type": "string",
										"enum": [
											"none",
											"surface",
											"large_circle",
											"small_circle",
											"bar",
											"post",
											"implant",
											"absent",
											"cross",
											"square",
											"triangle",
											"text"
										]
									},
									"chartColour": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-f]{6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"chartText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 12
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"code": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cdt",
												"practice",
												"nhs_band_item",
												"retail",
												"finding"
											]
										},
										"isAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"cdt",
														"snomed"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categoryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentArea": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"tooth",
												"root",
												"quadrant",
												"arch",
												"mouth",
												"area"
											]
										},
										"defaultDurationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"recallTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresNote": {
											"type": "boolean"
										},
										"nhsBand": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"billToInsurance": {
											"type": "boolean"
										},
										"chartShape": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"large_circle",
												"small_circle",
												"bar",
												"post",
												"implant",
												"absent",
												"cross",
												"square",
												"triangle",
												"text"
											]
										},
										"chartColour": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"code",
										"kind",
										"isAct",
										"standardId",
										"standardSystem",
										"name",
										"patientName",
										"categoryId",
										"treatmentArea",
										"defaultDurationMin",
										"recallTypeId",
										"requiresNote",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"source",
										"active",
										"position",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-codes/{id}/archive": {
			"post": {
				"summary": "Archive a procedure code",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"code": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cdt",
												"practice",
												"nhs_band_item",
												"retail",
												"finding"
											]
										},
										"isAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"cdt",
														"snomed"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categoryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentArea": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"tooth",
												"root",
												"quadrant",
												"arch",
												"mouth",
												"area"
											]
										},
										"defaultDurationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"recallTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresNote": {
											"type": "boolean"
										},
										"nhsBand": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"billToInsurance": {
											"type": "boolean"
										},
										"chartShape": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"large_circle",
												"small_circle",
												"bar",
												"post",
												"implant",
												"absent",
												"cross",
												"square",
												"triangle",
												"text"
											]
										},
										"chartColour": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"code",
										"kind",
										"isAct",
										"standardId",
										"standardSystem",
										"name",
										"patientName",
										"categoryId",
										"treatmentArea",
										"defaultDurationMin",
										"recallTypeId",
										"requiresNote",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"source",
										"active",
										"position",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-codes/{id}/restore": {
			"post": {
				"summary": "Restore an archived procedure code",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"code": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cdt",
												"practice",
												"nhs_band_item",
												"retail",
												"finding"
											]
										},
										"isAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"cdt",
														"snomed"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categoryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentArea": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"tooth",
												"root",
												"quadrant",
												"arch",
												"mouth",
												"area"
											]
										},
										"defaultDurationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"recallTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresNote": {
											"type": "boolean"
										},
										"nhsBand": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"billToInsurance": {
											"type": "boolean"
										},
										"chartShape": {
											"type": "string",
											"enum": [
												"none",
												"surface",
												"large_circle",
												"small_circle",
												"bar",
												"post",
												"implant",
												"absent",
												"cross",
												"square",
												"triangle",
												"text"
											]
										},
										"chartColour": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"code",
										"kind",
										"isAct",
										"standardId",
										"standardSystem",
										"name",
										"patientName",
										"categoryId",
										"treatmentArea",
										"defaultDurationMin",
										"recallTypeId",
										"requiresNote",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"source",
										"active",
										"position",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/procedure-codes/reorder": {
			"post": {
				"summary": "Reorder procedure codes",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ProcedureCode"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/fee-schedules": {
			"get": {
				"summary": "List fee schedules",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/FeeSchedule"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a fee schedule",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"locationId",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/fee-schedules/{id}": {
			"patch": {
				"summary": "Update a fee schedule",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"locationId",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/fee-schedules/{id}/archive": {
			"post": {
				"summary": "Archive a fee schedule",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"locationId",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/fee-schedules/{id}/restore": {
			"post": {
				"summary": "Restore an archived fee schedule",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"locationId",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/fee-schedules/{id}/items": {
			"get": {
				"summary": "List the fee revisions of a schedule",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "includeRetired",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/FeeScheduleItem"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Add a fee revision to a schedule",
				"tags": [
					"settings"
				],
				"description": "Fee revisions are immutable: a change is a new row from its effective date; a mistake is retired.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureCodeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"feeCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"unitCountFrom": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"effectiveFrom": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"procedureCodeId",
									"feeCents",
									"effectiveFrom"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"feeScheduleId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"unitCountFrom": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"effectiveFrom": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"retiredAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"feeScheduleId",
										"procedureCodeId",
										"codeIsAct",
										"unitCountFrom",
										"effectiveFrom",
										"feeCents",
										"currency",
										"retiredAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/fee-schedules/{id}/items/{itemId}/retire": {
			"post": {
				"summary": "Retire a fee revision",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "itemId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"feeScheduleId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"unitCountFrom": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"effectiveFrom": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"retiredAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"feeScheduleId",
										"procedureCodeId",
										"codeIsAct",
										"unitCountFrom",
										"effectiveFrom",
										"feeCents",
										"currency",
										"retiredAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/price-lists": {
			"get": {
				"summary": "List price lists",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PriceList"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a price list",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"patientName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"kind": {
										"type": "string",
										"enum": [
											"private",
											"nhs",
											"membership"
										]
									},
									"feeScheduleId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"membershipProvider": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"membershipBand": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name",
									"kind",
									"feeScheduleId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"private",
												"nhs",
												"membership"
											]
										},
										"feeScheduleId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"membershipProvider": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipBand": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"patientName",
										"kind",
										"feeScheduleId",
										"membershipProvider",
										"membershipBand",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/price-lists/{id}": {
			"patch": {
				"summary": "Update a price list",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"patientName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"kind": {
										"type": "string",
										"enum": [
											"private",
											"nhs",
											"membership"
										]
									},
									"feeScheduleId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"membershipProvider": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"membershipBand": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"private",
												"nhs",
												"membership"
											]
										},
										"feeScheduleId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"membershipProvider": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipBand": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"patientName",
										"kind",
										"feeScheduleId",
										"membershipProvider",
										"membershipBand",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/price-lists/{id}/archive": {
			"post": {
				"summary": "Archive a price list",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"private",
												"nhs",
												"membership"
											]
										},
										"feeScheduleId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"membershipProvider": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipBand": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"patientName",
										"kind",
										"feeScheduleId",
										"membershipProvider",
										"membershipBand",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/price-lists/{id}/restore": {
			"post": {
				"summary": "Restore an archived price list",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"patientName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"private",
												"nhs",
												"membership"
											]
										},
										"feeScheduleId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"membershipProvider": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipBand": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"patientName",
										"kind",
										"feeScheduleId",
										"membershipProvider",
										"membershipBand",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/price-lists/reorder": {
			"post": {
				"summary": "Reorder price lists",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PriceList"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/payment-methods": {
			"get": {
				"summary": "List payment methods",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PaymentMethod"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a payment method",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"kind": {
										"type": "string",
										"enum": [
											"cash",
											"card",
											"terminal",
											"bank_transfer",
											"cheque",
											"online",
											"finance",
											"other"
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"active": {
										"type": "boolean"
									}
								},
								"required": [
									"name",
									"kind"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cash",
												"card",
												"terminal",
												"bank_transfer",
												"cheque",
												"online",
												"finance",
												"other"
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/payment-methods/{id}": {
			"patch": {
				"summary": "Update a payment method",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"kind": {
										"type": "string",
										"enum": [
											"cash",
											"card",
											"terminal",
											"bank_transfer",
											"cheque",
											"online",
											"finance",
											"other"
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"active": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cash",
												"card",
												"terminal",
												"bank_transfer",
												"cheque",
												"online",
												"finance",
												"other"
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/payment-methods/{id}/archive": {
			"post": {
				"summary": "Archive a payment method",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cash",
												"card",
												"terminal",
												"bank_transfer",
												"cheque",
												"online",
												"finance",
												"other"
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/payment-methods/{id}/restore": {
			"post": {
				"summary": "Restore an archived payment method",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"cash",
												"card",
												"terminal",
												"bank_transfer",
												"cheque",
												"online",
												"finance",
												"other"
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/payment-methods/reorder": {
			"post": {
				"summary": "Reorder payment methods",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PaymentMethod"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/adjustment-types": {
			"get": {
				"summary": "List adjustment types",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AdjustmentType"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a adjustment type",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"direction": {
										"type": "string",
										"enum": [
											"debit",
											"credit"
										]
									},
									"isWriteOff": {
										"type": "boolean"
									},
									"isInsurance": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"active": {
										"type": "boolean"
									}
								},
								"required": [
									"name",
									"direction"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"direction": {
											"type": "string",
											"enum": [
												"debit",
												"credit"
											]
										},
										"isWriteOff": {
											"type": "boolean"
										},
										"isInsurance": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"direction",
										"isWriteOff",
										"isInsurance",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/adjustment-types/{id}": {
			"patch": {
				"summary": "Update a adjustment type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"direction": {
										"type": "string",
										"enum": [
											"debit",
											"credit"
										]
									},
									"isWriteOff": {
										"type": "boolean"
									},
									"isInsurance": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"active": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"direction": {
											"type": "string",
											"enum": [
												"debit",
												"credit"
											]
										},
										"isWriteOff": {
											"type": "boolean"
										},
										"isInsurance": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"direction",
										"isWriteOff",
										"isInsurance",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/adjustment-types/{id}/archive": {
			"post": {
				"summary": "Archive a adjustment type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"direction": {
											"type": "string",
											"enum": [
												"debit",
												"credit"
											]
										},
										"isWriteOff": {
											"type": "boolean"
										},
										"isInsurance": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"direction",
										"isWriteOff",
										"isInsurance",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/adjustment-types/{id}/restore": {
			"post": {
				"summary": "Restore an archived adjustment type",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"direction": {
											"type": "string",
											"enum": [
												"debit",
												"credit"
											]
										},
										"isWriteOff": {
											"type": "boolean"
										},
										"isInsurance": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"direction",
										"isWriteOff",
										"isInsurance",
										"position",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/adjustment-types/reorder": {
			"post": {
				"summary": "Reorder adjustment types",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AdjustmentType"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/price-lists/{id}/items": {
			"get": {
				"summary": "List a price list's overrides",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PriceListItem"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/price-lists/{id}/items/{procedureCodeId}": {
			"put": {
				"summary": "Set a price list's override for one code",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "procedureCodeId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"feeCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"taxTreatment": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"exempt",
													"standard",
													"zero",
													"none"
												]
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"priceListId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"taxTreatment": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"feeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"priceListId",
										"procedureCodeId",
										"codeIsAct",
										"taxTreatment",
										"feeCents",
										"currency",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Remove a price list's override for one code",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "procedureCodeId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content",
						"content": {
							"application/json": {
								"schema": {
									"type": "null"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/form-templates": {
			"get": {
				"summary": "List patient form templates (current versions, archived on request)",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientFormTemplate"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a patient form template (version 1)",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"key": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64,
										"pattern": "^[a-z0-9_-]+$"
									},
									"kind": {
										"type": "string",
										"enum": [
											"medical_history",
											"consent",
											"questionnaire",
											"custom"
										]
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"schema": {
										"$ref": "#/components/schemas/PatientFormDefinition"
									},
									"attestationText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"expiresAfterDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"requiresSignature": {
										"type": "boolean"
									},
									"requiresReview": {
										"type": "boolean"
									}
								},
								"required": [
									"key",
									"kind",
									"name",
									"schema"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"kind": {
											"type": "string",
											"enum": [
												"medical_history",
												"consent",
												"questionnaire",
												"custom"
											]
										},
										"name": {
											"type": "string"
										},
										"schema": {},
										"attestationText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAfterDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"requiresSignature": {
											"type": "boolean"
										},
										"requiresReview": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"key",
										"version",
										"kind",
										"name",
										"schema",
										"attestationText",
										"expiresAfterDays",
										"requiresSignature",
										"requiresReview",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/form-templates/{id}/versions": {
			"post": {
				"summary": "Publish a new version of a form template",
				"tags": [
					"settings"
				],
				"description": "Templates are sealed once used: a change is a new version row and the previous version is archived in the same transaction. Submissions keep citing the version they answered.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"medical_history",
											"consent",
											"questionnaire",
											"custom"
										]
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"schema": {
										"$ref": "#/components/schemas/PatientFormDefinition"
									},
									"attestationText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"expiresAfterDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"requiresSignature": {
										"type": "boolean"
									},
									"requiresReview": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"kind": {
											"type": "string",
											"enum": [
												"medical_history",
												"consent",
												"questionnaire",
												"custom"
											]
										},
										"name": {
											"type": "string"
										},
										"schema": {},
										"attestationText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAfterDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"requiresSignature": {
											"type": "boolean"
										},
										"requiresReview": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"key",
										"version",
										"kind",
										"name",
										"schema",
										"attestationText",
										"expiresAfterDays",
										"requiresSignature",
										"requiresReview",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/form-templates/{id}/archive": {
			"post": {
				"summary": "Archive a form template version",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"kind": {
											"type": "string",
											"enum": [
												"medical_history",
												"consent",
												"questionnaire",
												"custom"
											]
										},
										"name": {
											"type": "string"
										},
										"schema": {},
										"attestationText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAfterDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"requiresSignature": {
											"type": "boolean"
										},
										"requiresReview": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"key",
										"version",
										"kind",
										"name",
										"schema",
										"attestationText",
										"expiresAfterDays",
										"requiresSignature",
										"requiresReview",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/code-standards": {
			"get": {
				"summary": "Search the coding standards the practice may see",
				"tags": [
					"settings"
				],
				"description": "SNOMED rows for every practice; CDT rows only while the practice holds an unrevoked licence entitlement for the edition (04 §5).",
				"parameters": [
					{
						"name": "system",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"cdt",
								"snomed"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 200
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 64
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 200
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CodeStandard"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/code-entitlements": {
			"get": {
				"summary": "The practice's coding-standard licence entitlements",
				"tags": [
					"settings"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CodeStandardEntitlement"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical/defaults": {
			"get": {
				"summary": "What restoring the clinical defaults would add",
				"tags": [
					"settings"
				],
				"description": "The country's default pack — codes with chart icons and indicative fees, findings, recall types, fee schedule and price lists, appointment types, rooms, treatment / note / letter / form templates — compared with what the practice has. Identity is the code, the form key or the name; the practice's own rows are never touched.",
				"parameters": [
					{
						"name": "only",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"missing": {
											"type": "object",
											"propertyNames": {
												"type": "string",
												"enum": [
													"categories",
													"recallTypes",
													"procedureCodes",
													"feeSchedules",
													"priceLists",
													"fees",
													"formTemplates",
													"noteTemplates",
													"letterTemplates",
													"treatmentTemplates",
													"appointmentTypes",
													"operatories"
												]
											},
											"additionalProperties": {
												"type": "array",
												"items": {
													"type": "string"
												}
											},
											"required": [
												"categories",
												"recallTypes",
												"procedureCodes",
												"feeSchedules",
												"priceLists",
												"fees",
												"formTemplates",
												"noteTemplates",
												"letterTemplates",
												"treatmentTemplates",
												"appointmentTypes",
												"operatories"
											]
										},
										"nhsChargesOnFile": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										}
									},
									"required": [
										"missing",
										"nhsChargesOnFile",
										"currency"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Restore the clinical defaults",
				"tags": [
					"settings"
				],
				"description": "Adds every default the practice is missing (or only the sections named), in dependency order. Installing twice adds nothing. GB practices in England also get the NHS price list and band items, priced from the frozen NHS evidence only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"only": {
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"categories",
												"recallTypes",
												"procedureCodes",
												"feeSchedules",
												"priceLists",
												"fees",
												"formTemplates",
												"noteTemplates",
												"letterTemplates",
												"treatmentTemplates",
												"appointmentTypes",
												"operatories"
											]
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"installed": {
											"type": "object",
											"propertyNames": {
												"type": "string",
												"enum": [
													"categories",
													"recallTypes",
													"procedureCodes",
													"feeSchedules",
													"priceLists",
													"fees",
													"formTemplates",
													"noteTemplates",
													"letterTemplates",
													"treatmentTemplates",
													"appointmentTypes",
													"operatories"
												]
											},
											"additionalProperties": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"required": [
												"categories",
												"recallTypes",
												"procedureCodes",
												"feeSchedules",
												"priceLists",
												"fees",
												"formTemplates",
												"noteTemplates",
												"letterTemplates",
												"treatmentTemplates",
												"appointmentTypes",
												"operatories"
											]
										},
										"nhsChargesOnFile": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"installed",
										"nhsChargesOnFile"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/frequent-codes": {
			"get": {
				"summary": "The practice's most-charted codes per tooth type",
				"tags": [
					"pms"
				],
				"description": "Live procedures (not voided, superseded or referred out) counted by tooth family and code, the top five per family, most charted first. Practice-wide aggregates: no patient is named, so the read is not a clinical read.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"toothType": {
														"type": "string",
														"enum": [
															"upper_incisor",
															"upper_canine",
															"upper_premolar",
															"upper_molar",
															"lower_incisor",
															"lower_canine",
															"lower_premolar",
															"lower_molar",
															"upper_deciduous_incisor",
															"upper_deciduous_canine",
															"upper_deciduous_molar",
															"lower_deciduous_incisor",
															"lower_deciduous_canine",
															"lower_deciduous_molar"
														]
													},
													"procedureCodeId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"count": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"toothType",
													"procedureCodeId",
													"count"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}": {
			"get": {
				"summary": "A patient's chart: every finding and procedure",
				"tags": [
					"pms"
				],
				"description": "Findings and procedures of one patient, every status, newest first — superseded and voided rows included so the history stays legible. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"findings": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalFinding"
											}
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Procedure"
											}
										}
									},
									"required": [
										"findings",
										"procedures"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/findings": {
			"post": {
				"summary": "Record a finding",
				"tags": [
					"pms"
				],
				"description": "Professional act `record_finding`: the signed-in member's linked practitioner, at the location's jurisdiction. Recorded on write; a correction is a superseding row.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"condition",
											"diagnosis",
											"existing_restoration",
											"existing_other"
										]
									},
									"findingCodeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"description": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"site": {
										"type": "object",
										"properties": {
											"siteKind": {
												"default": "none",
												"type": "string",
												"enum": [
													"none",
													"tooth",
													"root",
													"implant",
													"supernumerary",
													"area"
												]
											},
											"tooth": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"root": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"single",
															"mesial",
															"distal",
															"buccal",
															"lingual",
															"palatal",
															"mesiobuccal",
															"distobuccal",
															"mesiolingual",
															"distolingual"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"supernumeraryPosition": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 40
													},
													{
														"type": "null"
													}
												]
											},
											"surfaces": {
												"default": [],
												"maxItems": 6,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"M",
														"O",
														"D",
														"B",
														"L",
														"I"
													]
												}
											},
											"area": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"upper_arch",
															"lower_arch",
															"upper_right",
															"upper_left",
															"lower_right",
															"lower_left",
															"anterior",
															"posterior",
															"full_mouth",
															"soft_tissue"
														]
													},
													{
														"type": "null"
													}
												]
											}
										}
									},
									"observedOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"site",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"condition",
												"diagnosis",
												"existing_restoration",
												"existing_other"
											]
										},
										"findingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"treated",
												"resolved",
												"invalidated",
												"superseded"
											]
										},
										"observedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"observedByPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"observedCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedByProcedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"credentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"resolvedAt",
										"resolvedByPractitionerId",
										"resolvedCredentialRevisionId",
										"kind",
										"findingCodeId",
										"codeIsAct",
										"standardId",
										"standardSystem",
										"description",
										"siteKind",
										"tooth",
										"root",
										"surfaces",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/findings/{id}/resolve": {
			"post": {
				"summary": "Resolve a finding",
				"tags": [
					"pms"
				],
				"description": "Professional act `resolve_finding` on an active finding.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"resolvedOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"resolvedReason": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"resolvedOn",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"condition",
												"diagnosis",
												"existing_restoration",
												"existing_other"
											]
										},
										"findingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"treated",
												"resolved",
												"invalidated",
												"superseded"
											]
										},
										"observedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"observedByPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"observedCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedByProcedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"credentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"resolvedAt",
										"resolvedByPractitionerId",
										"resolvedCredentialRevisionId",
										"kind",
										"findingCodeId",
										"codeIsAct",
										"standardId",
										"standardSystem",
										"description",
										"siteKind",
										"tooth",
										"root",
										"surfaces",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/findings/{id}/invalidate": {
			"post": {
				"summary": "Mark a finding as entered in error",
				"tags": [
					"pms"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"condition",
												"diagnosis",
												"existing_restoration",
												"existing_other"
											]
										},
										"findingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"treated",
												"resolved",
												"invalidated",
												"superseded"
											]
										},
										"observedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"observedByPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"observedCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedByProcedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"credentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"resolvedAt",
										"resolvedByPractitionerId",
										"resolvedCredentialRevisionId",
										"kind",
										"findingCodeId",
										"codeIsAct",
										"standardId",
										"standardSystem",
										"description",
										"siteKind",
										"tooth",
										"root",
										"surfaces",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/findings/{id}/supersede": {
			"post": {
				"summary": "Correct a finding with a superseding row",
				"tags": [
					"pms"
				],
				"description": "Records the corrected finding as a new row that names the old one; the old row is sealed as superseded and nothing else on it changes.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"condition",
											"diagnosis",
											"existing_restoration",
											"existing_other"
										]
									},
									"findingCodeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"description": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"site": {
										"type": "object",
										"properties": {
											"siteKind": {
												"default": "none",
												"type": "string",
												"enum": [
													"none",
													"tooth",
													"root",
													"implant",
													"supernumerary",
													"area"
												]
											},
											"tooth": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"root": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"single",
															"mesial",
															"distal",
															"buccal",
															"lingual",
															"palatal",
															"mesiobuccal",
															"distobuccal",
															"mesiolingual",
															"distolingual"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"supernumeraryPosition": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 40
													},
													{
														"type": "null"
													}
												]
											},
											"surfaces": {
												"default": [],
												"maxItems": 6,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"M",
														"O",
														"D",
														"B",
														"L",
														"I"
													]
												}
											},
											"area": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"upper_arch",
															"lower_arch",
															"upper_right",
															"upper_left",
															"lower_right",
															"lower_left",
															"anterior",
															"posterior",
															"full_mouth",
															"soft_tissue"
														]
													},
													{
														"type": "null"
													}
												]
											}
										}
									},
									"observedOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"site",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"condition",
												"diagnosis",
												"existing_restoration",
												"existing_other"
											]
										},
										"findingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"treated",
												"resolved",
												"invalidated",
												"superseded"
											]
										},
										"observedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"observedByPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"observedCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedByProcedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"invalidatedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"credentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"resolvedAt",
										"resolvedByPractitionerId",
										"resolvedCredentialRevisionId",
										"kind",
										"findingCodeId",
										"codeIsAct",
										"standardId",
										"standardSystem",
										"description",
										"siteKind",
										"tooth",
										"root",
										"surfaces",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/procedures": {
			"post": {
				"summary": "Plan a procedure",
				"tags": [
					"pms"
				],
				"description": "Professional act `record_procedure`: a planned, recorded act priced from the named price list's current fee revision (a code without a fee cannot be charted natively). Supervised professions name their supervising dentist.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureCodeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"site": {
										"type": "object",
										"properties": {
											"siteKind": {
												"default": "none",
												"type": "string",
												"enum": [
													"none",
													"tooth",
													"root",
													"implant",
													"supernumerary",
													"area"
												]
											},
											"tooth": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"root": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"single",
															"mesial",
															"distal",
															"buccal",
															"lingual",
															"palatal",
															"mesiobuccal",
															"distobuccal",
															"mesiolingual",
															"distolingual"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"supernumeraryPosition": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 40
													},
													{
														"type": "null"
													}
												]
											},
											"surfaces": {
												"default": [],
												"maxItems": 6,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"M",
														"O",
														"D",
														"B",
														"L",
														"I"
													]
												}
											},
											"area": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"upper_arch",
															"lower_arch",
															"upper_right",
															"upper_left",
															"lower_right",
															"lower_left",
															"anterior",
															"posterior",
															"full_mouth",
															"soft_tissue"
														]
													},
													{
														"type": "null"
													}
												]
											}
										}
									},
									"quantity": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"unitCount": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"priceListId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"supervisingPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentPlanId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"procedureCodeId",
									"site",
									"priceListId",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codeEdition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"code": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categorySnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsBandSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatmentSnapshot": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"chartShapeSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"none",
														"surface",
														"large_circle",
														"small_circle",
														"bar",
														"post",
														"implant",
														"absent",
														"cross",
														"square",
														"triangle",
														"text"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartTextSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"planned",
												"in_progress",
												"completed",
												"referred_out"
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"supernumeraryPosition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"quantity": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"serviceDate": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeUnknown": {
											"type": "boolean"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceEstimateCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"area",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/procedures/{id}/start": {
			"post": {
				"summary": "Mark a planned procedure as in progress",
				"tags": [
					"pms"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"serviceDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codeEdition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"code": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categorySnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsBandSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatmentSnapshot": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"chartShapeSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"none",
														"surface",
														"large_circle",
														"small_circle",
														"bar",
														"post",
														"implant",
														"absent",
														"cross",
														"square",
														"triangle",
														"text"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartTextSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"planned",
												"in_progress",
												"completed",
												"referred_out"
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"supernumeraryPosition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"quantity": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"serviceDate": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeUnknown": {
											"type": "boolean"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceEstimateCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"area",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/procedures/{id}/complete": {
			"post": {
				"summary": "Complete a procedure",
				"tags": [
					"pms"
				],
				"description": "Professional act `complete_procedure`: stamps the treating practitioner, location, service date and completion evidence. The fee columns never change.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"serviceDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"supervisingPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codeEdition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"code": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categorySnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsBandSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatmentSnapshot": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"chartShapeSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"none",
														"surface",
														"large_circle",
														"small_circle",
														"bar",
														"post",
														"implant",
														"absent",
														"cross",
														"square",
														"triangle",
														"text"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartTextSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"planned",
												"in_progress",
												"completed",
												"referred_out"
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"supernumeraryPosition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"quantity": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"serviceDate": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeUnknown": {
											"type": "boolean"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceEstimateCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"area",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/procedures/{id}/refer-out": {
			"post": {
				"summary": "Hand a planned procedure to another provider",
				"tags": [
					"pms"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codeEdition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"code": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categorySnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsBandSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatmentSnapshot": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"chartShapeSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"none",
														"surface",
														"large_circle",
														"small_circle",
														"bar",
														"post",
														"implant",
														"absent",
														"cross",
														"square",
														"triangle",
														"text"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartTextSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"planned",
												"in_progress",
												"completed",
												"referred_out"
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"supernumeraryPosition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"quantity": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"serviceDate": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeUnknown": {
											"type": "boolean"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceEstimateCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"area",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/procedures/{id}/void": {
			"post": {
				"summary": "Void a recorded procedure",
				"tags": [
					"pms"
				],
				"description": "Professional act `void_sealed_row`: a fresh re-authentication (X-Smileline-Act-Evidence) is required; the five void columns are written together and nothing else changes.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"reason",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codeEdition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"code": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categorySnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsBandSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatmentSnapshot": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"chartShapeSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"none",
														"surface",
														"large_circle",
														"small_circle",
														"bar",
														"post",
														"implant",
														"absent",
														"cross",
														"square",
														"triangle",
														"text"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartTextSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"planned",
												"in_progress",
												"completed",
												"referred_out"
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"supernumeraryPosition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"quantity": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"serviceDate": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeUnknown": {
											"type": "boolean"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceEstimateCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"area",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/procedures/{id}/remove": {
			"post": {
				"summary": "Remove a planned procedure",
				"tags": [
					"pms"
				],
				"description": "The clerical void of a planned, never-completed procedure: voided under the signed-in member's name with a reason, no practitioner evidence and no fresh re-authentication. The row stays on the chart as voided. A started, completed, referred-out or sealed row is refused (409); those are voided by the professional act.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codeEdition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"code": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categorySnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsBandSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatmentSnapshot": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"chartShapeSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"none",
														"surface",
														"large_circle",
														"small_circle",
														"bar",
														"post",
														"implant",
														"absent",
														"cross",
														"square",
														"triangle",
														"text"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartTextSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"planned",
												"in_progress",
												"completed",
												"referred_out"
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"supernumeraryPosition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"quantity": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"serviceDate": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeUnknown": {
											"type": "boolean"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceEstimateCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"area",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/procedures/{id}/supersede": {
			"post": {
				"summary": "Correct a procedure with a superseding row",
				"tags": [
					"pms"
				],
				"description": "Plans the corrected procedure as a new row that names the old one; the old row is sealed. Superseding a procedure attached to an accepted plan invalidates that acceptance (04 §5).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureCodeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"site": {
										"type": "object",
										"properties": {
											"siteKind": {
												"default": "none",
												"type": "string",
												"enum": [
													"none",
													"tooth",
													"root",
													"implant",
													"supernumerary",
													"area"
												]
											},
											"tooth": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"root": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"single",
															"mesial",
															"distal",
															"buccal",
															"lingual",
															"palatal",
															"mesiobuccal",
															"distobuccal",
															"mesiolingual",
															"distolingual"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"supernumeraryPosition": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 40
													},
													{
														"type": "null"
													}
												]
											},
											"surfaces": {
												"default": [],
												"maxItems": 6,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"M",
														"O",
														"D",
														"B",
														"L",
														"I"
													]
												}
											},
											"area": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"upper_arch",
															"lower_arch",
															"upper_right",
															"upper_left",
															"lower_right",
															"lower_left",
															"anterior",
															"posterior",
															"full_mouth",
															"soft_tissue"
														]
													},
													{
														"type": "null"
													}
												]
											}
										}
									},
									"quantity": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"unitCount": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"priceListId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"supervisingPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentPlanId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"procedureCodeId",
									"site",
									"priceListId",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"codeSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codeEdition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"code": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"categorySnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsBandSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"1",
														"3",
														"2a",
														"2b",
														"2c",
														"urgent",
														"reg11",
														"fluoride_varnish",
														"ortho_assess",
														"ortho_treat",
														"free_repair"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatmentSnapshot": {
											"type": "string",
											"enum": [
												"exempt",
												"standard",
												"zero",
												"none"
											]
										},
										"chartShapeSnapshot": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"none",
														"surface",
														"large_circle",
														"small_circle",
														"bar",
														"post",
														"implant",
														"absent",
														"cross",
														"square",
														"triangle",
														"text"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"chartTextSnapshot": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"planned",
												"in_progress",
												"completed",
												"referred_out"
											]
										},
										"siteKind": {
											"type": "string",
											"enum": [
												"none",
												"tooth",
												"root",
												"implant",
												"supernumerary",
												"area"
											]
										},
										"tooth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"root": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"single",
														"mesial",
														"distal",
														"buccal",
														"lingual",
														"palatal",
														"mesiobuccal",
														"distobuccal",
														"mesiolingual",
														"distolingual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"supernumeraryPosition": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"area": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"upper_arch",
														"lower_arch",
														"upper_right",
														"upper_left",
														"lower_right",
														"lower_left",
														"anterior",
														"posterior",
														"full_mouth",
														"soft_tissue"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"quantity": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"serviceDate": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleItemId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"feeUnknown": {
											"type": "boolean"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceEstimateCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededById": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recordedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"area",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/work": {
			"get": {
				"summary": "Clinical storage work that is not complete",
				"tags": [
					"Clinical storage"
				],
				"description": "Every backup-copy work row that is still open, reserved, parked, or waiting for its primary verification — the review list of 07 §7. Completed rows are not listed.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalStorageWork"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/work/{id}/replay": {
			"post": {
				"summary": "Replay one storage work row",
				"tags": [
					"Clinical storage"
				],
				"description": "An unverified primary is read back and sealed; a parked backup copy re-arms its attempt budget and reopens for the copier. Anything else is refused.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"documentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"keyVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"attemptCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"lastAttemptAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"deadlineAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"parkedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseToken": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseExpiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"state": {
											"type": "string",
											"enum": [
												"awaiting_primary_verification",
												"open",
												"reserved",
												"completed",
												"parked"
											]
										},
										"reservedKeyVersion": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"mime": {
											"type": "string"
										},
										"bytes": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"documentId",
										"keyVersion",
										"attemptCount",
										"lastAttemptAt",
										"deadlineAt",
										"parkedAt",
										"leaseToken",
										"leaseExpiresAt",
										"state",
										"reservedKeyVersion",
										"lastError",
										"completedAt",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes",
										"patientId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/deletions": {
			"get": {
				"summary": "Clinical document deletions that are not complete",
				"tags": [
					"Clinical storage"
				],
				"description": "Every deletion row of the practice whose backup copy is still present: requested, in progress, waiting for the backup account's thirty-day window, or parked. Nothing is deleted before its retention date, and a completed row is not listed.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalStorageDeletion"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/deletions/{id}/veto": {
			"post": {
				"summary": "Veto one deletion",
				"tags": [
					"Clinical storage"
				],
				"description": "Parks the row on the primary side: it leaves the backup manifest at once and is never resumed automatically. A primary object already removed stays removed; the backup copy is retained. Replay re-arms the row.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"documentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"retention_expiry",
												"erasure",
												"rotation_retire"
											]
										},
										"keyVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"requestedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"requestedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"preconditionProof": {},
										"primaryDeletedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"backupDeletedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"attemptCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"lastAttemptAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"deadlineAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"parkedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseToken": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseExpiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"mime": {
											"type": "string"
										},
										"bytes": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"holdActive": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"organizationId",
										"documentId",
										"kind",
										"keyVersion",
										"generation",
										"requestedAt",
										"requestedById",
										"preconditionProof",
										"primaryDeletedAt",
										"backupDeletedAt",
										"attemptCount",
										"lastAttemptAt",
										"deadlineAt",
										"parkedAt",
										"leaseToken",
										"leaseExpiresAt",
										"lastError",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes",
										"patientId",
										"holdActive"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/deletions/{id}/replay": {
			"post": {
				"summary": "Replay one parked deletion",
				"tags": [
					"Clinical storage"
				],
				"description": "Re-arms a parked deletion with a fresh attempt budget. The executor revalidates before touching anything, so a row whose legal hold still stands is skipped again. Anything not parked is refused.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"documentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"retention_expiry",
												"erasure",
												"rotation_retire"
											]
										},
										"keyVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"requestedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"requestedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"preconditionProof": {},
										"primaryDeletedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"backupDeletedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"attemptCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"lastAttemptAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"deadlineAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"parkedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseToken": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseExpiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"mime": {
											"type": "string"
										},
										"bytes": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"holdActive": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"organizationId",
										"documentId",
										"kind",
										"keyVersion",
										"generation",
										"requestedAt",
										"requestedById",
										"preconditionProof",
										"primaryDeletedAt",
										"backupDeletedAt",
										"attemptCount",
										"lastAttemptAt",
										"deadlineAt",
										"parkedAt",
										"leaseToken",
										"leaseExpiresAt",
										"lastError",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes",
										"patientId",
										"holdActive"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/keys": {
			"get": {
				"summary": "The cell's clinical master-key versions",
				"tags": [
					"Clinical storage"
				],
				"description": "Every master-key version of the practice's cell with its state — active, retiring while documents are rewritten under the new key, or retired once nothing is encrypted under it (07 §7). Read-only: activation is an operator action.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalKeyVersion"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/rotations": {
			"get": {
				"summary": "Parked key rotations",
				"tags": [
					"Clinical storage"
				],
				"description": "Every document key rotation of the practice that spent its attempt budget, with the last error. Rotations still in progress need nobody and are not listed.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalStorageRotation"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/rotations/{id}/replay": {
			"post": {
				"summary": "Replay one parked key rotation",
				"tags": [
					"Clinical storage"
				],
				"description": "Re-arms a parked rotation with a fresh attempt budget; it resumes from the step it was parked in. Anything not parked is refused.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"documentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"fromKeyVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"toKeyVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"state": {
											"type": "string",
											"enum": [
												"pending",
												"rewriting",
												"rewritten",
												"copied",
												"retired"
											]
										},
										"rewritingAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"rewrittenAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"copiedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"retiredAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"attemptCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"lastAttemptAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"deadlineAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"parkedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseToken": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseExpiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"mime": {
											"type": "string"
										},
										"bytes": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"documentId",
										"fromKeyVersion",
										"toKeyVersion",
										"state",
										"rewritingAt",
										"rewrittenAt",
										"copiedAt",
										"retiredAt",
										"attemptCount",
										"lastAttemptAt",
										"deadlineAt",
										"parkedAt",
										"leaseToken",
										"leaseExpiresAt",
										"lastError",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes",
										"patientId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/restore-items": {
			"get": {
				"summary": "Restored objects waiting for an owner",
				"tags": [
					"Clinical storage"
				],
				"description": "Every backup object a restore brought back that the database could not file by itself — its owner row is missing, its document is deleted, or its metadata is incomplete. Each is attached to a record or discarded from here; the generic review-queue actions refuse them.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalRestoreItem"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/restore-items/{id}/attach": {
			"post": {
				"summary": "Attach one restored object to a record",
				"tags": [
					"Clinical storage"
				],
				"description": "Reads the object back under the practice's key, writes its document, copy and copy-work rows and the child link of the chosen owner (a patient document for a patient; the document row only for an account, a staff record or a user), reopens its key version if it had been retired, and resolves the review item. Refused when the owner does not exist or the object's document already exists.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"ownerKind": {
										"type": "string",
										"enum": [
											"patient",
											"account",
											"staff_record",
											"staff_user"
										]
									},
									"ownerId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"resolutionNote": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"ownerKind",
									"ownerId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"objectKey": {
											"type": "string"
										},
										"documentId": {
											"type": "string"
										},
										"keyVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"sha256": {
											"type": "string"
										},
										"state": {
											"type": "string",
											"enum": [
												"pending",
												"needs_review",
												"resolved",
												"discarded"
											]
										},
										"receivedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"failureSummary": {
											"type": "string"
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolutionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"objectKey",
										"documentId",
										"keyVersion",
										"sha256",
										"state",
										"receivedAt",
										"failureSummary",
										"resolvedAt",
										"resolutionNote"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/restore-items/{id}/discard": {
			"post": {
				"summary": "Discard one restored object",
				"tags": [
					"Clinical storage"
				],
				"description": "Never an immediate delete: the object is filed as an organisation document of kind restore_orphan, so retention, the signed manifest, the backup account's thirty-day delay and both vetoes apply before anything is removed. The review item is marked discarded with the reason.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"resolutionNote": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1000
									}
								},
								"required": [
									"resolutionNote"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"objectKey": {
											"type": "string"
										},
										"documentId": {
											"type": "string"
										},
										"keyVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"sha256": {
											"type": "string"
										},
										"state": {
											"type": "string",
											"enum": [
												"pending",
												"needs_review",
												"resolved",
												"discarded"
											]
										},
										"receivedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"failureSummary": {
											"type": "string"
										},
										"resolvedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolutionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"objectKey",
										"documentId",
										"keyVersion",
										"sha256",
										"state",
										"receivedAt",
										"failureSummary",
										"resolvedAt",
										"resolutionNote"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}": {
			"get": {
				"summary": "A patient's documents",
				"tags": [
					"Clinical storage"
				],
				"description": "Every document filed on the patient, newest first, with its size and type. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientDocument"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Upload an image onto a patient",
				"tags": [
					"Clinical storage"
				],
				"description": "multipart/form-data with a single `file` field (jpeg, png, webp, gif or pdf; max 32 MiB — the bound is the Worker's memory, not a cost) and the fields `kind` (xray | photo), `title`, `takenOn` (optional ISO date) and `locationId`. The type is read from the bytes, never from the browser's claim (415 otherwise). The object lands in the encrypted clinical store; the same bytes uploaded again onto the same patient resume the existing document instead of creating a second one, so a retry after a lost response is safe. The write is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"multipart/form-data": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"xray",
											"photo"
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"takenOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"file": {
										"type": "string",
										"description": "The image or PDF bytes"
									}
								},
								"required": [
									"kind",
									"title",
									"locationId",
									"file"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"clinicalDocumentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"xray",
												"photo",
												"letter",
												"correspondence",
												"consent",
												"referral",
												"lab",
												"insurance",
												"invoice",
												"statement",
												"signature",
												"prescription",
												"export",
												"other"
											]
										},
										"title": {
											"type": "string"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"takenOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"upload",
												"form",
												"generated",
												"message",
												"import",
												"pms_sync"
											]
										},
										"messageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"tags": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"mime": {
											"type": "string"
										},
										"bytes": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"clinicalDocumentId",
										"kind",
										"title",
										"appointmentId",
										"takenOn",
										"source",
										"messageId",
										"tags",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"415": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/documents/{id}/link": {
			"get": {
				"summary": "A one-minute read link for one document",
				"tags": [
					"Clinical storage"
				],
				"description": "Mints an application-signed link the browser opens to stream the object; the API decrypts it server-side. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"path": {
											"type": "string"
										},
										"expiresAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"path",
										"expiresAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}": {
			"get": {
				"summary": "A patient's treatment plans",
				"tags": [
					"Treatment plans"
				],
				"description": "Every plan of the patient with its procedures, visits and snapshot summaries, newest first, plus who may sign for the patient. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"plans": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlan"
											}
										},
										"signers": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSigner"
											}
										},
										"attestation": {
											"type": "object",
											"properties": {
												"version": {
													"type": "string"
												},
												"text": {
													"type": "string"
												}
											},
											"required": [
												"version",
												"text"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"plans",
										"signers",
										"attestation"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Draft a treatment plan",
				"tags": [
					"Treatment plans"
				],
				"description": "A new draft numbered from the practice sequence, authored by the signed-in clinician, optionally with planned procedures attached.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"priceListId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"expiresAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"procedureIds": {
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"name",
									"priceListId",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"importedStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"presented",
												"accepted",
												"in_progress",
												"completed",
												"declined",
												"cancelled"
											]
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"journeyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"presentedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"declinedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalTotalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanProcedure"
											}
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanVisit"
											}
										},
										"snapshots": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSnapshot"
											}
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"practitionerId",
										"number",
										"externalReference",
										"importedStatus",
										"name",
										"status",
										"version",
										"priceListId",
										"journeyId",
										"presentedAt",
										"acceptedAt",
										"declinedAt",
										"completedAt",
										"cancelledAt",
										"expiresAt",
										"externalTotalCents",
										"currency",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"procedures",
										"visits",
										"snapshots",
										"totalCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}/{id}": {
			"patch": {
				"summary": "Edit a draft plan",
				"tags": [
					"Treatment plans"
				],
				"description": "Name, note, price list and validity of a draft. Anything presented is frozen.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"priceListId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"expiresAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"importedStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"presented",
												"accepted",
												"in_progress",
												"completed",
												"declined",
												"cancelled"
											]
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"journeyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"presentedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"declinedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalTotalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanProcedure"
											}
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanVisit"
											}
										},
										"snapshots": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSnapshot"
											}
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"practitionerId",
										"number",
										"externalReference",
										"importedStatus",
										"name",
										"status",
										"version",
										"priceListId",
										"journeyId",
										"presentedAt",
										"acceptedAt",
										"declinedAt",
										"completedAt",
										"cancelledAt",
										"expiresAt",
										"externalTotalCents",
										"currency",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"procedures",
										"visits",
										"snapshots",
										"totalCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}/{id}/procedures": {
			"put": {
				"summary": "Replace a draft plan's procedures",
				"tags": [
					"Treatment plans"
				],
				"description": "The ordered set of planned procedures the plan covers. A procedure belongs to one plan at a time and must still be planned.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureIds": {
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"procedureIds"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"importedStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"presented",
												"accepted",
												"in_progress",
												"completed",
												"declined",
												"cancelled"
											]
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"journeyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"presentedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"declinedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalTotalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanProcedure"
											}
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanVisit"
											}
										},
										"snapshots": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSnapshot"
											}
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"practitionerId",
										"number",
										"externalReference",
										"importedStatus",
										"name",
										"status",
										"version",
										"priceListId",
										"journeyId",
										"presentedAt",
										"acceptedAt",
										"declinedAt",
										"completedAt",
										"cancelledAt",
										"expiresAt",
										"externalTotalCents",
										"currency",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"procedures",
										"visits",
										"snapshots",
										"totalCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}/{id}/visits": {
			"put": {
				"summary": "Replace a draft plan's visits",
				"tags": [
					"Treatment plans"
				],
				"description": "The ordered visits of a draft plan and which of its procedures sit in each. Visit ids are client-generated: a known id updates, an unknown one creates, an omitted one is removed — except a visit that is already booked, which must stay (409 VISIT_BOOKED). A procedure may sit in one visit; one not on the plan answers 404. Presented, accepted and later plans refuse (409): reopen the plan as a new version to change its visits.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"visits": {
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"name": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 200
														},
														{
															"type": "null"
														}
													]
												},
												"durationMin": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 5,
															"maximum": 1440
														},
														{
															"type": "null"
														}
													]
												},
												"minIntervalDays": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 0,
															"maximum": 3650
														},
														{
															"type": "null"
														}
													]
												},
												"bookable": {
													"type": "boolean"
												},
												"procedureIds": {
													"type": "array",
													"items": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												}
											},
											"required": [
												"id",
												"name",
												"durationMin",
												"bookable",
												"procedureIds"
											]
										}
									}
								},
								"required": [
									"visits"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"importedStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"presented",
												"accepted",
												"in_progress",
												"completed",
												"declined",
												"cancelled"
											]
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"journeyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"presentedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"declinedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalTotalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanProcedure"
											}
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanVisit"
											}
										},
										"snapshots": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSnapshot"
											}
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"practitionerId",
										"number",
										"externalReference",
										"importedStatus",
										"name",
										"status",
										"version",
										"priceListId",
										"journeyId",
										"presentedAt",
										"acceptedAt",
										"declinedAt",
										"completedAt",
										"cancelledAt",
										"expiresAt",
										"externalTotalCents",
										"currency",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"procedures",
										"visits",
										"snapshots",
										"totalCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}/{id}/present": {
			"post": {
				"summary": "Present a plan",
				"tags": [
					"Treatment plans"
				],
				"description": "Freezes the draft as a presented snapshot under the presenter's name — a clinician with their credential revision, or a coordinator presenting an unchanged plan — renders the presentation document and files it on the patient. On a plan that is already presented, files the document again from its frozen snapshot (no new snapshot, same version).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"plan": {
											"$ref": "#/components/schemas/TreatmentPlan"
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"plan",
										"documentId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}/{id}/accept": {
			"post": {
				"summary": "Record acceptance of a presented plan",
				"tags": [
					"Treatment plans"
				],
				"description": "Files the signature as a clinical document and records the accepted snapshot of the presented version with the signer's role, name, relationship and attestation. The acceptance binds to the plan version the signer saw: a plan whose version moved since is refused (409 PLAN_VERSION_STALE, `details.current` names the live version).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"signerRole": {
										"type": "string",
										"enum": [
											"self",
											"parent",
											"guardian",
											"attorney"
										]
									},
									"signerName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"signerRelationshipId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"attestationVersion": {
										"type": "string",
										"minLength": 1,
										"maxLength": 40
									},
									"expectedPlanVersion": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"signaturePng": {
										"type": "string",
										"maxLength": 2097152,
										"pattern": "^data:image\\/(png|svg\\+xml);base64,[A-Za-z0-9+/=]+$"
									}
								},
								"required": [
									"signerRole",
									"signerName",
									"attestationVersion",
									"expectedPlanVersion",
									"signaturePng"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"importedStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"presented",
												"accepted",
												"in_progress",
												"completed",
												"declined",
												"cancelled"
											]
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"journeyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"presentedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"declinedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalTotalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanProcedure"
											}
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanVisit"
											}
										},
										"snapshots": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSnapshot"
											}
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"practitionerId",
										"number",
										"externalReference",
										"importedStatus",
										"name",
										"status",
										"version",
										"priceListId",
										"journeyId",
										"presentedAt",
										"acceptedAt",
										"declinedAt",
										"completedAt",
										"cancelledAt",
										"expiresAt",
										"externalTotalCents",
										"currency",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"procedures",
										"visits",
										"snapshots",
										"totalCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}/{id}/transition": {
			"post": {
				"summary": "Move a plan along its lifecycle",
				"tags": [
					"Treatment plans"
				],
				"description": "Decline or cancel, start treatment on an accepted plan, complete it, or reopen it as a new draft version (the earlier snapshots stay as history). Declining removes the plan's planned, never-completed procedures from the chart (a clerical void under the declining member's name, 04 §5).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"transition": {
										"type": "string",
										"enum": [
											"decline",
											"cancel",
											"start",
											"complete",
											"reopen"
										]
									}
								},
								"required": [
									"transition"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"importedStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"presented",
												"accepted",
												"in_progress",
												"completed",
												"declined",
												"cancelled"
											]
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"journeyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"presentedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"declinedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalTotalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanProcedure"
											}
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanVisit"
											}
										},
										"snapshots": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSnapshot"
											}
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"practitionerId",
										"number",
										"externalReference",
										"importedStatus",
										"name",
										"status",
										"version",
										"priceListId",
										"journeyId",
										"presentedAt",
										"acceptedAt",
										"declinedAt",
										"completedAt",
										"cancelledAt",
										"expiresAt",
										"externalTotalCents",
										"currency",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"procedures",
										"visits",
										"snapshots",
										"totalCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notes/{patientId}": {
			"get": {
				"summary": "A patient's clinical notes",
				"tags": [
					"Clinical notes"
				],
				"description": "Every note of the patient, newest first, drafts included. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalNote"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Start a clinical note",
				"tags": [
					"Clinical notes"
				],
				"description": "A draft under the author's registration (a nurse names the supervising dentist). Drafts are edited in place; completion seals the body; an addendum is a new note against a completed one.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"clinical",
											"procedure",
											"progress"
										]
									},
									"body": {},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"procedureId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"templateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"supervisingPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"addendumOfId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"body",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"authorCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"clinical",
												"procedure",
												"progress"
											]
										},
										"templateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"type": "string"
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"signedPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"addendumOfId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"authorCredentialRevisionId",
										"appointmentId",
										"procedureId",
										"kind",
										"templateId",
										"body",
										"bodyText",
										"completedAt",
										"signedAt",
										"signedById",
										"signedPractitionerId",
										"signedCredentialRevisionId",
										"reauthenticatedAt",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"addendumOfId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notes/{patientId}/{id}": {
			"patch": {
				"summary": "Edit a draft note",
				"tags": [
					"Clinical notes"
				],
				"description": "Only the author, only while the note is a draft.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"body": {},
									"expectedUpdatedAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									}
								},
								"required": [
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"authorCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"clinical",
												"procedure",
												"progress"
											]
										},
										"templateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"type": "string"
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"signedPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"addendumOfId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"authorCredentialRevisionId",
										"appointmentId",
										"procedureId",
										"kind",
										"templateId",
										"body",
										"bodyText",
										"completedAt",
										"signedAt",
										"signedById",
										"signedPractitionerId",
										"signedCredentialRevisionId",
										"reauthenticatedAt",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"addendumOfId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notes/{patientId}/{id}/complete": {
			"post": {
				"summary": "Complete a note",
				"tags": [
					"Clinical notes"
				],
				"description": "Seals the body. From here the note only changes by signing; corrections are addenda.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"authorCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"clinical",
												"procedure",
												"progress"
											]
										},
										"templateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"type": "string"
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"signedPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"addendumOfId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"authorCredentialRevisionId",
										"appointmentId",
										"procedureId",
										"kind",
										"templateId",
										"body",
										"bodyText",
										"completedAt",
										"signedAt",
										"signedById",
										"signedPractitionerId",
										"signedCredentialRevisionId",
										"reauthenticatedAt",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"addendumOfId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/notes/{patientId}/{id}/sign": {
			"post": {
				"summary": "Sign a completed note",
				"tags": [
					"Clinical notes"
				],
				"description": "A fresh professional act: the signer re-authenticates (X-Smileline-Act-Evidence) and the note becomes immutable.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"authorCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"clinical",
												"procedure",
												"progress"
											]
										},
										"templateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"type": "string"
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"signedPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"signedCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supervisingCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"addendumOfId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aiPromptVersion": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"practitionerId",
										"authorCredentialRevisionId",
										"appointmentId",
										"procedureId",
										"kind",
										"templateId",
										"body",
										"bodyText",
										"completedAt",
										"signedAt",
										"signedById",
										"signedPractitionerId",
										"signedCredentialRevisionId",
										"reauthenticatedAt",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"addendumOfId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/history/{patientId}": {
			"get": {
				"summary": "A patient's medical history",
				"tags": [
					"Medical history"
				],
				"description": "Conditions, medications, allergies and alerts, archived rows included so a superseded fact stays legible. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conditions": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientMedicalCondition"
											}
										},
										"medications": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientMedication"
											}
										},
										"allergies": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientAllergy"
											}
										},
										"alerts": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientAlert"
											}
										}
									},
									"required": [
										"conditions",
										"medications",
										"allergies",
										"alerts"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/history/{patientId}/conditions": {
			"post": {
				"summary": "Record a condition",
				"tags": [
					"Medical history"
				],
				"description": "An append-first fact; pass supersedesId to correct an earlier row.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"resolved",
											"historical"
										]
									},
									"onsetOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"resolvedOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"severity": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"supersedesId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name",
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"review",
												"staff",
												"import",
												"pms_sync"
											]
										},
										"reviewId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"resolved",
												"historical"
											]
										},
										"onsetOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"resolvedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"standardId",
										"standardSystem",
										"source",
										"reviewId",
										"supersedesId",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"name",
										"status",
										"onsetOn",
										"resolvedOn",
										"severity"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/history/{patientId}/medications": {
			"post": {
				"summary": "Record a medication",
				"tags": [
					"Medical history"
				],
				"description": "An append-first fact; pass supersedesId to correct an earlier row.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"stopped",
											"historical"
										]
									},
									"dose": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"frequency": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"route": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"startedOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"stoppedOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"supersedesId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name",
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"review",
												"staff",
												"import",
												"pms_sync"
											]
										},
										"reviewId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"name": {
											"type": "string"
										},
										"dose": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"frequency": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"route": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"startedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"stoppedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"stopped",
												"historical"
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"standardId",
										"standardSystem",
										"source",
										"reviewId",
										"supersedesId",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"name",
										"dose",
										"frequency",
										"route",
										"startedOn",
										"stoppedOn",
										"status"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/history/{patientId}/allergies": {
			"post": {
				"summary": "Record an allergy",
				"tags": [
					"Medical history"
				],
				"description": "An append-first fact; pass supersedesId to correct an earlier row.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"substance": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"resolved",
											"refuted"
										]
									},
									"severity": {
										"type": "string",
										"enum": [
											"info",
											"warning",
											"critical"
										]
									},
									"reaction": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"onsetOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"supersedesId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"substance",
									"status",
									"severity"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"review",
												"staff",
												"import",
												"pms_sync"
											]
										},
										"reviewId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"substance": {
											"type": "string"
										},
										"reaction": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"type": "string",
											"enum": [
												"info",
												"warning",
												"critical"
											]
										},
										"onsetOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"resolved",
												"refuted"
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"standardId",
										"standardSystem",
										"source",
										"reviewId",
										"supersedesId",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"substance",
										"reaction",
										"severity",
										"onsetOn",
										"status"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/history/{patientId}/{kind}/{id}/archive": {
			"post": {
				"summary": "Archive a fact",
				"tags": [
					"Medical history"
				],
				"description": "The only in-place change a fact accepts; the row stays as history.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "kind",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"conditions",
								"medications",
								"allergies"
							]
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content",
						"content": {
							"application/json": {
								"schema": {
									"type": "null"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/history/{patientId}/alerts": {
			"post": {
				"summary": "Raise an alert",
				"tags": [
					"Medical history"
				],
				"description": "The banner the whole practice sees on the patient; critical alerts pop up by default.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"medical",
											"allergy",
											"medication",
											"infectious",
											"warning"
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"detail": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"severity": {
										"type": "string",
										"enum": [
											"info",
											"warning",
											"critical"
										]
									},
									"popup": {
										"type": "boolean"
									},
									"startsOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"endsOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"title",
									"severity"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"medical",
												"allergy",
												"medication",
												"infectious",
												"warning"
											]
										},
										"title": {
											"type": "string"
										},
										"detail": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"type": "string",
											"enum": [
												"info",
												"warning",
												"critical"
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"popup": {
											"type": "boolean"
										},
										"provisional": {
											"type": "boolean"
										},
										"startsOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"endsOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"formSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"medicationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"allergyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"conditionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"legacyMedicalAlert": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"kind",
										"title",
										"detail",
										"severity",
										"standardId",
										"standardSystem",
										"popup",
										"provisional",
										"startsOn",
										"endsOn",
										"formSubmissionId",
										"medicationId",
										"allergyId",
										"conditionId",
										"authoringSource",
										"legacyMedicalAlert",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/history/{patientId}/alerts/{id}/archive": {
			"post": {
				"summary": "Archive an alert",
				"tags": [
					"Medical history"
				],
				"description": "The alert leaves the banner and stays as history.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"medical",
												"allergy",
												"medication",
												"infectious",
												"warning"
											]
										},
										"title": {
											"type": "string"
										},
										"detail": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"type": "string",
											"enum": [
												"info",
												"warning",
												"critical"
											]
										},
										"standardId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"standardSystem": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"popup": {
											"type": "boolean"
										},
										"provisional": {
											"type": "boolean"
										},
										"startsOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"endsOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"formSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"medicationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"allergyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"conditionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"legacyMedicalAlert": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"kind",
										"title",
										"detail",
										"severity",
										"standardId",
										"standardSystem",
										"popup",
										"provisional",
										"startsOn",
										"endsOn",
										"formSubmissionId",
										"medicationId",
										"allergyId",
										"conditionId",
										"authoringSource",
										"legacyMedicalAlert",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/forms/{patientId}": {
			"get": {
				"summary": "A patient's forms",
				"tags": [
					"Patient forms"
				],
				"description": "The live templates plus the versions the patient's submissions cite, and every submission with its reviews, newest first. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"templates": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientFormTemplate"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientFormSubmission"
											}
										}
									},
									"required": [
										"templates",
										"submissions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Submit a form for a patient",
				"tags": [
					"Patient forms"
				],
				"description": "A staff member enters the patient's answers against a template. Fields that ask for one raise a provisional alert until a clinician reviews the form.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"answers": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"signerRole": {
										"type": "string",
										"enum": [
											"self",
											"parent",
											"guardian",
											"attorney"
										]
									},
									"signerName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"signerRelationshipId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"signaturePng": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2097152,
												"pattern": "^data:image\\/(png|svg\\+xml);base64,[A-Za-z0-9+/=]+$"
											},
											{
												"type": "null"
											}
										]
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"supersedesId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"templateId",
									"answers",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"submission": {
											"$ref": "#/components/schemas/PatientFormSubmission"
										},
										"alerts": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientAlert"
											}
										}
									},
									"required": [
										"submission",
										"alerts"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/forms/{patientId}/{id}/review": {
			"post": {
				"summary": "Review a submission",
				"tags": [
					"Patient forms"
				],
				"description": "A professional act (review medical-history form): the proposed facts become history rows citing the review; the submission's provisional alerts are confirmed, or archived when the review rejects it.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"outcome": {
										"type": "string",
										"enum": [
											"accepted",
											"accepted_with_changes",
											"rejected"
										]
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"conditions": {
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"name": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"status": {
													"type": "string",
													"enum": [
														"active",
														"resolved",
														"historical"
													]
												},
												"onsetOn": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"resolvedOn": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"severity": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 100
														},
														{
															"type": "null"
														}
													]
												},
												"supersedesId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"name",
												"status"
											]
										}
									},
									"medications": {
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"name": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"status": {
													"type": "string",
													"enum": [
														"active",
														"stopped",
														"historical"
													]
												},
												"dose": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 100
														},
														{
															"type": "null"
														}
													]
												},
												"frequency": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 100
														},
														{
															"type": "null"
														}
													]
												},
												"route": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 100
														},
														{
															"type": "null"
														}
													]
												},
												"startedOn": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"stoppedOn": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"supersedesId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"name",
												"status"
											]
										}
									},
									"allergies": {
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"substance": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"status": {
													"type": "string",
													"enum": [
														"active",
														"resolved",
														"refuted"
													]
												},
												"severity": {
													"type": "string",
													"enum": [
														"info",
														"warning",
														"critical"
													]
												},
												"reaction": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 500
														},
														{
															"type": "null"
														}
													]
												},
												"onsetOn": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"supersedesId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"substance",
												"status",
												"severity"
											]
										}
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"outcome",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"submissionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"reviewerPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"reviewerCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"reviewedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"outcome": {
											"type": "string",
											"enum": [
												"accepted",
												"accepted_with_changes",
												"rejected"
											]
										},
										"proposedChanges": {},
										"appliedChanges": {},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"submissionId",
										"patientId",
										"reviewerPractitionerId",
										"reviewerCredentialRevisionId",
										"reviewedAt",
										"outcome",
										"proposedChanges",
										"appliedChanges",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/recalls/{patientId}": {
			"get": {
				"summary": "A patient's recalls",
				"tags": [
					"Recalls"
				],
				"description": "Every recall with its event history, soonest due first. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Recall"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Schedule a recall",
				"tags": [
					"Recalls"
				],
				"description": "One recall per type per patient; the created event is its first history row.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"recallTypeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"dueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"recallTypeId",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"recallTypeId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"intervalMonths": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"bookedAppointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastCompletedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"paused"
											]
										},
										"pausedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/RecallEvent"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"recallTypeId",
										"practitionerId",
										"dueOn",
										"intervalMonths",
										"bookedAppointmentId",
										"lastCompletedOn",
										"status",
										"pausedReason",
										"lastEventId",
										"createdAt",
										"updatedAt",
										"events"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/recalls/{patientId}/{id}/events": {
			"post": {
				"summary": "Record a recall event",
				"tags": [
					"Recalls"
				],
				"description": "Reschedule, book, complete (the due date moves by the interval), skip, mark missed, pause, resume, or note a contact. The projection follows the event.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"rescheduled",
											"booked",
											"completed",
											"skipped",
											"missed",
											"paused",
											"resumed",
											"contacted"
										]
									},
									"dueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"recallTypeId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"intervalMonths": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"bookedAppointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastCompletedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"paused"
											]
										},
										"pausedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/RecallEvent"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"recallTypeId",
										"practitionerId",
										"dueOn",
										"intervalMonths",
										"bookedAppointmentId",
										"lastCompletedOn",
										"status",
										"pausedReason",
										"lastEventId",
										"createdAt",
										"updatedAt",
										"events"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/{patientId}": {
			"get": {
				"summary": "A patient's ledger",
				"tags": [
					"Ledger"
				],
				"description": "Every entry and allocation of the patient's account, newest first, with the live balance and the outstanding charges. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"accountId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"balanceCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"outstandingCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"entries": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LedgerEntry"
											}
										},
										"allocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LedgerAllocation"
											}
										},
										"paymentMethods": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"name": {
														"type": "string"
													},
													"kind": {
														"type": "string",
														"enum": [
															"cash",
															"card",
															"terminal",
															"bank_transfer",
															"cheque",
															"online",
															"finance",
															"other"
														]
													},
													"direction": {
														"type": "string",
														"enum": [
															"debit",
															"credit"
														]
													},
													"isWriteOff": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										},
										"adjustmentTypes": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"name": {
														"type": "string"
													},
													"kind": {
														"type": "string",
														"enum": [
															"cash",
															"card",
															"terminal",
															"bank_transfer",
															"cheque",
															"online",
															"finance",
															"other"
														]
													},
													"direction": {
														"type": "string",
														"enum": [
															"debit",
															"credit"
														]
													},
													"isWriteOff": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"accountId",
										"currency",
										"balanceCents",
										"outstandingCents",
										"entries",
										"allocations",
										"paymentMethods",
										"adjustmentTypes"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/{patientId}/charges": {
			"post": {
				"summary": "Post a charge",
				"tags": [
					"Ledger"
				],
				"description": "A completed procedure at its recorded fee (one live charge per procedure), or a manual charge with a description. Tax follows the location's rules for the treatment.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"amountCents": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"locationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"entryDate": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											"reference": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 200
													},
													{
														"type": "null"
													}
												]
											},
											"note": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 2000
													},
													{
														"type": "null"
													}
												]
											},
											"chargeSource": {
												"type": "string",
												"const": "procedure"
											},
											"procedureId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"amountCents",
											"locationId",
											"chargeSource",
											"procedureId"
										]
									},
									{
										"type": "object",
										"properties": {
											"amountCents": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"locationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"entryDate": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											"reference": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 200
													},
													{
														"type": "null"
													}
												]
											},
											"note": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 2000
													},
													{
														"type": "null"
													}
												]
											},
											"chargeSource": {
												"type": "string",
												"const": "manual"
											},
											"description": {
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											"taxTreatment": {
												"type": "string",
												"enum": [
													"exempt",
													"standard",
													"zero",
													"none"
												]
											},
											"practitionerId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"amountCents",
											"locationId",
											"chargeSource",
											"description",
											"taxTreatment"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"charge",
												"payment",
												"adjustment",
												"refund",
												"insurance_payment",
												"write_off",
												"transfer"
											]
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"entryDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"postedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"chargeSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"procedure",
														"external_line",
														"retail",
														"manual",
														"membership",
														"stamp_duty"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalLineRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"retailProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"retailCodeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"paymentMethodId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"adjustmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"depositRequestId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"statementId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipSubscriptionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"refundOfEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversesEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"transferCounterpartId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalAccountRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"staff",
												"deposit",
												"online_payment",
												"terminal",
												"import",
												"pms_sync",
												"insurance"
											]
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"locationId",
										"practitionerId",
										"kind",
										"amountCents",
										"currency",
										"entryDate",
										"postedAt",
										"chargeSource",
										"procedureId",
										"externalLineRef",
										"retailProcedureCodeId",
										"retailCodeIsAct",
										"description",
										"taxTreatment",
										"taxCents",
										"paymentMethodId",
										"adjustmentTypeId",
										"depositRequestId",
										"insuranceClaimId",
										"statementId",
										"membershipSubscriptionId",
										"providerRef",
										"refundOfEntryId",
										"reversesEntryId",
										"reversedAt",
										"transferCounterpartId",
										"externalAccountRef",
										"externalConnectionId",
										"source",
										"reference",
										"note",
										"postedById",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/{patientId}/payments": {
			"post": {
				"summary": "Take a payment",
				"tags": [
					"Ledger"
				],
				"description": "A payment on the patient's account, allocated to the named charges and then oldest-first; any remainder stays as credit.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"amountCents": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"entryDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"reference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"paymentMethodId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"allocateTo": {
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"amountCents",
									"locationId",
									"paymentMethodId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"charge",
												"payment",
												"adjustment",
												"refund",
												"insurance_payment",
												"write_off",
												"transfer"
											]
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"entryDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"postedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"chargeSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"procedure",
														"external_line",
														"retail",
														"manual",
														"membership",
														"stamp_duty"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalLineRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"retailProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"retailCodeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"paymentMethodId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"adjustmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"depositRequestId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"statementId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipSubscriptionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"refundOfEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversesEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"transferCounterpartId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalAccountRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"staff",
												"deposit",
												"online_payment",
												"terminal",
												"import",
												"pms_sync",
												"insurance"
											]
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"locationId",
										"practitionerId",
										"kind",
										"amountCents",
										"currency",
										"entryDate",
										"postedAt",
										"chargeSource",
										"procedureId",
										"externalLineRef",
										"retailProcedureCodeId",
										"retailCodeIsAct",
										"description",
										"taxTreatment",
										"taxCents",
										"paymentMethodId",
										"adjustmentTypeId",
										"depositRequestId",
										"insuranceClaimId",
										"statementId",
										"membershipSubscriptionId",
										"providerRef",
										"refundOfEntryId",
										"reversesEntryId",
										"reversedAt",
										"transferCounterpartId",
										"externalAccountRef",
										"externalConnectionId",
										"source",
										"reference",
										"note",
										"postedById",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/{patientId}/refunds": {
			"post": {
				"summary": "Refund a payment",
				"tags": [
					"Ledger"
				],
				"description": "Refunds never exceed the payment they name; the database caps the sum.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"amountCents": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"entryDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"reference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"refundOfEntryId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"paymentMethodId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"amountCents",
									"locationId",
									"refundOfEntryId",
									"paymentMethodId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"charge",
												"payment",
												"adjustment",
												"refund",
												"insurance_payment",
												"write_off",
												"transfer"
											]
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"entryDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"postedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"chargeSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"procedure",
														"external_line",
														"retail",
														"manual",
														"membership",
														"stamp_duty"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalLineRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"retailProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"retailCodeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"paymentMethodId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"adjustmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"depositRequestId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"statementId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipSubscriptionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"refundOfEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversesEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"transferCounterpartId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalAccountRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"staff",
												"deposit",
												"online_payment",
												"terminal",
												"import",
												"pms_sync",
												"insurance"
											]
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"locationId",
										"practitionerId",
										"kind",
										"amountCents",
										"currency",
										"entryDate",
										"postedAt",
										"chargeSource",
										"procedureId",
										"externalLineRef",
										"retailProcedureCodeId",
										"retailCodeIsAct",
										"description",
										"taxTreatment",
										"taxCents",
										"paymentMethodId",
										"adjustmentTypeId",
										"depositRequestId",
										"insuranceClaimId",
										"statementId",
										"membershipSubscriptionId",
										"providerRef",
										"refundOfEntryId",
										"reversesEntryId",
										"reversedAt",
										"transferCounterpartId",
										"externalAccountRef",
										"externalConnectionId",
										"source",
										"reference",
										"note",
										"postedById",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/{patientId}/adjustments": {
			"post": {
				"summary": "Post an adjustment or write-off",
				"tags": [
					"Ledger"
				],
				"description": "The sign follows the adjustment type's direction; a write-off type posts a write-off entry (owner and manager only).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"amountCents": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"entryDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"reference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"adjustmentTypeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"allocateTo": {
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									}
								},
								"required": [
									"amountCents",
									"locationId",
									"adjustmentTypeId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"charge",
												"payment",
												"adjustment",
												"refund",
												"insurance_payment",
												"write_off",
												"transfer"
											]
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"entryDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"postedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"chargeSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"procedure",
														"external_line",
														"retail",
														"manual",
														"membership",
														"stamp_duty"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalLineRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"retailProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"retailCodeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"paymentMethodId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"adjustmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"depositRequestId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"statementId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipSubscriptionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"refundOfEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversesEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"transferCounterpartId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalAccountRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"staff",
												"deposit",
												"online_payment",
												"terminal",
												"import",
												"pms_sync",
												"insurance"
											]
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"locationId",
										"practitionerId",
										"kind",
										"amountCents",
										"currency",
										"entryDate",
										"postedAt",
										"chargeSource",
										"procedureId",
										"externalLineRef",
										"retailProcedureCodeId",
										"retailCodeIsAct",
										"description",
										"taxTreatment",
										"taxCents",
										"paymentMethodId",
										"adjustmentTypeId",
										"depositRequestId",
										"insuranceClaimId",
										"statementId",
										"membershipSubscriptionId",
										"providerRef",
										"refundOfEntryId",
										"reversesEntryId",
										"reversedAt",
										"transferCounterpartId",
										"externalAccountRef",
										"externalConnectionId",
										"source",
										"reference",
										"note",
										"postedById",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/{patientId}/entries/{id}/reverse": {
			"post": {
				"summary": "Reverse an entry",
				"tags": [
					"Ledger"
				],
				"description": "The exact negation of a live entry, sealing reversed_at on the original; its allocations are reversed with it.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"entryDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"charge",
												"payment",
												"adjustment",
												"refund",
												"insurance_payment",
												"write_off",
												"transfer"
											]
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"entryDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"postedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"chargeSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"procedure",
														"external_line",
														"retail",
														"manual",
														"membership",
														"stamp_duty"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalLineRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"retailProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"retailCodeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"paymentMethodId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"adjustmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"depositRequestId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"statementId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipSubscriptionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"refundOfEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversesEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"transferCounterpartId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalAccountRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"staff",
												"deposit",
												"online_payment",
												"terminal",
												"import",
												"pms_sync",
												"insurance"
											]
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"locationId",
										"practitionerId",
										"kind",
										"amountCents",
										"currency",
										"entryDate",
										"postedAt",
										"chargeSource",
										"procedureId",
										"externalLineRef",
										"retailProcedureCodeId",
										"retailCodeIsAct",
										"description",
										"taxTreatment",
										"taxCents",
										"paymentMethodId",
										"adjustmentTypeId",
										"depositRequestId",
										"insuranceClaimId",
										"statementId",
										"membershipSubscriptionId",
										"providerRef",
										"refundOfEntryId",
										"reversesEntryId",
										"reversedAt",
										"transferCounterpartId",
										"externalAccountRef",
										"externalConnectionId",
										"source",
										"reference",
										"note",
										"postedById",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/{patientId}/transfers": {
			"post": {
				"summary": "Transfer credit to another account",
				"tags": [
					"Ledger"
				],
				"description": "A transfer pair: a debit on this account and the matching credit on the other, judged together at commit.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"amountCents": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"entryDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"reference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"toPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"amountCents",
									"locationId",
									"toPatientId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"charge",
												"payment",
												"adjustment",
												"refund",
												"insurance_payment",
												"write_off",
												"transfer"
											]
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"entryDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"postedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"chargeSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"procedure",
														"external_line",
														"retail",
														"manual",
														"membership",
														"stamp_duty"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalLineRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"retailProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"retailCodeIsAct": {
											"type": "boolean"
										},
										"description": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"taxTreatment": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"paymentMethodId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"adjustmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"depositRequestId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"insuranceClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"statementId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"membershipSubscriptionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"refundOfEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversesEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reversedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"transferCounterpartId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalAccountRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"staff",
												"deposit",
												"online_payment",
												"terminal",
												"import",
												"pms_sync",
												"insurance"
											]
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"locationId",
										"practitionerId",
										"kind",
										"amountCents",
										"currency",
										"entryDate",
										"postedAt",
										"chargeSource",
										"procedureId",
										"externalLineRef",
										"retailProcedureCodeId",
										"retailCodeIsAct",
										"description",
										"taxTreatment",
										"taxCents",
										"paymentMethodId",
										"adjustmentTypeId",
										"depositRequestId",
										"insuranceClaimId",
										"statementId",
										"membershipSubscriptionId",
										"providerRef",
										"refundOfEntryId",
										"reversesEntryId",
										"reversedAt",
										"transferCounterpartId",
										"externalAccountRef",
										"externalConnectionId",
										"source",
										"reference",
										"note",
										"postedById",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ledger/periods/close": {
			"post": {
				"summary": "Close a ledger period",
				"tags": [
					"Ledger"
				],
				"description": "Nothing posts on or before the period end at that location from now on. Only a past date closes, and only while Smileline is the system of record.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"periodEnd": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"locationId",
									"periodEnd"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"periodStart": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"periodEnd": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"closedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"closedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"closedByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"periodStart",
										"periodEnd",
										"closedAt",
										"closedById",
										"closedByName",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/invoices/{patientId}": {
			"get": {
				"summary": "A patient's invoices and credit notes",
				"tags": [
					"Invoices"
				],
				"description": "Every invoice and credit note with its lines and what has been allocated against it, newest first. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Invoice"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Issue an invoice",
				"tags": [
					"Invoices"
				],
				"description": "Numbered from the practice sequence over live, uninvoiced charges of the account at one location; every line stamps the tax rule in force on the issue date; the PDF is rendered and filed on the account.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"entryIds": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"issuedOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"dueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"entryIds",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"invoice",
												"credit_note"
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"numberPeriod": {
											"type": "string"
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"native",
												"pms_sync"
											]
										},
										"externalRevision": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalPractitionerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"issued",
												"void"
											]
										},
										"issuedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"creditNoteForInvoiceId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sentMessageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"credit_note",
														"provider_deleted",
														"provider_revised",
														"issued_in_error"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"voidCreditNoteId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lines": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InvoiceLine"
											}
										},
										"paidCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"locationId",
										"kind",
										"number",
										"numberPeriod",
										"externalReference",
										"source",
										"externalRevision",
										"externalPractitionerRef",
										"externalNumber",
										"externalConnectionId",
										"status",
										"issuedOn",
										"dueOn",
										"priceListId",
										"creditNoteForInvoiceId",
										"totalCents",
										"taxCents",
										"currency",
										"documentId",
										"sentMessageId",
										"voidedAt",
										"voidReason",
										"voidCreditNoteId",
										"note",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"lines",
										"paidCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/invoices/{patientId}/{id}/credit-note": {
			"post": {
				"summary": "Void an invoice by credit note",
				"tags": [
					"Invoices"
				],
				"description": "Reverses every line on the ledger, issues the credit note with the negated lines, and voids the invoice with the credit note as its reason — one transaction.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"issuedOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								}
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"invoice",
												"credit_note"
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"numberPeriod": {
											"type": "string"
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"native",
												"pms_sync"
											]
										},
										"externalRevision": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalPractitionerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"issued",
												"void"
											]
										},
										"issuedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"creditNoteForInvoiceId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sentMessageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"credit_note",
														"provider_deleted",
														"provider_revised",
														"issued_in_error"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"voidCreditNoteId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lines": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InvoiceLine"
											}
										},
										"paidCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"locationId",
										"kind",
										"number",
										"numberPeriod",
										"externalReference",
										"source",
										"externalRevision",
										"externalPractitionerRef",
										"externalNumber",
										"externalConnectionId",
										"status",
										"issuedOn",
										"dueOn",
										"priceListId",
										"creditNoteForInvoiceId",
										"totalCents",
										"taxCents",
										"currency",
										"documentId",
										"sentMessageId",
										"voidedAt",
										"voidReason",
										"voidCreditNoteId",
										"note",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"lines",
										"paidCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/invoices/{patientId}/{id}/document": {
			"post": {
				"summary": "Render the invoice document again",
				"tags": [
					"Invoices"
				],
				"description": "Files a fresh PDF from the issued rows and links it to the invoice.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"invoice",
												"credit_note"
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"numberPeriod": {
											"type": "string"
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"native",
												"pms_sync"
											]
										},
										"externalRevision": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalPractitionerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalConnectionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"issued",
												"void"
											]
										},
										"issuedOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"creditNoteForInvoiceId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"taxCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sentMessageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"credit_note",
														"provider_deleted",
														"provider_revised",
														"issued_in_error"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"voidCreditNoteId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lines": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InvoiceLine"
											}
										},
										"paidCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"locationId",
										"kind",
										"number",
										"numberPeriod",
										"externalReference",
										"source",
										"externalRevision",
										"externalPractitionerRef",
										"externalNumber",
										"externalConnectionId",
										"status",
										"issuedOn",
										"dueOn",
										"priceListId",
										"creditNoteForInvoiceId",
										"totalCents",
										"taxCents",
										"currency",
										"documentId",
										"sentMessageId",
										"voidedAt",
										"voidReason",
										"voidCreditNoteId",
										"note",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"lines",
										"paidCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/terminal/readers": {
			"get": {
				"summary": "The practice's card readers",
				"tags": [
					"Card terminal"
				],
				"description": "Every Stripe Terminal reader registered on the practice's connected Stripe account, with its online state.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TerminalReader"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/terminal/payments/{patientId}": {
			"get": {
				"summary": "A patient's card-terminal payments",
				"tags": [
					"Card terminal"
				],
				"description": "Every card-terminal payment started for the patient, newest first, with its outcome.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TerminalPayment"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Take a payment on a card reader",
				"tags": [
					"Card terminal"
				],
				"description": "Creates the payment on the practice's Stripe account and sends it to the reader. The payment posts to the ledger when Stripe confirms it; poll the payment until it leaves `processing`.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"readerId": {
										"type": "string",
										"minLength": 1
									},
									"amountCents": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"clientRef": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"locationId",
									"readerId",
									"amountCents",
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"paymentMethodId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"stripeAccountId": {
											"type": "string"
										},
										"readerId": {
											"type": "string"
										},
										"clientRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"paymentIntentId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"processing",
												"succeeded",
												"failed",
												"canceled",
												"uncertain"
											]
										},
										"failureCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"failureMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ledgerEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"paymentMethodId",
										"amountCents",
										"currency",
										"stripeAccountId",
										"readerId",
										"clientRef",
										"paymentIntentId",
										"status",
										"failureCode",
										"failureMessage",
										"ledgerEntryId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/terminal/payments/{patientId}/{id}": {
			"get": {
				"summary": "One card-terminal payment",
				"tags": [
					"Card terminal"
				],
				"description": "The payment's current state — poll it while the reader is collecting the card.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"paymentMethodId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"stripeAccountId": {
											"type": "string"
										},
										"readerId": {
											"type": "string"
										},
										"clientRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"paymentIntentId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"processing",
												"succeeded",
												"failed",
												"canceled",
												"uncertain"
											]
										},
										"failureCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"failureMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ledgerEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"paymentMethodId",
										"amountCents",
										"currency",
										"stripeAccountId",
										"readerId",
										"clientRef",
										"paymentIntentId",
										"status",
										"failureCode",
										"failureMessage",
										"ledgerEntryId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/terminal/payments/{patientId}/{id}/cancel": {
			"post": {
				"summary": "Cancel a card-terminal payment",
				"tags": [
					"Card terminal"
				],
				"description": "Stops the reader and cancels the payment. A payment Stripe has already taken is settled as paid instead.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"paymentMethodId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"stripeAccountId": {
											"type": "string"
										},
										"readerId": {
											"type": "string"
										},
										"clientRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"paymentIntentId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"processing",
												"succeeded",
												"failed",
												"canceled",
												"uncertain"
											]
										},
										"failureCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"failureMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ledgerEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"paymentMethodId",
										"amountCents",
										"currency",
										"stripeAccountId",
										"readerId",
										"clientRef",
										"paymentIntentId",
										"status",
										"failureCode",
										"failureMessage",
										"ledgerEntryId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/terminal/payments/{patientId}/{id}/retry": {
			"post": {
				"summary": "Present a declined payment to the reader again",
				"tags": [
					"Card terminal"
				],
				"description": "Sends the same payment back to the reader after a decline — never a new charge.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"paymentMethodId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"stripeAccountId": {
											"type": "string"
										},
										"readerId": {
											"type": "string"
										},
										"clientRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"paymentIntentId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"processing",
												"succeeded",
												"failed",
												"canceled",
												"uncertain"
											]
										},
										"failureCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"failureMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ledgerEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"paymentMethodId",
										"amountCents",
										"currency",
										"stripeAccountId",
										"readerId",
										"clientRef",
										"paymentIntentId",
										"status",
										"failureCode",
										"failureMessage",
										"ledgerEntryId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/terminal/payments/{patientId}/{id}/reconcile": {
			"post": {
				"summary": "Reconcile a card-terminal payment with Stripe",
				"tags": [
					"Card terminal"
				],
				"description": "Asks Stripe for the payment's outcome and applies it: a taken payment posts to the ledger once, a declined or cancelled one is recorded as such. The manual path for an uncertain payment or a lost webhook.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"paymentMethodId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"amountCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"stripeAccountId": {
											"type": "string"
										},
										"readerId": {
											"type": "string"
										},
										"clientRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"paymentIntentId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"processing",
												"succeeded",
												"failed",
												"canceled",
												"uncertain"
											]
										},
										"failureCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"failureMessage": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ledgerEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"paymentMethodId",
										"amountCents",
										"currency",
										"stripeAccountId",
										"readerId",
										"clientRef",
										"paymentIntentId",
										"status",
										"failureCode",
										"failureMessage",
										"ledgerEntryId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/perio/{patientId}": {
			"get": {
				"summary": "A patient's periodontal examinations",
				"tags": [
					"Perio"
				],
				"description": "Every exam with its rows, newest first; a voided exam stays listed. The read is audited (04 §2).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioExam"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Start a periodontal examination",
				"tags": [
					"Perio"
				],
				"description": "A draft under the examiner's registration (the record_perio_exam act). BPE is admitted under a UK location and PSR under a US one. Rows may be sent with it.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"notes": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"aapStage": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"I",
													"II",
													"III",
													"IV"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"aapGrade": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"A",
													"B",
													"C"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"aapExtent": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"localised",
													"generalised",
													"molar_incisor"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"plaquePercent": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\d{1,3}(\\.\\d{1,2})?$"
											},
											{
												"type": "null"
											}
										]
									},
									"kind": {
										"type": "string",
										"enum": [
											"probing",
											"bpe",
											"psr",
											"bewe",
											"soft_tissue"
										]
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"examDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"rows": {
										"type": "object",
										"properties": {
											"probingSites": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"tooth": {
															"type": "integer",
															"minimum": 11,
															"maximum": 85
														},
														"site": {
															"type": "string",
															"enum": [
																"mb",
																"b",
																"db",
																"ml",
																"l",
																"dl"
															]
														},
														"state": {
															"default": "measured",
															"type": "string",
															"enum": [
																"measured",
																"not_measured",
																"absent",
																"not_applicable"
															]
														},
														"pocketDepthMm": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 20
																},
																{
																	"type": "null"
																}
															]
														},
														"recessionMm": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": -10,
																	"maximum": 20
																},
																{
																	"type": "null"
																}
															]
														},
														"bleeding": {
															"default": false,
															"type": "boolean"
														},
														"suppuration": {
															"default": false,
															"type": "boolean"
														},
														"plaque": {
															"default": false,
															"type": "boolean"
														},
														"furcation": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 4
																},
																{
																	"type": "null"
																}
															]
														},
														"mobility": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 3
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"tooth",
														"site"
													]
												}
											},
											"bpeScores": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"sextant": {
															"type": "string",
															"enum": [
																"ur",
																"ua",
																"ul",
																"lr",
																"la",
																"ll"
															]
														},
														"code": {
															"type": "string",
															"enum": [
																"0",
																"1",
																"2",
																"3",
																"4",
																"X"
															]
														},
														"furcation": {
															"default": false,
															"type": "boolean"
														},
														"bleeding": {
															"default": null,
															"anyOf": [
																{
																	"type": "boolean"
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"sextant",
														"code"
													]
												}
											},
											"beweScores": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"sextant": {
															"type": "string",
															"enum": [
																"ur",
																"ua",
																"ul",
																"lr",
																"la",
																"ll"
															]
														},
														"score": {
															"type": "integer",
															"minimum": 0,
															"maximum": 3
														}
													},
													"required": [
														"sextant",
														"score"
													]
												}
											},
											"softTissueFindings": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"site": {
															"type": "string",
															"enum": [
																"lips",
																"buccal_mucosa",
																"tongue",
																"floor_of_mouth",
																"palate",
																"gingiva",
																"oropharynx",
																"other"
															]
														},
														"description": {
															"type": "string",
															"minLength": 1,
															"maxLength": 2000
														},
														"standardId": {
															"default": null,
															"anyOf": [
																{
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																{
																	"type": "null"
																}
															]
														},
														"referralRecommended": {
															"default": false,
															"type": "boolean"
														},
														"clinicalFindingId": {
															"default": null,
															"anyOf": [
																{
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"site",
														"description"
													]
												}
											}
										}
									}
								},
								"required": [
									"kind",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"probing",
												"bpe",
												"psr",
												"bewe",
												"soft_tissue"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"completed",
												"amended"
											]
										},
										"examDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"examinedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bopPercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"plaquePercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aapStage": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"I",
														"II",
														"III",
														"IV"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapGrade": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"A",
														"B",
														"C"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapExtent": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"localised",
														"generalised",
														"molar_incisor"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"probingSites": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioProbingSite"
											}
										},
										"bpeScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBpeScore"
											}
										},
										"beweScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBeweScore"
											}
										},
										"softTissueFindings": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioSoftTissueFinding"
											}
										},
										"revisionCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"jurisdiction",
										"practitionerId",
										"credentialRevisionId",
										"appointmentId",
										"kind",
										"status",
										"examDate",
										"examinedAt",
										"revision",
										"completedAt",
										"amendedAt",
										"amendedById",
										"bopPercent",
										"plaquePercent",
										"aapStage",
										"aapGrade",
										"aapExtent",
										"notes",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"probingSites",
										"bpeScores",
										"beweScores",
										"softTissueFindings",
										"revisionCount"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/perio/{patientId}/{id}/revisions": {
			"get": {
				"summary": "An examination's prior images",
				"tags": [
					"Perio"
				],
				"description": "One row per amendment: the header and rows as they were before it.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioExamRevision"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/perio/{patientId}/{id}": {
			"put": {
				"summary": "Save an examination's header and rows",
				"tags": [
					"Perio"
				],
				"description": "In place on a draft (autosave); on a completed exam the save is an amendment — the revision increments and the prior image, rows included, is kept forever. The save names the `updatedAt` it last read and is refused with the live exam when that moved (409 PERIO_CONFLICT).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"header": {
										"type": "object",
										"properties": {
											"notes": {
												"anyOf": [
													{
														"type": "string",
														"maxLength": 4000
													},
													{
														"type": "null"
													}
												]
											},
											"aapStage": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"I",
															"II",
															"III",
															"IV"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"aapGrade": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"A",
															"B",
															"C"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"aapExtent": {
												"anyOf": [
													{
														"type": "string",
														"enum": [
															"localised",
															"generalised",
															"molar_incisor"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"plaquePercent": {
												"anyOf": [
													{
														"type": "string",
														"pattern": "^\\d{1,3}(\\.\\d{1,2})?$"
													},
													{
														"type": "null"
													}
												]
											}
										}
									},
									"rows": {
										"type": "object",
										"properties": {
											"probingSites": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"tooth": {
															"type": "integer",
															"minimum": 11,
															"maximum": 85
														},
														"site": {
															"type": "string",
															"enum": [
																"mb",
																"b",
																"db",
																"ml",
																"l",
																"dl"
															]
														},
														"state": {
															"default": "measured",
															"type": "string",
															"enum": [
																"measured",
																"not_measured",
																"absent",
																"not_applicable"
															]
														},
														"pocketDepthMm": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 20
																},
																{
																	"type": "null"
																}
															]
														},
														"recessionMm": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": -10,
																	"maximum": 20
																},
																{
																	"type": "null"
																}
															]
														},
														"bleeding": {
															"default": false,
															"type": "boolean"
														},
														"suppuration": {
															"default": false,
															"type": "boolean"
														},
														"plaque": {
															"default": false,
															"type": "boolean"
														},
														"furcation": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 4
																},
																{
																	"type": "null"
																}
															]
														},
														"mobility": {
															"default": null,
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 3
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"tooth",
														"site"
													]
												}
											},
											"bpeScores": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"sextant": {
															"type": "string",
															"enum": [
																"ur",
																"ua",
																"ul",
																"lr",
																"la",
																"ll"
															]
														},
														"code": {
															"type": "string",
															"enum": [
																"0",
																"1",
																"2",
																"3",
																"4",
																"X"
															]
														},
														"furcation": {
															"default": false,
															"type": "boolean"
														},
														"bleeding": {
															"default": null,
															"anyOf": [
																{
																	"type": "boolean"
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"sextant",
														"code"
													]
												}
											},
											"beweScores": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"sextant": {
															"type": "string",
															"enum": [
																"ur",
																"ua",
																"ul",
																"lr",
																"la",
																"ll"
															]
														},
														"score": {
															"type": "integer",
															"minimum": 0,
															"maximum": 3
														}
													},
													"required": [
														"sextant",
														"score"
													]
												}
											},
											"softTissueFindings": {
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"site": {
															"type": "string",
															"enum": [
																"lips",
																"buccal_mucosa",
																"tongue",
																"floor_of_mouth",
																"palate",
																"gingiva",
																"oropharynx",
																"other"
															]
														},
														"description": {
															"type": "string",
															"minLength": 1,
															"maxLength": 2000
														},
														"standardId": {
															"default": null,
															"anyOf": [
																{
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																{
																	"type": "null"
																}
															]
														},
														"referralRecommended": {
															"default": false,
															"type": "boolean"
														},
														"clinicalFindingId": {
															"default": null,
															"anyOf": [
																{
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"site",
														"description"
													]
												}
											}
										}
									},
									"expectedUpdatedAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									}
								},
								"required": [
									"expectedUpdatedAt"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"probing",
												"bpe",
												"psr",
												"bewe",
												"soft_tissue"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"completed",
												"amended"
											]
										},
										"examDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"examinedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bopPercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"plaquePercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aapStage": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"I",
														"II",
														"III",
														"IV"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapGrade": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"A",
														"B",
														"C"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapExtent": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"localised",
														"generalised",
														"molar_incisor"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"probingSites": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioProbingSite"
											}
										},
										"bpeScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBpeScore"
											}
										},
										"beweScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBeweScore"
											}
										},
										"softTissueFindings": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioSoftTissueFinding"
											}
										},
										"revisionCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"jurisdiction",
										"practitionerId",
										"credentialRevisionId",
										"appointmentId",
										"kind",
										"status",
										"examDate",
										"examinedAt",
										"revision",
										"completedAt",
										"amendedAt",
										"amendedById",
										"bopPercent",
										"plaquePercent",
										"aapStage",
										"aapGrade",
										"aapExtent",
										"notes",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"probingSites",
										"bpeScores",
										"beweScores",
										"softTissueFindings",
										"revisionCount"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/perio/{patientId}/{id}/complete": {
			"post": {
				"summary": "Complete a draft examination",
				"tags": [
					"Perio"
				],
				"description": "Seals the draft; later changes are amendments with their prior image kept.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"probing",
												"bpe",
												"psr",
												"bewe",
												"soft_tissue"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"completed",
												"amended"
											]
										},
										"examDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"examinedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bopPercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"plaquePercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aapStage": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"I",
														"II",
														"III",
														"IV"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapGrade": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"A",
														"B",
														"C"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapExtent": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"localised",
														"generalised",
														"molar_incisor"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"probingSites": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioProbingSite"
											}
										},
										"bpeScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBpeScore"
											}
										},
										"beweScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBeweScore"
											}
										},
										"softTissueFindings": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioSoftTissueFinding"
											}
										},
										"revisionCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"jurisdiction",
										"practitionerId",
										"credentialRevisionId",
										"appointmentId",
										"kind",
										"status",
										"examDate",
										"examinedAt",
										"revision",
										"completedAt",
										"amendedAt",
										"amendedById",
										"bopPercent",
										"plaquePercent",
										"aapStage",
										"aapGrade",
										"aapExtent",
										"notes",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"probingSites",
										"bpeScores",
										"beweScores",
										"softTissueFindings",
										"revisionCount"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/perio/{patientId}/{id}/void": {
			"post": {
				"summary": "Void an examination",
				"tags": [
					"Perio"
				],
				"description": "A fresh act: the void columns seal and the exam becomes immutable; it stays on the record.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"probing",
												"bpe",
												"psr",
												"bewe",
												"soft_tissue"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"completed",
												"amended"
											]
										},
										"examDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"examinedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bopPercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"plaquePercent": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"aapStage": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"I",
														"II",
														"III",
														"IV"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapGrade": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"A",
														"B",
														"C"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"aapExtent": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"localised",
														"generalised",
														"molar_incisor"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"probingSites": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioProbingSite"
											}
										},
										"bpeScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBpeScore"
											}
										},
										"beweScores": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioBeweScore"
											}
										},
										"softTissueFindings": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PerioSoftTissueFinding"
											}
										},
										"revisionCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"jurisdiction",
										"practitionerId",
										"credentialRevisionId",
										"appointmentId",
										"kind",
										"status",
										"examDate",
										"examinedAt",
										"revision",
										"completedAt",
										"amendedAt",
										"amendedById",
										"bopPercent",
										"plaquePercent",
										"aapStage",
										"aapGrade",
										"aapExtent",
										"notes",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"probingSites",
										"bpeScores",
										"beweScores",
										"softTissueFindings",
										"revisionCount"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/carriers": {
			"get": {
				"summary": "List insurance carriers",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceCarrier"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a insurance carrier",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"payerId": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"neaPayerId": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"region": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"phone": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"adaFormVersion": {
										"type": "string",
										"enum": [
											"2012",
											"2019",
											"2024"
										]
									},
									"acceptsElectronicAttachments": {
										"type": "boolean"
									},
									"acceptsEligibility": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"neaPayerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"region": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"adaFormVersion": {
											"type": "string",
											"enum": [
												"2012",
												"2019",
												"2024"
											]
										},
										"acceptsElectronicAttachments": {
											"type": "boolean"
										},
										"acceptsEligibility": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"payerId",
										"neaPayerId",
										"addressLine1",
										"addressLine2",
										"city",
										"region",
										"postalCode",
										"phone",
										"adaFormVersion",
										"acceptsElectronicAttachments",
										"acceptsEligibility",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/carriers/{id}": {
			"patch": {
				"summary": "Update a insurance carrier",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"payerId": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"neaPayerId": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"region": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"phone": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"adaFormVersion": {
										"type": "string",
										"enum": [
											"2012",
											"2019",
											"2024"
										]
									},
									"acceptsElectronicAttachments": {
										"type": "boolean"
									},
									"acceptsEligibility": {
										"type": "boolean"
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"neaPayerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"region": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"adaFormVersion": {
											"type": "string",
											"enum": [
												"2012",
												"2019",
												"2024"
											]
										},
										"acceptsElectronicAttachments": {
											"type": "boolean"
										},
										"acceptsEligibility": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"payerId",
										"neaPayerId",
										"addressLine1",
										"addressLine2",
										"city",
										"region",
										"postalCode",
										"phone",
										"adaFormVersion",
										"acceptsElectronicAttachments",
										"acceptsEligibility",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/carriers/{id}/archive": {
			"post": {
				"summary": "Archive a insurance carrier",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"neaPayerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"region": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"adaFormVersion": {
											"type": "string",
											"enum": [
												"2012",
												"2019",
												"2024"
											]
										},
										"acceptsElectronicAttachments": {
											"type": "boolean"
										},
										"acceptsEligibility": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"payerId",
										"neaPayerId",
										"addressLine1",
										"addressLine2",
										"city",
										"region",
										"postalCode",
										"phone",
										"adaFormVersion",
										"acceptsElectronicAttachments",
										"acceptsEligibility",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/carriers/{id}/restore": {
			"post": {
				"summary": "Restore an archived insurance carrier",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"neaPayerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"region": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"adaFormVersion": {
											"type": "string",
											"enum": [
												"2012",
												"2019",
												"2024"
											]
										},
										"acceptsElectronicAttachments": {
											"type": "boolean"
										},
										"acceptsEligibility": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"payerId",
										"neaPayerId",
										"addressLine1",
										"addressLine2",
										"city",
										"region",
										"postalCode",
										"phone",
										"adaFormVersion",
										"acceptsElectronicAttachments",
										"acceptsEligibility",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/carriers/reorder": {
			"post": {
				"summary": "Reorder insurance carriers",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceCarrier"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/plans": {
			"get": {
				"summary": "List insurance plans",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsurancePlan"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a insurance plan",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"carrierId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"employerName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"groupName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"groupNumber": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 60
											},
											{
												"type": "null"
											}
										]
									},
									"planType": {
										"type": "string",
										"enum": [
											"ppo",
											"indemnity",
											"hmo_capitation",
											"discount",
											"medicaid",
											"other"
										]
									},
									"renewalMonth": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 12
											},
											{
												"type": "null"
											}
										]
									},
									"feeScheduleId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"notes": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"carrierId",
									"name",
									"planType"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"carrierId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string"
										},
										"employerName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"planType": {
											"type": "string",
											"enum": [
												"ppo",
												"indemnity",
												"hmo_capitation",
												"discount",
												"medicaid",
												"other"
											]
										},
										"renewalMonth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"carrierId",
										"name",
										"employerName",
										"groupName",
										"groupNumber",
										"planType",
										"renewalMonth",
										"feeScheduleId",
										"notes",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/plans/{id}": {
			"patch": {
				"summary": "Update a insurance plan",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"carrierId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"employerName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"groupName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"groupNumber": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 60
											},
											{
												"type": "null"
											}
										]
									},
									"planType": {
										"type": "string",
										"enum": [
											"ppo",
											"indemnity",
											"hmo_capitation",
											"discount",
											"medicaid",
											"other"
										]
									},
									"renewalMonth": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 12
											},
											{
												"type": "null"
											}
										]
									},
									"feeScheduleId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"notes": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"carrierId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string"
										},
										"employerName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"planType": {
											"type": "string",
											"enum": [
												"ppo",
												"indemnity",
												"hmo_capitation",
												"discount",
												"medicaid",
												"other"
											]
										},
										"renewalMonth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"carrierId",
										"name",
										"employerName",
										"groupName",
										"groupNumber",
										"planType",
										"renewalMonth",
										"feeScheduleId",
										"notes",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/plans/{id}/archive": {
			"post": {
				"summary": "Archive a insurance plan",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"carrierId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string"
										},
										"employerName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"planType": {
											"type": "string",
											"enum": [
												"ppo",
												"indemnity",
												"hmo_capitation",
												"discount",
												"medicaid",
												"other"
											]
										},
										"renewalMonth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"carrierId",
										"name",
										"employerName",
										"groupName",
										"groupNumber",
										"planType",
										"renewalMonth",
										"feeScheduleId",
										"notes",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/plans/{id}/restore": {
			"post": {
				"summary": "Restore an archived insurance plan",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"carrierId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string"
										},
										"employerName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"groupNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"planType": {
											"type": "string",
											"enum": [
												"ppo",
												"indemnity",
												"hmo_capitation",
												"discount",
												"medicaid",
												"other"
											]
										},
										"renewalMonth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeScheduleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"carrierId",
										"name",
										"employerName",
										"groupName",
										"groupNumber",
										"planType",
										"renewalMonth",
										"feeScheduleId",
										"notes",
										"position",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/plans/reorder": {
			"post": {
				"summary": "Reorder insurance plans",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"position": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"position"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsurancePlan"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/plans/{id}/revisions": {
			"get": {
				"summary": "List a plan's benefit revisions",
				"tags": [
					"Insurance"
				],
				"description": "Every effective-dated benefit design of the plan with its ranges, exceptions and copays, newest first; retired revisions stay listed because estimates cite them.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceBenefitRevisionView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Add a benefit revision to a plan",
				"tags": [
					"Insurance"
				],
				"description": "A benefit design is written once with every range, exception and copay anchored in one CDT edition. Live revisions of a plan never overlap (409 REVISION_OVERLAP); a correction is a new revision that retires the mistaken one. An unknown CDT code answers 422 CODE_UNKNOWN.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"cdtEdition": {
										"type": "string",
										"minLength": 1,
										"maxLength": 20
									},
									"effectiveFrom": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"effectiveTo": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"coverageKind": {
										"type": "string",
										"enum": [
											"percentage",
											"copay"
										]
									},
									"noDuplicationOfBenefits": {
										"type": "boolean"
									},
									"missingToothClause": {
										"type": "boolean"
									},
									"basicIndividualAnnualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"basicIndividualLifetimeCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"basicFamilyAnnualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"preventiveIndividualAnnualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"preventiveIndividualLifetimeCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"preventiveFamilyAnnualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"majorIndividualAnnualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"majorIndividualLifetimeCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"majorFamilyAnnualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"orthoIndividualAnnualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"orthoIndividualLifetimeCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"annualMaximumIndividualCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"annualMaximumFamilyCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"orthoLifetimeMaximumCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"source": {
										"type": "string",
										"enum": [
											"manual",
											"eligibility",
											"carrier_import"
										]
									},
									"ranges": {
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"codeFrom": {
													"type": "string",
													"pattern": "^D\\d{4}$"
												},
												"codeTo": {
													"type": "string",
													"pattern": "^D\\d{4}$"
												},
												"category": {
													"type": "string",
													"enum": [
														"diagnostic",
														"preventive",
														"basic",
														"major",
														"ortho",
														"other"
													]
												},
												"coveragePercent": {
													"type": "integer",
													"minimum": 0,
													"maximum": 100
												},
												"deductibleType": {
													"type": "string",
													"enum": [
														"none",
														"basic",
														"preventive",
														"major",
														"ortho"
													]
												},
												"network": {
													"default": "in",
													"type": "string",
													"enum": [
														"in",
														"out"
													]
												}
											},
											"required": [
												"codeFrom",
												"codeTo",
												"category",
												"coveragePercent",
												"deductibleType"
											]
										}
									},
									"exceptions": {
										"default": [],
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"code": {
													"type": "string",
													"pattern": "^D\\d{4}$"
												},
												"exceptionType": {
													"type": "string",
													"enum": [
														"excluded",
														"downgrade",
														"age_limit",
														"frequency",
														"waiting_period",
														"coverage_override"
													]
												},
												"downgradeCode": {
													"anyOf": [
														{
															"type": "string",
															"pattern": "^D\\d{4}$"
														},
														{
															"type": "null"
														}
													]
												},
												"coveragePercent": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 0,
															"maximum": 100
														},
														{
															"type": "null"
														}
													]
												},
												"deductibleType": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"none",
																"basic",
																"preventive",
																"major",
																"ortho"
															]
														},
														{
															"type": "null"
														}
													]
												},
												"minAge": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"maxAge": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"frequencyCount": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 1,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"frequencyMonths": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 1,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"waitingPeriodMonths": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"reason": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 500
														},
														{
															"type": "null"
														}
													]
												},
												"network": {
													"default": "in",
													"type": "string",
													"enum": [
														"in",
														"out"
													]
												}
											},
											"required": [
												"code",
												"exceptionType"
											]
										}
									},
									"copays": {
										"default": [],
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"code": {
													"anyOf": [
														{
															"type": "string",
															"pattern": "^D\\d{4}$"
														},
														{
															"type": "null"
														}
													]
												},
												"category": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"diagnostic",
																"preventive",
																"basic",
																"major",
																"ortho",
																"other"
															]
														},
														{
															"type": "null"
														}
													]
												},
												"copayCents": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"network": {
													"default": "in",
													"type": "string",
													"enum": [
														"in",
														"out"
													]
												}
											},
											"required": [
												"copayCents"
											]
										}
									},
									"retireRevisionId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"cdtEdition",
									"effectiveFrom",
									"coverageKind",
									"ranges"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"cdtEdition": {
											"type": "string"
										},
										"effectiveFrom": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"effectiveTo": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"coverageKind": {
											"type": "string",
											"enum": [
												"percentage",
												"copay"
											]
										},
										"noDuplicationOfBenefits": {
											"type": "boolean"
										},
										"missingToothClause": {
											"type": "boolean"
										},
										"basicIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"basicIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"basicFamilyAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"preventiveIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"preventiveIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"preventiveFamilyAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"majorIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"majorIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"majorFamilyAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"orthoIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"orthoIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"annualMaximumIndividualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"annualMaximumFamilyCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"orthoLifetimeMaximumCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"manual",
												"eligibility",
												"carrier_import"
											]
										},
										"retiredAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"ranges": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceBenefitRange"
											}
										},
										"exceptions": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceBenefitException"
											}
										},
										"copays": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceBenefitCopay"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"planId",
										"cdtEdition",
										"effectiveFrom",
										"effectiveTo",
										"coverageKind",
										"noDuplicationOfBenefits",
										"missingToothClause",
										"basicIndividualAnnualCents",
										"basicIndividualLifetimeCents",
										"basicFamilyAnnualCents",
										"preventiveIndividualAnnualCents",
										"preventiveIndividualLifetimeCents",
										"preventiveFamilyAnnualCents",
										"majorIndividualAnnualCents",
										"majorIndividualLifetimeCents",
										"majorFamilyAnnualCents",
										"orthoIndividualAnnualCents",
										"orthoIndividualLifetimeCents",
										"annualMaximumIndividualCents",
										"annualMaximumFamilyCents",
										"orthoLifetimeMaximumCents",
										"currency",
										"source",
										"retiredAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"ranges",
										"exceptions",
										"copays"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/revisions/{id}/retire": {
			"post": {
				"summary": "Retire a benefit revision",
				"tags": [
					"Insurance"
				],
				"description": "Seals retired_at; the revision leaves the estimate path but stays readable because stamped estimates cite it.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"cdtEdition": {
											"type": "string"
										},
										"effectiveFrom": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"effectiveTo": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"coverageKind": {
											"type": "string",
											"enum": [
												"percentage",
												"copay"
											]
										},
										"noDuplicationOfBenefits": {
											"type": "boolean"
										},
										"missingToothClause": {
											"type": "boolean"
										},
										"basicIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"basicIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"basicFamilyAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"preventiveIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"preventiveIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"preventiveFamilyAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"majorIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"majorIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"majorFamilyAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"orthoIndividualAnnualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"orthoIndividualLifetimeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"annualMaximumIndividualCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"annualMaximumFamilyCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"orthoLifetimeMaximumCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"manual",
												"eligibility",
												"carrier_import"
											]
										},
										"retiredAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"planId",
										"cdtEdition",
										"effectiveFrom",
										"effectiveTo",
										"coverageKind",
										"noDuplicationOfBenefits",
										"missingToothClause",
										"basicIndividualAnnualCents",
										"basicIndividualLifetimeCents",
										"basicFamilyAnnualCents",
										"preventiveIndividualAnnualCents",
										"preventiveIndividualLifetimeCents",
										"preventiveFamilyAnnualCents",
										"majorIndividualAnnualCents",
										"majorIndividualLifetimeCents",
										"majorFamilyAnnualCents",
										"orthoIndividualAnnualCents",
										"orthoIndividualLifetimeCents",
										"annualMaximumIndividualCents",
										"annualMaximumFamilyCents",
										"orthoLifetimeMaximumCents",
										"currency",
										"source",
										"retiredAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/{patientId}": {
			"get": {
				"summary": "Read a patient's insurance cover",
				"tags": [
					"Insurance"
				],
				"description": "Every coverage in claim order, open ones first, with its plan, carrier, subscription and current benefit-year usage.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"coverages": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientInsuranceCoverageView"
											}
										}
									},
									"required": [
										"coverages"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/subscriptions/search": {
			"get": {
				"summary": "Find a subscription by member number",
				"tags": [
					"Insurance"
				],
				"description": "For attaching a dependant to a subscriber's existing cover; exact member number, live subscriptions only.",
				"parameters": [
					{
						"name": "memberNumber",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 60
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceSubscriptionSearchRow"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/{patientId}/subscriptions": {
			"post": {
				"summary": "Add insurance cover under a new subscription",
				"tags": [
					"Insurance"
				],
				"description": "Creates the subscription and this patient's coverage under it in one transaction. A second open coverage at the same priority answers 409 COVERAGE_PRIORITY_TAKEN.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"planId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"subscriber": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "patient"
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"kind"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "contact_party"
													},
													"contactPartyId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"relationshipId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"kind",
													"contactPartyId",
													"relationshipId"
												]
											}
										]
									},
									"memberNumber": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 60
											},
											{
												"type": "null"
											}
										]
									},
									"effectiveFrom": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"effectiveTo": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"releaseOfInformation": {
										"type": "boolean"
									},
									"assignmentOfBenefits": {
										"type": "boolean"
									},
									"coverage": {
										"type": "object",
										"properties": {
											"relationship": {
												"type": "string",
												"enum": [
													"self",
													"spouse",
													"child",
													"other"
												]
											},
											"priority": {
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											"from": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											}
										},
										"required": [
											"relationship",
											"priority",
											"from"
										]
									}
								},
								"required": [
									"planId",
									"subscriber",
									"coverage"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"subscriptionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"relationship": {
											"type": "string",
											"enum": [
												"self",
												"spouse",
												"child",
												"other"
											]
										},
										"priority": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"plan": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"name": {
													"type": "string"
												},
												"planType": {
													"type": "string",
													"enum": [
														"ppo",
														"indemnity",
														"hmo_capitation",
														"discount",
														"medicaid",
														"other"
													]
												},
												"carrierId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"carrierName": {
													"type": "string"
												},
												"renewalMonth": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"id",
												"name",
												"planType",
												"carrierId",
												"carrierName",
												"renewalMonth"
											],
											"additionalProperties": false
										},
										"subscription": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"organizationId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
													"description": "Canonical lowercase UUID organization identifier"
												},
												"planId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"subscriberPatientId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"subscriberContactPartyId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"subscriberRelationshipId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"memberNumber": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"effectiveFrom": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"effectiveTo": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"releaseOfInformation": {
													"type": "boolean"
												},
												"assignmentOfBenefits": {
													"type": "boolean"
												},
												"archivedAt": {
													"anyOf": [
														{
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														{
															"type": "null"
														}
													]
												},
												"createdById": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"createdByName": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"createdBySource": {
													"type": "string",
													"enum": [
														"user",
														"patient",
														"automation",
														"campaign",
														"ai",
														"api",
														"import",
														"system"
													]
												},
												"createdAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"updatedAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"subscriberName": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"id",
												"organizationId",
												"planId",
												"subscriberPatientId",
												"subscriberContactPartyId",
												"subscriberRelationshipId",
												"memberNumber",
												"effectiveFrom",
												"effectiveTo",
												"releaseOfInformation",
												"assignmentOfBenefits",
												"archivedAt",
												"createdById",
												"createdByName",
												"createdBySource",
												"createdAt",
												"updatedAt",
												"subscriberName"
											],
											"additionalProperties": false
										},
										"revisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"usage": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceBenefitUsage"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"subscriptionId",
										"planId",
										"relationship",
										"priority",
										"from",
										"to",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"plan",
										"subscription",
										"revisionId",
										"usage"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/{patientId}/coverages": {
			"post": {
				"summary": "Cover a patient under an existing subscription",
				"tags": [
					"Insurance"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"relationship": {
										"type": "string",
										"enum": [
											"self",
											"spouse",
											"child",
											"other"
										]
									},
									"priority": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"from": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"subscriptionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"relationship",
									"priority",
									"from",
									"subscriptionId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"subscriptionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"relationship": {
											"type": "string",
											"enum": [
												"self",
												"spouse",
												"child",
												"other"
											]
										},
										"priority": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"plan": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"name": {
													"type": "string"
												},
												"planType": {
													"type": "string",
													"enum": [
														"ppo",
														"indemnity",
														"hmo_capitation",
														"discount",
														"medicaid",
														"other"
													]
												},
												"carrierId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"carrierName": {
													"type": "string"
												},
												"renewalMonth": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"id",
												"name",
												"planType",
												"carrierId",
												"carrierName",
												"renewalMonth"
											],
											"additionalProperties": false
										},
										"subscription": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"organizationId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
													"description": "Canonical lowercase UUID organization identifier"
												},
												"planId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"subscriberPatientId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"subscriberContactPartyId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"subscriberRelationshipId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"memberNumber": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"effectiveFrom": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"effectiveTo": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												},
												"releaseOfInformation": {
													"type": "boolean"
												},
												"assignmentOfBenefits": {
													"type": "boolean"
												},
												"archivedAt": {
													"anyOf": [
														{
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														{
															"type": "null"
														}
													]
												},
												"createdById": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"createdByName": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												},
												"createdBySource": {
													"type": "string",
													"enum": [
														"user",
														"patient",
														"automation",
														"campaign",
														"ai",
														"api",
														"import",
														"system"
													]
												},
												"createdAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"updatedAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"subscriberName": {
													"anyOf": [
														{
															"type": "string"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"id",
												"organizationId",
												"planId",
												"subscriberPatientId",
												"subscriberContactPartyId",
												"subscriberRelationshipId",
												"memberNumber",
												"effectiveFrom",
												"effectiveTo",
												"releaseOfInformation",
												"assignmentOfBenefits",
												"archivedAt",
												"createdById",
												"createdByName",
												"createdBySource",
												"createdAt",
												"updatedAt",
												"subscriberName"
											],
											"additionalProperties": false
										},
										"revisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"usage": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceBenefitUsage"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"subscriptionId",
										"planId",
										"relationship",
										"priority",
										"from",
										"to",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"plan",
										"subscription",
										"revisionId",
										"usage"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/{patientId}/coverages/{id}/end": {
			"post": {
				"summary": "End a coverage",
				"tags": [
					"Insurance"
				],
				"description": "Seals the coverage's end date; the row stays because claims and estimates cite it.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"to": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"to"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"subscriptionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"relationship": {
											"type": "string",
											"enum": [
												"self",
												"spouse",
												"child",
												"other"
											]
										},
										"priority": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"subscriptionId",
										"planId",
										"relationship",
										"priority",
										"from",
										"to",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/{patientId}/usage": {
			"put": {
				"summary": "Record the benefit used so far",
				"tags": [
					"Insurance"
				],
				"description": "The deductible met and maximum used this benefit year for one category, as the carrier reported it; replaces the figures for that year and category.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"subscriptionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"benefitYear": {
										"type": "integer",
										"minimum": 1900,
										"maximum": 2999
									},
									"category": {
										"type": "string",
										"enum": [
											"basic",
											"preventive",
											"major",
											"ortho"
										]
									},
									"deductibleMetCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"maximumUsedCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"subscriptionId",
									"benefitYear",
									"category",
									"deductibleMetCents",
									"maximumUsedCents"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"subscriptionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"benefitYear": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"category": {
											"type": "string",
											"enum": [
												"none",
												"basic",
												"preventive",
												"major",
												"ortho"
											]
										},
										"deductibleMetCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"maximumUsedCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"manual",
												"eligibility",
												"carrier_import"
											]
										},
										"verifiedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"subscriptionId",
										"patientId",
										"benefitYear",
										"category",
										"deductibleMetCents",
										"maximumUsedCents",
										"currency",
										"source",
										"verifiedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/{patientId}/estimate": {
			"post": {
				"summary": "Estimate the insurance portion of planned treatment",
				"tags": [
					"Insurance"
				],
				"description": "Reads the primary coverage's live benefit revision on the service date and explains, per procedure, the billed fee, allowed amount, coverage, deductible, copay, payer and patient portions. Stamps the revision and payer portion onto each procedure.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureIds": {
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"serviceDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"stamp": {
										"default": true,
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"serviceDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"coverageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"revisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"benefitYear": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceEstimateLine"
											}
										},
										"totals": {
											"type": "object",
											"properties": {
												"billedCents": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"payerCents": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"patientCents": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"billedCents",
												"payerCents",
												"patientCents"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"serviceDate",
										"currency",
										"coverageId",
										"revisionId",
										"benefitYear",
										"notes",
										"items",
										"totals"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/claims/{patientId}": {
			"get": {
				"summary": "List a patient's insurance claims",
				"tags": [
					"Insurance"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaim"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Build a claim from completed procedures",
				"tags": [
					"Insurance"
				],
				"description": "Every procedure must be completed, carry a CDT code, share one rendering practitioner and one location, and not sit on another open claim of the same coverage. The claim opens as a draft with its items priced from the procedures' fees and stamped estimates. A secondary or tertiary claim names its prior claim (409 PRIOR_ADJUDICATION_MISSING until that claim has a posted remittance; COVERAGE_PRIORITY_UNSUPPORTED past tertiary) — inheriting its place of treatment and diagnoses when they are omitted, and carrying every one of its items (409 CLAIM_ITEMS_PARTIAL on a subset) — or carries the prior payers' EOB figures; a coverage past the primary without either is refused with 409 PRIOR_CLAIM_REQUIRED, and a coverageId at another priority with 409 COVERAGE_PRIORITY_MISMATCH.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureIds": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"kind": {
										"default": "claim",
										"type": "string",
										"enum": [
											"claim",
											"predetermination"
										]
									},
									"coverageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"secondaryOfClaimId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"externalPrior": {
										"minItems": 1,
										"maxItems": 2,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"payer": {
													"type": "object",
													"properties": {
														"payerId": {
															"type": "string",
															"minLength": 1,
															"maxLength": 80
														},
														"name": {
															"type": "string",
															"minLength": 1,
															"maxLength": 60
														},
														"claimControlNumber": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 50
																},
																{
																	"type": "null"
																}
															]
														},
														"adjudicationDate": {
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														"responsibility": {
															"type": "string",
															"enum": [
																"P",
																"S"
															]
														}
													},
													"required": [
														"payerId",
														"name",
														"claimControlNumber",
														"adjudicationDate",
														"responsibility"
													]
												},
												"subscriber": {
													"type": "object",
													"properties": {
														"lastName": {
															"type": "string",
															"minLength": 1,
															"maxLength": 60
														},
														"firstName": {
															"type": "string",
															"minLength": 1,
															"maxLength": 35
														},
														"memberId": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 80
																},
																{
																	"type": "null"
																}
															]
														},
														"relationshipCode": {
															"type": "string",
															"enum": [
																"18",
																"19",
																"01",
																"G8"
															]
														},
														"groupNumber": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 50
																},
																{
																	"type": "null"
																}
															]
														},
														"assignmentIndicator": {
															"type": "string",
															"enum": [
																"Y",
																"N"
															]
														},
														"releaseCode": {
															"type": "string",
															"enum": [
																"Y",
																"I"
															]
														}
													},
													"required": [
														"lastName",
														"firstName",
														"memberId",
														"relationshipCode",
														"groupNumber",
														"assignmentIndicator",
														"releaseCode"
													]
												},
												"claim": {
													"type": "object",
													"properties": {
														"paidCents": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"adjustments": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"group": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 2
																	},
																	"reason": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 5
																	},
																	"amountCents": {
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"group",
																	"reason",
																	"amountCents"
																]
															}
														},
														"patientLiabilityCents": {
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"paidCents",
														"adjustments",
														"patientLiabilityCents"
													]
												},
												"items": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"procedureId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"procedureCode": {
																"type": "string",
																"minLength": 1,
																"maxLength": 48
															},
															"paidCents": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"units": {
																"type": "integer",
																"minimum": 0,
																"maximum": 9007199254740991
															},
															"adjustments": {
																"type": "array",
																"items": {
																	"type": "object",
																	"properties": {
																		"group": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 2
																		},
																		"reason": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 5
																		},
																		"amountCents": {
																			"type": "integer",
																			"minimum": -9007199254740991,
																			"maximum": 9007199254740991
																		}
																	},
																	"required": [
																		"group",
																		"reason",
																		"amountCents"
																	]
																}
															},
															"patientLiabilityCents": {
																"anyOf": [
																	{
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"date": {
																"type": "string",
																"format": "date",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
															}
														},
														"required": [
															"procedureId",
															"procedureCode",
															"paidCents",
															"units",
															"adjustments",
															"patientLiabilityCents",
															"date"
														]
													}
												}
											},
											"required": [
												"payer",
												"subscriber",
												"claim",
												"items"
											]
										}
									},
									"diagnosisCodes": {
										"maxItems": 12,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 10
										}
									},
									"placeOfTreatment": {
										"type": "string",
										"pattern": "^[0-9]{2}$"
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"attachmentsRequired": {
										"default": false,
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"coverageId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"benefitRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"claim",
												"predetermination"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"queued",
												"sent",
												"accepted",
												"rejected",
												"pending_info",
												"received",
												"paid",
												"partially_paid",
												"denied",
												"void",
												"resubmitted",
												"settled"
											]
										},
										"responsibility": {
											"type": "string",
											"enum": [
												"P",
												"S",
												"T"
											]
										},
										"secondaryOfClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priorSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"claim",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"placeOfTreatment": {
											"type": "string"
										},
										"billingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"renderingPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"renderingCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"diagnosisCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"totalBilledCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"totalAllowedCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalPaidCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalWriteOffCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"patientPortionCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"payerClaimNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouse": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"stedi",
														"claim_md",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouseRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"submittedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"receivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"paidAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"denialCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"attachmentsRequired": {
											"type": "boolean"
										},
										"orthoMonthsRemaining": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planName": {
											"type": "string"
										},
										"carrierName": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimItem"
											}
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"subjectKind": {
														"type": "string",
														"enum": [
															"claim",
															"coverage"
														]
													},
													"claimId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"coverageId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"resubmit",
															"status_query",
															"attachment",
															"eligibility"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"priorAdjudicationRevision": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/InsuranceDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"subjectKind",
													"claimId",
													"coverageId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"priorAdjudicationRevision",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										},
										"attachments": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimAttachment"
											}
										},
										"priorAdjudications": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimPriorAdjudicationRow"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"coverageId",
										"planId",
										"benefitRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"responsibility",
										"secondaryOfClaimId",
										"priorSource",
										"placeOfTreatment",
										"billingPractitionerId",
										"renderingPractitionerId",
										"renderingCredentialRevisionId",
										"diagnosisCodes",
										"totalBilledCents",
										"totalAllowedCents",
										"totalPaidCents",
										"totalWriteOffCents",
										"patientPortionCents",
										"currency",
										"payerClaimNumber",
										"clearinghouse",
										"clearinghouseRef",
										"submittedAt",
										"receivedAt",
										"paidAt",
										"denialCodes",
										"note",
										"attachmentsRequired",
										"orthoMonthsRemaining",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planName",
										"carrierName",
										"payerId",
										"items",
										"events",
										"submissions",
										"attachments",
										"priorAdjudications"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/claims/{patientId}/claimable": {
			"get": {
				"summary": "List the procedures a claim can be built from",
				"tags": [
					"Insurance"
				],
				"description": "Completed CDT procedures on no open claim. With coverageId, procedures already claimed on another coverage are listed too: one procedure sits on the primary and on the secondary.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "coverageId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClaimableProcedure"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/claims/{patientId}/{id}": {
			"get": {
				"summary": "Read a claim with its items, history and submissions",
				"tags": [
					"Insurance"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"coverageId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"benefitRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"claim",
												"predetermination"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"queued",
												"sent",
												"accepted",
												"rejected",
												"pending_info",
												"received",
												"paid",
												"partially_paid",
												"denied",
												"void",
												"resubmitted",
												"settled"
											]
										},
										"responsibility": {
											"type": "string",
											"enum": [
												"P",
												"S",
												"T"
											]
										},
										"secondaryOfClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priorSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"claim",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"placeOfTreatment": {
											"type": "string"
										},
										"billingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"renderingPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"renderingCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"diagnosisCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"totalBilledCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"totalAllowedCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalPaidCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalWriteOffCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"patientPortionCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"payerClaimNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouse": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"stedi",
														"claim_md",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouseRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"submittedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"receivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"paidAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"denialCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"attachmentsRequired": {
											"type": "boolean"
										},
										"orthoMonthsRemaining": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planName": {
											"type": "string"
										},
										"carrierName": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimItem"
											}
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"subjectKind": {
														"type": "string",
														"enum": [
															"claim",
															"coverage"
														]
													},
													"claimId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"coverageId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"resubmit",
															"status_query",
															"attachment",
															"eligibility"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"priorAdjudicationRevision": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/InsuranceDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"subjectKind",
													"claimId",
													"coverageId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"priorAdjudicationRevision",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										},
										"attachments": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimAttachment"
											}
										},
										"priorAdjudications": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimPriorAdjudicationRow"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"coverageId",
										"planId",
										"benefitRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"responsibility",
										"secondaryOfClaimId",
										"priorSource",
										"placeOfTreatment",
										"billingPractitionerId",
										"renderingPractitionerId",
										"renderingCredentialRevisionId",
										"diagnosisCodes",
										"totalBilledCents",
										"totalAllowedCents",
										"totalPaidCents",
										"totalWriteOffCents",
										"patientPortionCents",
										"currency",
										"payerClaimNumber",
										"clearinghouse",
										"clearinghouseRef",
										"submittedAt",
										"receivedAt",
										"paidAt",
										"denialCodes",
										"note",
										"attachmentsRequired",
										"orthoMonthsRemaining",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planName",
										"carrierName",
										"payerId",
										"items",
										"events",
										"submissions",
										"attachments",
										"priorAdjudications"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/claims/{patientId}/{id}/queue": {
			"post": {
				"summary": "Queue a claim for the clearinghouse",
				"tags": [
					"Insurance"
				],
				"description": "Builds the 837D payload, records it as the next submission generation and moves the claim to queued (or resubmitted after a rejection); the delivery lane sends it within the minute. Refused with 409 BILLING_IDENTITY_MISSING until the practice's NPI and tax id are on file, 409 NPI_MISSING while the rendering practitioner has no NPI, 409 CLAIM_ATTACHMENT_MISSING when attachments are required and none is attached, and — on a secondary or tertiary — 409 PRIOR_ADJUDICATION_MISSING without prior-payer figures or 409 PRIOR_ADJUDICATION_INCOMPLETE when an item has no prior line. The submission pins the prior-adjudication revision it carried.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"coverageId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"benefitRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"claim",
												"predetermination"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"queued",
												"sent",
												"accepted",
												"rejected",
												"pending_info",
												"received",
												"paid",
												"partially_paid",
												"denied",
												"void",
												"resubmitted",
												"settled"
											]
										},
										"responsibility": {
											"type": "string",
											"enum": [
												"P",
												"S",
												"T"
											]
										},
										"secondaryOfClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priorSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"claim",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"placeOfTreatment": {
											"type": "string"
										},
										"billingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"renderingPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"renderingCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"diagnosisCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"totalBilledCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"totalAllowedCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalPaidCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalWriteOffCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"patientPortionCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"payerClaimNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouse": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"stedi",
														"claim_md",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouseRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"submittedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"receivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"paidAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"denialCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"attachmentsRequired": {
											"type": "boolean"
										},
										"orthoMonthsRemaining": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planName": {
											"type": "string"
										},
										"carrierName": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimItem"
											}
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"subjectKind": {
														"type": "string",
														"enum": [
															"claim",
															"coverage"
														]
													},
													"claimId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"coverageId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"resubmit",
															"status_query",
															"attachment",
															"eligibility"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"priorAdjudicationRevision": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/InsuranceDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"subjectKind",
													"claimId",
													"coverageId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"priorAdjudicationRevision",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										},
										"attachments": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimAttachment"
											}
										},
										"priorAdjudications": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimPriorAdjudicationRow"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"coverageId",
										"planId",
										"benefitRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"responsibility",
										"secondaryOfClaimId",
										"priorSource",
										"placeOfTreatment",
										"billingPractitionerId",
										"renderingPractitionerId",
										"renderingCredentialRevisionId",
										"diagnosisCodes",
										"totalBilledCents",
										"totalAllowedCents",
										"totalPaidCents",
										"totalWriteOffCents",
										"patientPortionCents",
										"currency",
										"payerClaimNumber",
										"clearinghouse",
										"clearinghouseRef",
										"submittedAt",
										"receivedAt",
										"paidAt",
										"denialCodes",
										"note",
										"attachmentsRequired",
										"orthoMonthsRemaining",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planName",
										"carrierName",
										"payerId",
										"items",
										"events",
										"submissions",
										"attachments",
										"priorAdjudications"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/claims/{patientId}/{id}/events": {
			"post": {
				"summary": "Record a claim outcome by hand",
				"tags": [
					"Insurance"
				],
				"description": "Moves the claim along its state machine from what a paper EOB, a payer portal or the desk knows: accepted, rejected, pending information, received, paid, partially paid, denied, settled or void. The event is the record; the claim's status and totals follow from it.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"toStatus": {
										"type": "string",
										"enum": [
											"draft",
											"queued",
											"sent",
											"accepted",
											"rejected",
											"pending_info",
											"received",
											"paid",
											"partially_paid",
											"denied",
											"void",
											"resubmitted",
											"settled"
										]
									},
									"reason": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"amounts": {
										"type": "object",
										"properties": {
											"paidDeltaCents": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"allowedDeltaCents": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"writeOffDeltaCents": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"patientPortionCents": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"payerClaimNumber": {
												"type": "string",
												"maxLength": 60
											},
											"denialCodes": {
												"maxItems": 20,
												"type": "array",
												"items": {
													"type": "string",
													"maxLength": 20
												}
											}
										}
									}
								},
								"required": [
									"toStatus"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"coverageId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"benefitRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"claim",
												"predetermination"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"queued",
												"sent",
												"accepted",
												"rejected",
												"pending_info",
												"received",
												"paid",
												"partially_paid",
												"denied",
												"void",
												"resubmitted",
												"settled"
											]
										},
										"responsibility": {
											"type": "string",
											"enum": [
												"P",
												"S",
												"T"
											]
										},
										"secondaryOfClaimId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"priorSource": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"claim",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"placeOfTreatment": {
											"type": "string"
										},
										"billingPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"renderingPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"renderingCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"diagnosisCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"totalBilledCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"totalAllowedCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalPaidCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"totalWriteOffCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"patientPortionCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"payerClaimNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouse": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"stedi",
														"claim_md",
														"manual"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouseRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"submittedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"receivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"paidAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"denialCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"attachmentsRequired": {
											"type": "boolean"
										},
										"orthoMonthsRemaining": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planName": {
											"type": "string"
										},
										"carrierName": {
											"type": "string"
										},
										"payerId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimItem"
											}
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"subjectKind": {
														"type": "string",
														"enum": [
															"claim",
															"coverage"
														]
													},
													"claimId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"coverageId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"resubmit",
															"status_query",
															"attachment",
															"eligibility"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"priorAdjudicationRevision": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/InsuranceDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"subjectKind",
													"claimId",
													"coverageId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"priorAdjudicationRevision",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										},
										"attachments": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimAttachment"
											}
										},
										"priorAdjudications": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimPriorAdjudicationRow"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"coverageId",
										"planId",
										"benefitRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"responsibility",
										"secondaryOfClaimId",
										"priorSource",
										"placeOfTreatment",
										"billingPractitionerId",
										"renderingPractitionerId",
										"renderingCredentialRevisionId",
										"diagnosisCodes",
										"totalBilledCents",
										"totalAllowedCents",
										"totalPaidCents",
										"totalWriteOffCents",
										"patientPortionCents",
										"currency",
										"payerClaimNumber",
										"clearinghouse",
										"clearinghouseRef",
										"submittedAt",
										"receivedAt",
										"paidAt",
										"denialCodes",
										"note",
										"attachmentsRequired",
										"orthoMonthsRemaining",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planName",
										"carrierName",
										"payerId",
										"items",
										"events",
										"submissions",
										"attachments",
										"priorAdjudications"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/claims/{patientId}/{id}/attachments": {
			"post": {
				"summary": "Attach a patient document to a claim",
				"tags": [
					"Insurance"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientDocumentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"requirementType": {
										"type": "string",
										"enum": [
											"xray",
											"perio_chart",
											"narrative",
											"photo",
											"eob",
											"other"
										]
									},
									"neaNumber": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"patientDocumentId",
									"requirementType"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"claimId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientDocumentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"requirementType": {
											"type": "string",
											"enum": [
												"xray",
												"perio_chart",
												"narrative",
												"photo",
												"eob",
												"other"
											]
										},
										"neaNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"submissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"submissionKind": {
											"type": "string"
										},
										"sentAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"claimId",
										"patientId",
										"patientDocumentId",
										"requirementType",
										"neaNumber",
										"submissionId",
										"submissionKind",
										"sentAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/claims/{patientId}/{id}/prior-adjudication": {
			"post": {
				"summary": "Enter what the prior payers did with a claim, from their EOBs",
				"tags": [
					"Insurance"
				],
				"description": "Appends the next prior-adjudication revision of a draft secondary or tertiary claim whose primary never went through Smileline; the next submission carries it. Refused with 409 CLAIM_TRANSITION once the claim left draft, 409 PRIOR_SOURCE_MISMATCH on a claim whose prior payer facts derive from a Smileline claim, 409 PRIOR_ADJUDICATION_INCOMPLETE when an entry omits one of the claim's items, and 409 CLAIM_ITEMS_PARTIAL when it adjudicates an item the claim does not carry.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"priors": {
										"minItems": 1,
										"maxItems": 2,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"payer": {
													"type": "object",
													"properties": {
														"payerId": {
															"type": "string",
															"minLength": 1,
															"maxLength": 80
														},
														"name": {
															"type": "string",
															"minLength": 1,
															"maxLength": 60
														},
														"claimControlNumber": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 50
																},
																{
																	"type": "null"
																}
															]
														},
														"adjudicationDate": {
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														"responsibility": {
															"type": "string",
															"enum": [
																"P",
																"S"
															]
														}
													},
													"required": [
														"payerId",
														"name",
														"claimControlNumber",
														"adjudicationDate",
														"responsibility"
													]
												},
												"subscriber": {
													"type": "object",
													"properties": {
														"lastName": {
															"type": "string",
															"minLength": 1,
															"maxLength": 60
														},
														"firstName": {
															"type": "string",
															"minLength": 1,
															"maxLength": 35
														},
														"memberId": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 80
																},
																{
																	"type": "null"
																}
															]
														},
														"relationshipCode": {
															"type": "string",
															"enum": [
																"18",
																"19",
																"01",
																"G8"
															]
														},
														"groupNumber": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 50
																},
																{
																	"type": "null"
																}
															]
														},
														"assignmentIndicator": {
															"type": "string",
															"enum": [
																"Y",
																"N"
															]
														},
														"releaseCode": {
															"type": "string",
															"enum": [
																"Y",
																"I"
															]
														}
													},
													"required": [
														"lastName",
														"firstName",
														"memberId",
														"relationshipCode",
														"groupNumber",
														"assignmentIndicator",
														"releaseCode"
													]
												},
												"claim": {
													"type": "object",
													"properties": {
														"paidCents": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"adjustments": {
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"group": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 2
																	},
																	"reason": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 5
																	},
																	"amountCents": {
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"group",
																	"reason",
																	"amountCents"
																]
															}
														},
														"patientLiabilityCents": {
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"paidCents",
														"adjustments",
														"patientLiabilityCents"
													]
												},
												"items": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"procedureId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"procedureCode": {
																"type": "string",
																"minLength": 1,
																"maxLength": 48
															},
															"paidCents": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"units": {
																"type": "integer",
																"minimum": 0,
																"maximum": 9007199254740991
															},
															"adjustments": {
																"type": "array",
																"items": {
																	"type": "object",
																	"properties": {
																		"group": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 2
																		},
																		"reason": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 5
																		},
																		"amountCents": {
																			"type": "integer",
																			"minimum": -9007199254740991,
																			"maximum": 9007199254740991
																		}
																	},
																	"required": [
																		"group",
																		"reason",
																		"amountCents"
																	]
																}
															},
															"patientLiabilityCents": {
																"anyOf": [
																	{
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"date": {
																"type": "string",
																"format": "date",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
															}
														},
														"required": [
															"procedureId",
															"procedureCode",
															"paidCents",
															"units",
															"adjustments",
															"patientLiabilityCents",
															"date"
														]
													}
												}
											},
											"required": [
												"payer",
												"subscriber",
												"claim",
												"items"
											]
										}
									}
								},
								"required": [
									"priors"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceClaimPriorAdjudicationRow"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/insurance/{patientId}/eligibility": {
			"get": {
				"summary": "List a patient's eligibility checks",
				"tags": [
					"Insurance"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InsuranceEligibilityCheck"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Check eligibility with the payer",
				"tags": [
					"Insurance"
				],
				"description": "A clearinghouse check queues a 270 on the outbound lane and answers pending; the 271 lands within the minute. A manual or portal check records the answer at once.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"coverageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"transport": {
										"default": "clearinghouse_270",
										"type": "string",
										"enum": [
											"clearinghouse_270",
											"payer_portal",
											"manual"
										]
									},
									"eligible": {
										"type": "boolean"
									},
									"result": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									}
								},
								"required": [
									"coverageId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"coverageId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"planId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"requestedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"transport": {
											"type": "string",
											"enum": [
												"clearinghouse_270",
												"payer_portal",
												"manual"
											]
										},
										"requestSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requestKind": {
											"type": "string"
										},
										"benefitRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"ingressReceiptId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"pending",
												"received",
												"failed",
												"parked"
											]
										},
										"receivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"failedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"parkedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"eligible": {
											"anyOf": [
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										},
										"result": {},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"coverageId",
										"planId",
										"requestedAt",
										"transport",
										"requestSubmissionId",
										"requestKind",
										"benefitRevisionId",
										"ingressReceiptId",
										"status",
										"receivedAt",
										"failedAt",
										"parkedAt",
										"eligible",
										"result",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/insurance/billing": {
			"get": {
				"summary": "Read the practice's claims billing identity",
				"tags": [
					"Insurance"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"billingNpi": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"billingTaxId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"billingTaxonomyCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouseConfigured": {
											"type": "boolean"
										}
									},
									"required": [
										"billingNpi",
										"billingTaxId",
										"billingTaxonomyCode",
										"clearinghouseConfigured"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Set the practice's claims billing identity",
				"tags": [
					"Insurance"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"billingNpi": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9]{10}$"
											},
											{
												"type": "null"
											}
										]
									},
									"billingTaxId": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9]{9}$"
											},
											{
												"type": "null"
											}
										]
									},
									"billingTaxonomyCode": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9A-Z]{10}$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"billingNpi",
									"billingTaxId",
									"billingTaxonomyCode"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"billingNpi": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"billingTaxId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"billingTaxonomyCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clearinghouseConfigured": {
											"type": "boolean"
										}
									},
									"required": [
										"billingNpi",
										"billingTaxId",
										"billingTaxonomyCode",
										"clearinghouseConfigured"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/rules": {
			"get": {
				"summary": "Read the NHS rates and vocabularies in force",
				"tags": [
					"NHS"
				],
				"description": "Every band rate and dataset rule of a nation in force on a day, with the frozen evidence each came from. Values absent from every frozen excerpt are null and the course that needs them is refused.",
				"parameters": [
					{
						"name": "nation",
						"in": "query",
						"required": false,
						"schema": {
							"default": "england",
							"type": "string",
							"enum": [
								"england",
								"wales",
								"scotland",
								"northern_ireland"
							]
						}
					},
					{
						"name": "onDate",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"nation": {
											"type": "string",
											"enum": [
												"england",
												"wales",
												"scotland",
												"northern_ireland"
											]
										},
										"onDate": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"rates": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsBandRate"
											}
										},
										"datasetRules": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsDatasetRule"
											}
										},
										"sources": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsRuleSource"
											}
										}
									},
									"required": [
										"nation",
										"onDate",
										"rates",
										"datasetRules",
										"sources"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts": {
			"get": {
				"summary": "List NHS contracts",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsContract"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a NHS contract",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"contractNumber": {
										"type": "string",
										"pattern": "^[0-9A-Za-z/-]{1,20}$"
									},
									"nhsLocationNumber": {
										"type": "string",
										"pattern": "^[0-9A-Za-z]{1,10}$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"kind": {
										"type": "string",
										"enum": [
											"gds",
											"pds",
											"pds_plus",
											"ortho",
											"other"
										]
									},
									"startOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"endOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"name": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"notes": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"contractNumber",
									"nhsLocationNumber",
									"locationId",
									"kind",
									"startOn"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"contractNumber": {
											"type": "string"
										},
										"nhsLocationNumber": {
											"type": "string"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gds",
												"pds",
												"pds_plus",
												"ortho",
												"other"
											]
										},
										"startOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"endOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"contractNumber",
										"nhsLocationNumber",
										"locationId",
										"kind",
										"startOn",
										"endOn",
										"name",
										"notes",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}": {
			"patch": {
				"summary": "Update a NHS contract",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"contractNumber": {
										"type": "string",
										"pattern": "^[0-9A-Za-z/-]{1,20}$"
									},
									"nhsLocationNumber": {
										"type": "string",
										"pattern": "^[0-9A-Za-z]{1,10}$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"kind": {
										"type": "string",
										"enum": [
											"gds",
											"pds",
											"pds_plus",
											"ortho",
											"other"
										]
									},
									"startOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"endOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"name": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"notes": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"contractNumber": {
											"type": "string"
										},
										"nhsLocationNumber": {
											"type": "string"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gds",
												"pds",
												"pds_plus",
												"ortho",
												"other"
											]
										},
										"startOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"endOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"contractNumber",
										"nhsLocationNumber",
										"locationId",
										"kind",
										"startOn",
										"endOn",
										"name",
										"notes",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}/archive": {
			"post": {
				"summary": "Archive a NHS contract",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"contractNumber": {
											"type": "string"
										},
										"nhsLocationNumber": {
											"type": "string"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gds",
												"pds",
												"pds_plus",
												"ortho",
												"other"
											]
										},
										"startOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"endOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"contractNumber",
										"nhsLocationNumber",
										"locationId",
										"kind",
										"startOn",
										"endOn",
										"name",
										"notes",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}/restore": {
			"post": {
				"summary": "Restore an archived NHS contract",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"contractNumber": {
											"type": "string"
										},
										"nhsLocationNumber": {
											"type": "string"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"gds",
												"pds",
												"pds_plus",
												"ortho",
												"other"
											]
										},
										"startOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"endOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"contractNumber",
										"nhsLocationNumber",
										"locationId",
										"kind",
										"startOn",
										"endOn",
										"name",
										"notes",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}/detail": {
			"get": {
				"summary": "Read a contract's years and performer targets",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"contract": {
											"$ref": "#/components/schemas/NhsContract"
										},
										"years": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsContractYear"
											}
										},
										"performers": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsPerformerTarget"
											}
										}
									},
									"required": [
										"contract",
										"years",
										"performers"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}/years": {
			"put": {
				"summary": "Set a contract year's targets and values",
				"tags": [
					"NHS"
				],
				"description": "Creates or replaces the year that starts on the given date. Years of one contract never overlap (409 YEAR_OVERLAP).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"yearStart": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"yearEnd": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"udaTarget": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\d{1,8}(\\.\\d{1,2})?$"
											},
											{
												"type": "null"
											}
										]
									},
									"uoaTarget": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\d{1,8}(\\.\\d{1,2})?$"
											},
											{
												"type": "null"
											}
										]
									},
									"udaValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"uoaValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"source": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"yearStart",
									"yearEnd"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"yearStart": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"yearEnd": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"udaTarget": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"uoaTarget": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"udaValueCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"uoaValueCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"source": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"contractId",
										"yearStart",
										"yearEnd",
										"udaTarget",
										"uoaTarget",
										"udaValueCents",
										"uoaValueCents",
										"currency",
										"source",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}/performers": {
			"post": {
				"summary": "Add a performer's target on a contract",
				"tags": [
					"NHS"
				],
				"description": "One open target per performer and contract (409 PERFORMER_OPEN); end the open one first to change it. The performer number is also recorded on the practitioner's identifiers.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"practitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"performerNumber": {
										"type": "string",
										"pattern": "^[0-9]{1,10}$"
									},
									"udaTarget": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\d{1,8}(\\.\\d{1,2})?$"
											},
											{
												"type": "null"
											}
										]
									},
									"uoaTarget": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\d{1,8}(\\.\\d{1,2})?$"
											},
											{
												"type": "null"
											}
										]
									},
									"isVt": {
										"default": false,
										"type": "boolean"
									},
									"defaultForPractitioner": {
										"default": false,
										"type": "boolean"
									},
									"from": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"practitionerId",
									"performerNumber",
									"from"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerNumber": {
											"type": "string"
										},
										"udaTarget": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"uoaTarget": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"isVt": {
											"type": "boolean"
										},
										"defaultForPractitioner": {
											"type": "boolean"
										},
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"contractId",
										"practitionerId",
										"performerNumber",
										"udaTarget",
										"uoaTarget",
										"isVt",
										"defaultForPractitioner",
										"from",
										"to",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/performers/{id}/end": {
			"post": {
				"summary": "End a performer's target",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"to": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"to"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerNumber": {
											"type": "string"
										},
										"udaTarget": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"uoaTarget": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"isVt": {
											"type": "boolean"
										},
										"defaultForPractitioner": {
											"type": "boolean"
										},
										"from": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"to": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"contractId",
										"practitionerId",
										"performerNumber",
										"udaTarget",
										"uoaTarget",
										"isVt",
										"defaultForPractitioner",
										"from",
										"to",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}/schedules": {
			"get": {
				"summary": "List a contract's imported pay schedules",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsScheduleView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Import a pay schedule and settle its claims",
				"tags": [
					"NHS"
				],
				"description": "The file is captured raw before it is parsed. Each line is matched to the contract's submitted claim by NHSBSA reference and recorded as that claim's completed event with the awarded activity; a line with no match, or naming a claim that is not waiting, parks with a review task. The same file imports once (duplicate: true on a re-upload); an unreadable file parks for review (422 SCHEDULE_UNREADABLE).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"scheduleMonth": {
										"type": "string",
										"allOf": [
											{
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"pattern": "-01$"
											}
										]
									},
									"csv": {
										"type": "string",
										"minLength": 1,
										"maxLength": 4194304
									}
								},
								"required": [
									"scheduleMonth",
									"csv"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"schedule": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/NhsScheduleView"
												},
												{
													"type": "null"
												}
											]
										},
										"matched": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"parked": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"duplicate": {
											"type": "boolean"
										}
									},
									"required": [
										"schedule",
										"matched",
										"parked",
										"duplicate"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/nhs/contracts/{id}/activity": {
			"get": {
				"summary": "UDA delivered, expected and forecast for a contract year",
				"tags": [
					"NHS"
				],
				"description": "Awarded activity from completed claims, expected activity from claims still in flight, and a run-rate forecast against the year's target, by month and by performer. Defaults to the year covering today (404 YEAR_MISSING when none is set).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "yearStart",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"yearStart": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"yearEnd": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"udaTarget": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expectedUda": {
											"type": "string"
										},
										"awardedUda": {
											"type": "string"
										},
										"forecastUda": {
											"type": "string"
										},
										"elapsedFraction": {
											"type": "number"
										},
										"byMonth": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"month": {
														"type": "string"
													},
													"expectedUda": {
														"type": "string"
													},
													"awardedUda": {
														"type": "string"
													},
													"claims": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"month",
													"expectedUda",
													"awardedUda",
													"claims"
												],
												"additionalProperties": false
											}
										},
										"byPerformer": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"practitionerId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"practitionerName": {
														"type": "string"
													},
													"performerNumber": {
														"type": "string"
													},
													"udaTarget": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"expectedUda": {
														"type": "string"
													},
													"awardedUda": {
														"type": "string"
													}
												},
												"required": [
													"practitionerId",
													"practitionerName",
													"performerNumber",
													"udaTarget",
													"expectedUda",
													"awardedUda"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"yearStart",
										"yearEnd",
										"udaTarget",
										"expectedUda",
										"awardedUda",
										"forecastUda",
										"elapsedFraction",
										"byMonth",
										"byPerformer"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}": {
			"get": {
				"summary": "Read a patient's NHS details",
				"tags": [
					"NHS"
				],
				"description": "Exemption and remission as recorded, the ethnicity code and rule, and every identifier with the superseded ones kept.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"details": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/NhsPatientDetails"
												},
												{
													"type": "null"
												}
											]
										},
										"ethnicityCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"ethnicityRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"identifiers": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsPatientIdentifier"
											}
										}
									},
									"required": [
										"details",
										"ethnicityCode",
										"ethnicityRuleId",
										"identifiers"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/details": {
			"put": {
				"summary": "Record a patient's NHS exemption, remission and ethnicity",
				"tags": [
					"NHS"
				],
				"description": "Creates the details row on first save; an exemption or remission names a dataset rule of its own kind (422 RULE_KIND).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"exemptionCodeRuleId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"exemptionEvidenceSeen": {
										"type": "boolean"
									},
									"exemptionEvidenceAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									},
									"exemptionExpiresOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"remissionCodeRuleId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"consentToContact": {
										"anyOf": [
											{
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {}
											},
											{
												"type": "null"
											}
										]
									},
									"ethnicityRuleId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"exemptionCodeRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleKind": {
											"type": "string"
										},
										"exemptionEvidenceSeen": {
											"type": "boolean"
										},
										"exemptionEvidenceAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionExpiresOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										},
										"remissionCodeRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"remissionRuleKind": {
											"type": "string"
										},
										"consentToContact": {},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"exemptionCodeRuleId",
										"exemptionRuleKind",
										"exemptionEvidenceSeen",
										"exemptionEvidenceAt",
										"exemptionExpiresOn",
										"remissionCodeRuleId",
										"remissionRuleKind",
										"consentToContact",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/identifiers": {
			"post": {
				"summary": "Record a patient's NHS number",
				"tags": [
					"NHS"
				],
				"description": "An NHS number must pass the modulus-11 check (400 NHS_NUMBER_INVALID); one patient holds a number at a time (409 NHS_NUMBER_TAKEN). A new number supersedes the patient's live one of the same kind.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"default": "nhs_number",
										"type": "string",
										"enum": [
											"nhs_number",
											"chi_number",
											"hc_number"
										]
									},
									"value": {
										"type": "string",
										"minLength": 10,
										"maxLength": 14
									},
									"verifiedSource": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"value"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"nhs_number",
												"chi_number",
												"hc_number"
											]
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"value": {
											"type": "string"
										},
										"verifiedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"verifiedSource": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"kind",
										"jurisdiction",
										"ruleVersion",
										"value",
										"verifiedAt",
										"verifiedSource",
										"supersededAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/courses": {
			"get": {
				"summary": "List a patient's NHS courses of treatment",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsCourseView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Open an NHS course of treatment on an accepted plan",
				"tags": [
					"NHS"
				],
				"description": "One course per plan; the plan must be accepted and priced from an NHS price list (409 PLAN_NOT_NHS, 409 PLAN_NOT_ACCEPTED). The band's rate in force on the acceptance date prices the course; a band whose rate or charge the frozen evidence does not carry is refused (409 NHS_RATE_MISSING, 409 NHS_CHARGE_MISSING) unless the patient's recorded exemption sets the charge to zero. The performer must hold an open target on the contract, which must be claimed from the plan's site. The highest BPE sextant comes from the latest completed BPE.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"completedOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"continuationOfCourseId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"recallIntervalMonths": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 24
											},
											{
												"type": "null"
											}
										]
									},
									"untreatedDecayedTeeth": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 32
											},
											{
												"type": "null"
											}
										]
									},
									"bestPracticePrevention": {
										"type": "boolean"
									},
									"aerosolAppointments": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"referralToOtherProvider": {
										"type": "boolean"
									},
									"sedation": {
										"type": "boolean"
									},
									"notes": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentPlanId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"contractId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"performerTargetId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"band": {
										"type": "string",
										"enum": [
											"1",
											"3",
											"2a",
											"2b",
											"2c",
											"urgent",
											"reg11",
											"fluoride_varnish",
											"ortho_assess",
											"ortho_treat",
											"free_repair"
										]
									}
								},
								"required": [
									"treatmentPlanId",
									"contractId",
									"performerTargetId",
									"band"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"treatmentPlanId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"performerTargetId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"nation": {
											"type": "string",
											"enum": [
												"england",
												"wales",
												"scotland",
												"northern_ireland"
											]
										},
										"formVersion": {
											"type": "string"
										},
										"band": {
											"type": "string",
											"enum": [
												"1",
												"3",
												"2a",
												"2b",
												"2c",
												"urgent",
												"reg11",
												"fluoride_varnish",
												"ortho_assess",
												"ortho_treat",
												"free_repair"
											]
										},
										"bandRateId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientChargeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"acceptedOn": {
											"type": "string"
										},
										"completedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleKind": {
											"type": "string"
										},
										"exemptionEvidenceSnapshot": {
											"type": "boolean"
										},
										"continuationOfCourseId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recallIntervalMonths": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"highestBpeSextant": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"0",
														"1",
														"2",
														"3",
														"4",
														"X"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"untreatedDecayedTeeth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"bestPracticePrevention": {
											"type": "boolean"
										},
										"aerosolAppointments": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"dmf": {},
										"referralToOtherProvider": {
											"type": "boolean"
										},
										"sedation": {
											"type": "boolean"
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedBySubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"courseId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"datasetRuleId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"nation": {
														"type": "string",
														"enum": [
															"england",
															"wales",
															"scotland",
															"northern_ireland"
														]
													},
													"formVersion": {
														"type": "string"
													},
													"ruleKind": {
														"type": "string"
													},
													"quantity": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"procedureId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"code": {
														"type": "string"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"courseId",
													"datasetRuleId",
													"organizationId",
													"nation",
													"formVersion",
													"ruleKind",
													"quantity",
													"tooth",
													"patientId",
													"procedureId",
													"createdAt",
													"updatedAt",
													"code",
													"name"
												],
												"additionalProperties": false
											}
										},
										"claims": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaim"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"treatmentPlanId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"performerTargetId",
										"performerPractitionerId",
										"performerCredentialRevisionId",
										"nation",
										"formVersion",
										"band",
										"bandRateId",
										"patientChargeCents",
										"currency",
										"acceptedOn",
										"completedOn",
										"exemptionRuleId",
										"exemptionRuleKind",
										"exemptionEvidenceSnapshot",
										"continuationOfCourseId",
										"recallIntervalMonths",
										"highestBpeSextant",
										"untreatedDecayedTeeth",
										"bestPracticePrevention",
										"aerosolAppointments",
										"dmf",
										"referralToOtherProvider",
										"sedation",
										"notes",
										"sealedAt",
										"sealedBySubmissionId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"items",
										"claims"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/courses/candidates": {
			"get": {
				"summary": "What a new NHS course can be built from",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"plans": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"name": {
														"type": "string"
													},
													"acceptedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"locationId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"practitionerId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"bands": {
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"1",
																"3",
																"2a",
																"2b",
																"2c",
																"urgent",
																"reg11",
																"fluoride_varnish",
																"ortho_assess",
																"ortho_treat",
																"free_repair"
															]
														}
													},
													"performerTargetIds": {
														"type": "array",
														"items": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														}
													}
												},
												"required": [
													"id",
													"name",
													"acceptedAt",
													"locationId",
													"practitionerId",
													"bands",
													"performerTargetIds"
												],
												"additionalProperties": false
											}
										},
										"contracts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"contractNumber": {
														"type": "string"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"performers": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"targetId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"practitionerId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"practitionerName": {
																	"type": "string"
																},
																"performerNumber": {
																	"type": "string"
																}
															},
															"required": [
																"targetId",
																"practitionerId",
																"practitionerName",
																"performerNumber"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"contractNumber",
													"locationId",
													"performers"
												],
												"additionalProperties": false
											}
										},
										"exemptionRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionEvidenceSeen": {
											"type": "boolean"
										},
										"exemptionExpiresOn": {
											"anyOf": [
												{
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"plans",
										"contracts",
										"exemptionRuleId",
										"exemptionEvidenceSeen",
										"exemptionExpiresOn"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/courses/{id}": {
			"patch": {
				"summary": "Update an open course's FP17 fields",
				"tags": [
					"NHS"
				],
				"description": "A sealed course accepts only its notes (409 COURSE_SEALED); a correction is a continuation course.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"completedOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"continuationOfCourseId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"recallIntervalMonths": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 24
											},
											{
												"type": "null"
											}
										]
									},
									"untreatedDecayedTeeth": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 32
											},
											{
												"type": "null"
											}
										]
									},
									"bestPracticePrevention": {
										"type": "boolean"
									},
									"aerosolAppointments": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"referralToOtherProvider": {
										"type": "boolean"
									},
									"sedation": {
										"type": "boolean"
									},
									"notes": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"treatmentPlanId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"performerTargetId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"nation": {
											"type": "string",
											"enum": [
												"england",
												"wales",
												"scotland",
												"northern_ireland"
											]
										},
										"formVersion": {
											"type": "string"
										},
										"band": {
											"type": "string",
											"enum": [
												"1",
												"3",
												"2a",
												"2b",
												"2c",
												"urgent",
												"reg11",
												"fluoride_varnish",
												"ortho_assess",
												"ortho_treat",
												"free_repair"
											]
										},
										"bandRateId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientChargeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"acceptedOn": {
											"type": "string"
										},
										"completedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleKind": {
											"type": "string"
										},
										"exemptionEvidenceSnapshot": {
											"type": "boolean"
										},
										"continuationOfCourseId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recallIntervalMonths": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"highestBpeSextant": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"0",
														"1",
														"2",
														"3",
														"4",
														"X"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"untreatedDecayedTeeth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"bestPracticePrevention": {
											"type": "boolean"
										},
										"aerosolAppointments": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"dmf": {},
										"referralToOtherProvider": {
											"type": "boolean"
										},
										"sedation": {
											"type": "boolean"
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedBySubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"courseId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"datasetRuleId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"nation": {
														"type": "string",
														"enum": [
															"england",
															"wales",
															"scotland",
															"northern_ireland"
														]
													},
													"formVersion": {
														"type": "string"
													},
													"ruleKind": {
														"type": "string"
													},
													"quantity": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"procedureId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"code": {
														"type": "string"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"courseId",
													"datasetRuleId",
													"organizationId",
													"nation",
													"formVersion",
													"ruleKind",
													"quantity",
													"tooth",
													"patientId",
													"procedureId",
													"createdAt",
													"updatedAt",
													"code",
													"name"
												],
												"additionalProperties": false
											}
										},
										"claims": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaim"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"treatmentPlanId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"performerTargetId",
										"performerPractitionerId",
										"performerCredentialRevisionId",
										"nation",
										"formVersion",
										"band",
										"bandRateId",
										"patientChargeCents",
										"currency",
										"acceptedOn",
										"completedOn",
										"exemptionRuleId",
										"exemptionRuleKind",
										"exemptionEvidenceSnapshot",
										"continuationOfCourseId",
										"recallIntervalMonths",
										"highestBpeSextant",
										"untreatedDecayedTeeth",
										"bestPracticePrevention",
										"aerosolAppointments",
										"dmf",
										"referralToOtherProvider",
										"sedation",
										"notes",
										"sealedAt",
										"sealedBySubmissionId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"items",
										"claims"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete an open course that has no claim",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content",
						"content": {
							"application/json": {
								"schema": {
									"type": "null"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/courses/{id}/items": {
			"put": {
				"summary": "Set a dataset item on an open course",
				"tags": [
					"NHS"
				],
				"description": "Creates or replaces the item for that dataset rule. The rule must be a clinical item allowed on the course's band and in force on the acceptance date (409 ITEM_RULE); a sealed course's items are frozen (409 COURSE_SEALED).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"datasetRuleId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"quantity": {
										"default": 1,
										"type": "integer",
										"minimum": 1,
										"maximum": 99
									},
									"tooth": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"procedureId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"datasetRuleId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"treatmentPlanId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"performerTargetId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"nation": {
											"type": "string",
											"enum": [
												"england",
												"wales",
												"scotland",
												"northern_ireland"
											]
										},
										"formVersion": {
											"type": "string"
										},
										"band": {
											"type": "string",
											"enum": [
												"1",
												"3",
												"2a",
												"2b",
												"2c",
												"urgent",
												"reg11",
												"fluoride_varnish",
												"ortho_assess",
												"ortho_treat",
												"free_repair"
											]
										},
										"bandRateId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientChargeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"acceptedOn": {
											"type": "string"
										},
										"completedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleKind": {
											"type": "string"
										},
										"exemptionEvidenceSnapshot": {
											"type": "boolean"
										},
										"continuationOfCourseId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recallIntervalMonths": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"highestBpeSextant": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"0",
														"1",
														"2",
														"3",
														"4",
														"X"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"untreatedDecayedTeeth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"bestPracticePrevention": {
											"type": "boolean"
										},
										"aerosolAppointments": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"dmf": {},
										"referralToOtherProvider": {
											"type": "boolean"
										},
										"sedation": {
											"type": "boolean"
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedBySubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"courseId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"datasetRuleId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"nation": {
														"type": "string",
														"enum": [
															"england",
															"wales",
															"scotland",
															"northern_ireland"
														]
													},
													"formVersion": {
														"type": "string"
													},
													"ruleKind": {
														"type": "string"
													},
													"quantity": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"procedureId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"code": {
														"type": "string"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"courseId",
													"datasetRuleId",
													"organizationId",
													"nation",
													"formVersion",
													"ruleKind",
													"quantity",
													"tooth",
													"patientId",
													"procedureId",
													"createdAt",
													"updatedAt",
													"code",
													"name"
												],
												"additionalProperties": false
											}
										},
										"claims": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaim"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"treatmentPlanId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"performerTargetId",
										"performerPractitionerId",
										"performerCredentialRevisionId",
										"nation",
										"formVersion",
										"band",
										"bandRateId",
										"patientChargeCents",
										"currency",
										"acceptedOn",
										"completedOn",
										"exemptionRuleId",
										"exemptionRuleKind",
										"exemptionEvidenceSnapshot",
										"continuationOfCourseId",
										"recallIntervalMonths",
										"highestBpeSextant",
										"untreatedDecayedTeeth",
										"bestPracticePrevention",
										"aerosolAppointments",
										"dmf",
										"referralToOtherProvider",
										"sedation",
										"notes",
										"sealedAt",
										"sealedBySubmissionId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"items",
										"claims"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/courses/{id}/items/{datasetRuleId}": {
			"delete": {
				"summary": "Remove a dataset item from an open course",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "datasetRuleId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"treatmentPlanId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"performerTargetId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"performerCredentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"nation": {
											"type": "string",
											"enum": [
												"england",
												"wales",
												"scotland",
												"northern_ireland"
											]
										},
										"formVersion": {
											"type": "string"
										},
										"band": {
											"type": "string",
											"enum": [
												"1",
												"3",
												"2a",
												"2b",
												"2c",
												"urgent",
												"reg11",
												"fluoride_varnish",
												"ortho_assess",
												"ortho_treat",
												"free_repair"
											]
										},
										"bandRateId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientChargeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"acceptedOn": {
											"type": "string"
										},
										"completedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"exemptionRuleKind": {
											"type": "string"
										},
										"exemptionEvidenceSnapshot": {
											"type": "boolean"
										},
										"continuationOfCourseId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"recallIntervalMonths": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"highestBpeSextant": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"0",
														"1",
														"2",
														"3",
														"4",
														"X"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"untreatedDecayedTeeth": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"bestPracticePrevention": {
											"type": "boolean"
										},
										"aerosolAppointments": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"dmf": {},
										"referralToOtherProvider": {
											"type": "boolean"
										},
										"sedation": {
											"type": "boolean"
										},
										"notes": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"sealedBySubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"courseId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"datasetRuleId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"nation": {
														"type": "string",
														"enum": [
															"england",
															"wales",
															"scotland",
															"northern_ireland"
														]
													},
													"formVersion": {
														"type": "string"
													},
													"ruleKind": {
														"type": "string"
													},
													"quantity": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"procedureId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"code": {
														"type": "string"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"courseId",
													"datasetRuleId",
													"organizationId",
													"nation",
													"formVersion",
													"ruleKind",
													"quantity",
													"tooth",
													"patientId",
													"procedureId",
													"createdAt",
													"updatedAt",
													"code",
													"name"
												],
												"additionalProperties": false
											}
										},
										"claims": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaim"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"treatmentPlanId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"performerTargetId",
										"performerPractitionerId",
										"performerCredentialRevisionId",
										"nation",
										"formVersion",
										"band",
										"bandRateId",
										"patientChargeCents",
										"currency",
										"acceptedOn",
										"completedOn",
										"exemptionRuleId",
										"exemptionRuleKind",
										"exemptionEvidenceSnapshot",
										"continuationOfCourseId",
										"recallIntervalMonths",
										"highestBpeSextant",
										"untreatedDecayedTeeth",
										"bestPracticePrevention",
										"aerosolAppointments",
										"dmf",
										"referralToOtherProvider",
										"sedation",
										"notes",
										"sealedAt",
										"sealedBySubmissionId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"items",
										"claims"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/claims/{id}": {
			"get": {
				"summary": "Read an NHS claim with its history and submissions",
				"tags": [
					"NHS"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"courseId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"fp17"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"new",
												"queued",
												"submitted",
												"received",
												"completed",
												"queried",
												"error",
												"invalid",
												"withdrawn"
											]
										},
										"nhsbsaReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expectedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"awardedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"patientChargeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"providerRemunerationCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"transport": {
											"type": "string",
											"enum": [
												"manual_compass"
											]
										},
										"currentSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"responseCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"statusComments": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsUpdatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"claimId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"withdraw",
															"query"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"formVersion": {
														"type": "string"
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"transport": {
																	"type": "string",
																	"enum": [
																		"manual_compass"
																	]
																},
																"bundleRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/NhsClaimDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"transport",
																"bundleRef",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"claimId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"formVersion",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"courseId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"nhsbsaReference",
										"expectedUda",
										"awardedUda",
										"patientChargeCents",
										"providerRemunerationCents",
										"currency",
										"transport",
										"currentSubmissionId",
										"responseCodes",
										"statusComments",
										"nhsUpdatedAt",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"events",
										"submissions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/courses/{id}/claim": {
			"post": {
				"summary": "Open the FP17 claim for a course",
				"tags": [
					"NHS"
				],
				"description": "One live claim per course; a withdrawn claim may be replaced (409 CLAIM_EXISTS otherwise). The expected UDA comes from the course's rate.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"courseId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"fp17"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"new",
												"queued",
												"submitted",
												"received",
												"completed",
												"queried",
												"error",
												"invalid",
												"withdrawn"
											]
										},
										"nhsbsaReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expectedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"awardedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"patientChargeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"providerRemunerationCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"transport": {
											"type": "string",
											"enum": [
												"manual_compass"
											]
										},
										"currentSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"responseCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"statusComments": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsUpdatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"claimId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"withdraw",
															"query"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"formVersion": {
														"type": "string"
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"transport": {
																	"type": "string",
																	"enum": [
																		"manual_compass"
																	]
																},
																"bundleRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/NhsClaimDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"transport",
																"bundleRef",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"claimId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"formVersion",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"courseId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"nhsbsaReference",
										"expectedUda",
										"awardedUda",
										"patientChargeCents",
										"providerRemunerationCents",
										"currency",
										"transport",
										"currentSubmissionId",
										"responseCodes",
										"statusComments",
										"nhsUpdatedAt",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"events",
										"submissions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/claims/{id}/queue": {
			"post": {
				"summary": "Queue the FP17 for submission",
				"tags": [
					"NHS"
				],
				"description": "Builds the FP17 payload, records it as the next submission generation (which seals the course) and moves the claim to queued, from new or after an error or invalid outcome.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"courseId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"fp17"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"new",
												"queued",
												"submitted",
												"received",
												"completed",
												"queried",
												"error",
												"invalid",
												"withdrawn"
											]
										},
										"nhsbsaReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expectedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"awardedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"patientChargeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"providerRemunerationCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"transport": {
											"type": "string",
											"enum": [
												"manual_compass"
											]
										},
										"currentSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"responseCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"statusComments": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsUpdatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"claimId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"withdraw",
															"query"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"formVersion": {
														"type": "string"
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"transport": {
																	"type": "string",
																	"enum": [
																		"manual_compass"
																	]
																},
																"bundleRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/NhsClaimDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"transport",
																"bundleRef",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"claimId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"formVersion",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"courseId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"nhsbsaReference",
										"expectedUda",
										"awardedUda",
										"patientChargeCents",
										"providerRemunerationCents",
										"currency",
										"transport",
										"currentSubmissionId",
										"responseCodes",
										"statusComments",
										"nhsUpdatedAt",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"events",
										"submissions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/claims/{id}/submitted": {
			"post": {
				"summary": "Record that the FP17 was entered in Compass",
				"tags": [
					"NHS"
				],
				"description": "The manual Compass transport: one delivery attempt is claimed and sent with the reference typed in, and the claim moves to submitted.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"compassReference": {
										"type": "string",
										"minLength": 1,
										"maxLength": 60
									}
								},
								"required": [
									"compassReference"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"courseId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"fp17"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"new",
												"queued",
												"submitted",
												"received",
												"completed",
												"queried",
												"error",
												"invalid",
												"withdrawn"
											]
										},
										"nhsbsaReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expectedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"awardedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"patientChargeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"providerRemunerationCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"transport": {
											"type": "string",
											"enum": [
												"manual_compass"
											]
										},
										"currentSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"responseCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"statusComments": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsUpdatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"claimId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"withdraw",
															"query"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"formVersion": {
														"type": "string"
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"transport": {
																	"type": "string",
																	"enum": [
																		"manual_compass"
																	]
																},
																"bundleRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/NhsClaimDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"transport",
																"bundleRef",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"claimId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"formVersion",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"courseId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"nhsbsaReference",
										"expectedUda",
										"awardedUda",
										"patientChargeCents",
										"providerRemunerationCents",
										"currency",
										"transport",
										"currentSubmissionId",
										"responseCodes",
										"statusComments",
										"nhsUpdatedAt",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"events",
										"submissions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/nhs/{patientId}/claims/{id}/events": {
			"post": {
				"summary": "Record an NHS claim outcome by hand",
				"tags": [
					"NHS"
				],
				"description": "Moves the claim along its state machine from what Compass or the schedule shows: received, completed, queried, error, invalid or withdrawn. The event is the record; the claim's status and awards follow from it, and the current delivery settles as acknowledged or rejected.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"toStatus": {
										"type": "string",
										"enum": [
											"new",
											"queued",
											"submitted",
											"received",
											"completed",
											"queried",
											"error",
											"invalid",
											"withdrawn"
										]
									},
									"reason": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"amounts": {
										"type": "object",
										"properties": {
											"awardedUda": {
												"type": "string",
												"pattern": "^\\d{1,8}(\\.\\d{1,2})?$"
											},
											"patientChargeCents": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"providerRemunerationCents": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"nhsbsaReference": {
												"type": "string",
												"maxLength": 60
											},
											"responseCodes": {
												"maxItems": 20,
												"type": "array",
												"items": {
													"type": "string",
													"maxLength": 20
												}
											},
											"statusComments": {
												"type": "string",
												"maxLength": 4000
											}
										}
									}
								},
								"required": [
									"toStatus"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"courseId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"contractId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"fp17"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"new",
												"queued",
												"submitted",
												"received",
												"completed",
												"queried",
												"error",
												"invalid",
												"withdrawn"
											]
										},
										"nhsbsaReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expectedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"awardedUda": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"patientChargeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"providerRemunerationCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"transport": {
											"type": "string",
											"enum": [
												"manual_compass"
											]
										},
										"currentSubmissionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"responseCodes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"statusComments": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"nhsUpdatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastEventId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"events": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/NhsClaimEvent"
											}
										},
										"submissions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"claimId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"generation": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"kind": {
														"type": "string",
														"enum": [
															"submit",
															"withdraw",
															"query"
														]
													},
													"attemptCount": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"lastAttemptAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"deadlineAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"parkedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"payload": {},
													"payloadObjectKey": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"payloadDigest": {
														"type": "string"
													},
													"idempotencyKey": {
														"type": "string"
													},
													"jurisdiction": {
														"type": "string",
														"enum": [
															"unsupported",
															"gb_england",
															"gb_wales",
															"gb_scotland",
															"gb_northern_ireland",
															"us_al",
															"us_ak",
															"us_az",
															"us_ar",
															"us_ca",
															"us_co",
															"us_ct",
															"us_de",
															"us_dc",
															"us_fl",
															"us_ga",
															"us_hi",
															"us_id",
															"us_il",
															"us_in",
															"us_ia",
															"us_ks",
															"us_ky",
															"us_la",
															"us_me",
															"us_md",
															"us_ma",
															"us_mi",
															"us_mn",
															"us_ms",
															"us_mo",
															"us_mt",
															"us_ne",
															"us_nv",
															"us_nh",
															"us_nj",
															"us_nm",
															"us_ny",
															"us_nc",
															"us_nd",
															"us_oh",
															"us_ok",
															"us_or",
															"us_pa",
															"us_ri",
															"us_sc",
															"us_sd",
															"us_tn",
															"us_tx",
															"us_ut",
															"us_vt",
															"us_va",
															"us_wa",
															"us_wv",
															"us_wi",
															"us_wy",
															"it"
														]
													},
													"ruleVersion": {
														"type": "string"
													},
													"formVersion": {
														"type": "string"
													},
													"createdById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deliveries": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"organizationId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
																	"description": "Canonical lowercase UUID organization identifier"
																},
																"submissionId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"claimId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"attempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"consumedAttempt": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																},
																"state": {
																	"type": "string",
																	"enum": [
																		"claimed",
																		"sent",
																		"acked",
																		"rejected",
																		"parked"
																	]
																},
																"leaseToken": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"leaseExpiresAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"deadlineAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"transport": {
																	"type": "string",
																	"enum": [
																		"manual_compass"
																	]
																},
																"bundleRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"sentAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"providerRef": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseIngressReceiptId": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"responseCodes": {
																	"type": "array",
																	"items": {
																		"type": "string"
																	}
																},
																"parkedAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"parkedReason": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"lastError": {
																	"anyOf": [
																		{
																			"type": "string"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"createdAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"updatedAt": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																"responses": {
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/NhsClaimDeliveryResponse"
																	}
																}
															},
															"required": [
																"id",
																"organizationId",
																"submissionId",
																"claimId",
																"attempt",
																"consumedAttempt",
																"state",
																"leaseToken",
																"leaseExpiresAt",
																"deadlineAt",
																"transport",
																"bundleRef",
																"sentAt",
																"providerRef",
																"responseIngressReceiptId",
																"responseCodes",
																"parkedAt",
																"parkedReason",
																"lastError",
																"createdAt",
																"updatedAt",
																"responses"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"organizationId",
													"claimId",
													"generation",
													"kind",
													"attemptCount",
													"lastAttemptAt",
													"deadlineAt",
													"parkedAt",
													"payload",
													"payloadObjectKey",
													"payloadDigest",
													"idempotencyKey",
													"jurisdiction",
													"ruleVersion",
													"formVersion",
													"createdById",
													"createdAt",
													"updatedAt",
													"deliveries"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"courseId",
										"patientId",
										"contractId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"status",
										"nhsbsaReference",
										"expectedUda",
										"awardedUda",
										"patientChargeCents",
										"providerRemunerationCents",
										"currency",
										"transport",
										"currentSubmissionId",
										"responseCodes",
										"statusComments",
										"nhsUpdatedAt",
										"lastEventId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"events",
										"submissions"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/professional-contacts": {
			"get": {
				"summary": "List Professional contacts",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ProfessionalContact"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a professional contact",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"referrer",
											"lab",
											"specialist",
											"gp",
											"other"
										]
									},
									"displayName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"practiceName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"registrationRef": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 60
											},
											{
												"type": "null"
											}
										]
									},
									"email": {
										"anyOf": [
											{
												"type": "string",
												"format": "email",
												"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"phone": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"province": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"country": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 2,
												"maxLength": 2
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"displayName"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"referrer",
												"lab",
												"specialist",
												"gp",
												"other"
											]
										},
										"displayName": {
											"type": "string"
										},
										"practiceName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"registrationRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"email": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"province": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"country": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"displayName",
										"practiceName",
										"registrationRef",
										"email",
										"phone",
										"addressLine1",
										"addressLine2",
										"city",
										"province",
										"postalCode",
										"country",
										"note",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/professional-contacts/{id}": {
			"patch": {
				"summary": "Update a professional contact",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"referrer",
											"lab",
											"specialist",
											"gp",
											"other"
										]
									},
									"displayName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"practiceName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"registrationRef": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 60
											},
											{
												"type": "null"
											}
										]
									},
									"email": {
										"anyOf": [
											{
												"type": "string",
												"format": "email",
												"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"phone": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine2": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"city": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"province": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"country": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 2,
												"maxLength": 2
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"referrer",
												"lab",
												"specialist",
												"gp",
												"other"
											]
										},
										"displayName": {
											"type": "string"
										},
										"practiceName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"registrationRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"email": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"province": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"country": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"displayName",
										"practiceName",
										"registrationRef",
										"email",
										"phone",
										"addressLine1",
										"addressLine2",
										"city",
										"province",
										"postalCode",
										"country",
										"note",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/professional-contacts/{id}/archive": {
			"post": {
				"summary": "Archive a professional contact",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"referrer",
												"lab",
												"specialist",
												"gp",
												"other"
											]
										},
										"displayName": {
											"type": "string"
										},
										"practiceName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"registrationRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"email": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"province": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"country": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"displayName",
										"practiceName",
										"registrationRef",
										"email",
										"phone",
										"addressLine1",
										"addressLine2",
										"city",
										"province",
										"postalCode",
										"country",
										"note",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/professional-contacts/{id}/restore": {
			"post": {
				"summary": "Restore an archived professional contact",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"referrer",
												"lab",
												"specialist",
												"gp",
												"other"
											]
										},
										"displayName": {
											"type": "string"
										},
										"practiceName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"registrationRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"email": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"phone": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine1": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"addressLine2": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"city": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"province": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"postalCode": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"country": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"displayName",
										"practiceName",
										"registrationRef",
										"email",
										"phone",
										"addressLine1",
										"addressLine2",
										"city",
										"province",
										"postalCode",
										"country",
										"note",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/prescriptions/{patientId}": {
			"get": {
				"summary": "List a patient's prescriptions",
				"tags": [
					"Prescriptions"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PrescriptionView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Draft a prescription",
				"tags": [
					"Prescriptions"
				],
				"description": "A draft with its items, prescribed by the signed-in practitioner at the location. The kind must be one the location's jurisdiction issues (409 KIND_JURISDICTION); a US controlled substance is refused until electronic prescribing exists (409 ROUTE_ELECTRONIC_REQUIRED).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"kind": {
										"type": "string",
										"enum": [
											"nhs_fp10d",
											"private",
											"us_state"
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"items": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"drugName": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"standardId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"form": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 80
														},
														{
															"type": "null"
														}
													]
												},
												"strength": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 80
														},
														{
															"type": "null"
														}
													]
												},
												"dose": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"quantity": {
													"type": "string",
													"minLength": 1,
													"maxLength": 80
												},
												"directions": {
													"type": "string",
													"minLength": 1,
													"maxLength": 500
												},
												"refills": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 0,
															"maximum": 99
														},
														{
															"type": "null"
														}
													]
												},
												"controlledSubstance": {
													"default": false,
													"type": "boolean"
												}
											},
											"required": [
												"drugName",
												"dose",
												"quantity",
												"directions"
											]
										}
									}
								},
								"required": [
									"locationId",
									"kind",
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"prescriberPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"nhs_fp10d",
												"private",
												"us_state"
											]
										},
										"route": {
											"type": "string",
											"enum": [
												"print",
												"electronic",
												"print_and_electronic"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"issued",
												"void"
											]
										},
										"issuedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"prescriberName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clinicalDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PrescriptionItem"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"prescriberPractitionerId",
										"credentialRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"route",
										"status",
										"issuedAt",
										"reauthenticatedAt",
										"documentId",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"prescriberName",
										"clinicalDocumentId",
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/prescriptions/{patientId}/{id}": {
			"patch": {
				"summary": "Edit a draft prescription",
				"tags": [
					"Prescriptions"
				],
				"description": "Items are replaced whole; an issued prescription is frozen (409).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"nhs_fp10d",
											"private",
											"us_state"
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"items": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"drugName": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"standardId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"form": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 80
														},
														{
															"type": "null"
														}
													]
												},
												"strength": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 80
														},
														{
															"type": "null"
														}
													]
												},
												"dose": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"quantity": {
													"type": "string",
													"minLength": 1,
													"maxLength": 80
												},
												"directions": {
													"type": "string",
													"minLength": 1,
													"maxLength": 500
												},
												"refills": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": 0,
															"maximum": 99
														},
														{
															"type": "null"
														}
													]
												},
												"controlledSubstance": {
													"default": false,
													"type": "boolean"
												}
											},
											"required": [
												"drugName",
												"dose",
												"quantity",
												"directions"
											]
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"prescriberPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"nhs_fp10d",
												"private",
												"us_state"
											]
										},
										"route": {
											"type": "string",
											"enum": [
												"print",
												"electronic",
												"print_and_electronic"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"issued",
												"void"
											]
										},
										"issuedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"prescriberName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clinicalDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PrescriptionItem"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"prescriberPractitionerId",
										"credentialRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"route",
										"status",
										"issuedAt",
										"reauthenticatedAt",
										"documentId",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"prescriberName",
										"clinicalDocumentId",
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Discard a draft prescription",
				"tags": [
					"Prescriptions"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"204": {
						"description": "No Content",
						"content": {
							"application/json": {
								"schema": {
									"type": "null"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/prescriptions/{patientId}/{id}/issue": {
			"post": {
				"summary": "Issue and print a prescription",
				"tags": [
					"Prescriptions"
				],
				"description": "The sign_prescription act: the signed-in prescriber re-authenticates (the x-smileline-act-evidence header), the script is rendered to a PDF filed on the patient, and the prescription is issued with its items frozen.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"prescriberPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"nhs_fp10d",
												"private",
												"us_state"
											]
										},
										"route": {
											"type": "string",
											"enum": [
												"print",
												"electronic",
												"print_and_electronic"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"issued",
												"void"
											]
										},
										"issuedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"prescriberName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clinicalDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PrescriptionItem"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"prescriberPractitionerId",
										"credentialRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"route",
										"status",
										"issuedAt",
										"reauthenticatedAt",
										"documentId",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"prescriberName",
										"clinicalDocumentId",
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/prescriptions/{patientId}/{id}/void": {
			"post": {
				"summary": "Void an issued prescription",
				"tags": [
					"Prescriptions"
				],
				"description": "A fresh act by a prescriber; the void triple is sealed on the row.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"prescriberPractitionerId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"credentialRevisionId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"jurisdiction": {
											"type": "string",
											"enum": [
												"unsupported",
												"gb_england",
												"gb_wales",
												"gb_scotland",
												"gb_northern_ireland",
												"us_al",
												"us_ak",
												"us_az",
												"us_ar",
												"us_ca",
												"us_co",
												"us_ct",
												"us_de",
												"us_dc",
												"us_fl",
												"us_ga",
												"us_hi",
												"us_id",
												"us_il",
												"us_in",
												"us_ia",
												"us_ks",
												"us_ky",
												"us_la",
												"us_me",
												"us_md",
												"us_ma",
												"us_mi",
												"us_mn",
												"us_ms",
												"us_mo",
												"us_mt",
												"us_ne",
												"us_nv",
												"us_nh",
												"us_nj",
												"us_nm",
												"us_ny",
												"us_nc",
												"us_nd",
												"us_oh",
												"us_ok",
												"us_or",
												"us_pa",
												"us_ri",
												"us_sc",
												"us_sd",
												"us_tn",
												"us_tx",
												"us_ut",
												"us_vt",
												"us_va",
												"us_wa",
												"us_wv",
												"us_wi",
												"us_wy",
												"it"
											]
										},
										"ruleVersion": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"nhs_fp10d",
												"private",
												"us_state"
											]
										},
										"route": {
											"type": "string",
											"enum": [
												"print",
												"electronic",
												"print_and_electronic"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"issued",
												"void"
											]
										},
										"issuedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"voidedByPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidCredentialRevisionId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"voidReauthenticatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"prescriberName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"clinicalDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PrescriptionItem"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"prescriberPractitionerId",
										"credentialRevisionId",
										"locationId",
										"jurisdiction",
										"ruleVersion",
										"kind",
										"route",
										"status",
										"issuedAt",
										"reauthenticatedAt",
										"documentId",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"prescriberName",
										"clinicalDocumentId",
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lab-cases/{patientId}": {
			"get": {
				"summary": "List a patient's lab cases",
				"tags": [
					"Lab cases"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LabCaseView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Open a lab case",
				"tags": [
					"Lab cases"
				],
				"description": "The lab is a professional contact of kind lab (409 CONTACT_KIND). A re-send of a returned case names the case it replaces.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentPlanId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"dueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"shade": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"enclosures": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 80
										}
									},
									"labReference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 80
											},
											{
												"type": "null"
											}
										]
									},
									"labFeeCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"labContactId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"resendOfLabCaseId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"labContactId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"labContactId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"sent",
												"received",
												"fitted",
												"returned",
												"cancelled"
											]
										},
										"sentOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"receivedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fittedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"returnedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"shade": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"enclosures": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"labReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"labFeeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"labSlipDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resendOfLabCaseId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"labName": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureId",
										"treatmentPlanId",
										"labContactId",
										"appointmentId",
										"status",
										"sentOn",
										"dueOn",
										"receivedOn",
										"fittedOn",
										"returnedOn",
										"shade",
										"enclosures",
										"labReference",
										"labFeeCents",
										"currency",
										"note",
										"labSlipDocumentId",
										"resendOfLabCaseId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"labName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lab-cases/{patientId}/{id}": {
			"patch": {
				"summary": "Edit a lab case's details",
				"tags": [
					"Lab cases"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"procedureId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentPlanId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"dueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"shade": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"enclosures": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 80
										}
									},
									"labReference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 80
											},
											{
												"type": "null"
											}
										]
									},
									"labFeeCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"labContactId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"sent",
												"received",
												"fitted",
												"returned",
												"cancelled"
											]
										},
										"sentOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"receivedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fittedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"returnedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"shade": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"enclosures": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"labReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"labFeeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"labSlipDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resendOfLabCaseId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"labName": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureId",
										"treatmentPlanId",
										"labContactId",
										"appointmentId",
										"status",
										"sentOn",
										"dueOn",
										"receivedOn",
										"fittedOn",
										"returnedOn",
										"shade",
										"enclosures",
										"labReference",
										"labFeeCents",
										"currency",
										"note",
										"labSlipDocumentId",
										"resendOfLabCaseId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"labName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lab-cases/{patientId}/{id}/status": {
			"post": {
				"summary": "Move a lab case along",
				"tags": [
					"Lab cases"
				],
				"description": "created → sent → received → fitted; received → returned (a re-send is a new case); anything not fitted → cancelled. Each state stamps its date (today unless given).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"created",
											"sent",
											"received",
											"fitted",
											"returned",
											"cancelled"
										]
									},
									"on": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"labContactId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"appointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"created",
												"sent",
												"received",
												"fitted",
												"returned",
												"cancelled"
											]
										},
										"sentOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"receivedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fittedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"returnedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"shade": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"enclosures": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"labReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"labFeeCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"labSlipDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"resendOfLabCaseId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"labName": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureId",
										"treatmentPlanId",
										"labContactId",
										"appointmentId",
										"status",
										"sentOn",
										"dueOn",
										"receivedOn",
										"fittedOn",
										"returnedOn",
										"shade",
										"enclosures",
										"labReference",
										"labFeeCents",
										"currency",
										"note",
										"labSlipDocumentId",
										"resendOfLabCaseId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"labName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/clinical-referrals/{patientId}": {
			"get": {
				"summary": "List a patient's clinical referrals",
				"tags": [
					"Clinical referrals"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ClinicalReferralView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Draft a clinical referral",
				"tags": [
					"Clinical referrals"
				],
				"description": "An outbound referral names the practitioner or professional contact it goes to; an inbound one where it came from.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"fromPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"toPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"toContactId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"fromContactId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"procedureId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 4000
									},
									"urgency": {
										"type": "string",
										"enum": [
											"routine",
											"urgent",
											"two_week_wait"
										]
									},
									"nhsUrn": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"letterDocumentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"direction": {
										"type": "string",
										"enum": [
											"outbound",
											"inbound"
										]
									},
									"kind": {
										"type": "string",
										"enum": [
											"private_in_group",
											"private_in_house",
											"private_external",
											"nhs_external"
										]
									}
								},
								"required": [
									"reason",
									"direction",
									"kind"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"direction": {
											"type": "string",
											"enum": [
												"outbound",
												"inbound"
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"private_in_group",
												"private_in_house",
												"private_external",
												"nhs_external"
											]
										},
										"fromPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"toPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"toContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"fromContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reason": {
											"type": "string"
										},
										"urgency": {
											"type": "string",
											"enum": [
												"routine",
												"urgent",
												"two_week_wait"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitted",
												"accepted",
												"booked",
												"completed",
												"rejected",
												"cancelled"
											]
										},
										"nhsUrn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"letterDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"submittedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"outcomeNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"toName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fromName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"direction",
										"kind",
										"fromPractitionerId",
										"toPractitionerId",
										"toContactId",
										"fromContactId",
										"procedureId",
										"reason",
										"urgency",
										"status",
										"nhsUrn",
										"letterDocumentId",
										"submittedAt",
										"completedAt",
										"outcomeNote",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"toName",
										"fromName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/clinical-referrals/{patientId}/{id}": {
			"patch": {
				"summary": "Edit a referral",
				"tags": [
					"Clinical referrals"
				],
				"description": "The letter is immutable once submitted (409).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"fromPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"toPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"toContactId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"fromContactId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"procedureId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 4000
									},
									"urgency": {
										"type": "string",
										"enum": [
											"routine",
											"urgent",
											"two_week_wait"
										]
									},
									"nhsUrn": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"letterDocumentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"direction": {
											"type": "string",
											"enum": [
												"outbound",
												"inbound"
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"private_in_group",
												"private_in_house",
												"private_external",
												"nhs_external"
											]
										},
										"fromPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"toPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"toContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"fromContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reason": {
											"type": "string"
										},
										"urgency": {
											"type": "string",
											"enum": [
												"routine",
												"urgent",
												"two_week_wait"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitted",
												"accepted",
												"booked",
												"completed",
												"rejected",
												"cancelled"
											]
										},
										"nhsUrn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"letterDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"submittedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"outcomeNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"toName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fromName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"direction",
										"kind",
										"fromPractitionerId",
										"toPractitionerId",
										"toContactId",
										"fromContactId",
										"procedureId",
										"reason",
										"urgency",
										"status",
										"nhsUrn",
										"letterDocumentId",
										"submittedAt",
										"completedAt",
										"outcomeNote",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"toName",
										"fromName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/clinical-referrals/{patientId}/{id}/status": {
			"post": {
				"summary": "Move a referral along",
				"tags": [
					"Clinical referrals"
				],
				"description": "draft → submitted → accepted → booked → completed; submitted or accepted → rejected; anything not completed → cancelled. Completing records the outcome note.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"draft",
											"submitted",
											"accepted",
											"booked",
											"completed",
											"rejected",
											"cancelled"
										]
									},
									"outcomeNote": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"direction": {
											"type": "string",
											"enum": [
												"outbound",
												"inbound"
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"private_in_group",
												"private_in_house",
												"private_external",
												"nhs_external"
											]
										},
										"fromPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"toPractitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"toContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"fromContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"procedureId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reason": {
											"type": "string"
										},
										"urgency": {
											"type": "string",
											"enum": [
												"routine",
												"urgent",
												"two_week_wait"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"submitted",
												"accepted",
												"booked",
												"completed",
												"rejected",
												"cancelled"
											]
										},
										"nhsUrn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"letterDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"submittedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"outcomeNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"toName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fromName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"direction",
										"kind",
										"fromPractitionerId",
										"toPractitionerId",
										"toContactId",
										"fromContactId",
										"procedureId",
										"reason",
										"urgency",
										"status",
										"nhsUrn",
										"letterDocumentId",
										"submittedAt",
										"completedAt",
										"outcomeNote",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"toName",
										"fromName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/letter-templates": {
			"get": {
				"summary": "List Letter templates",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/LetterTemplate"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a letter template",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"kind": {
										"default": "custom",
										"type": "string",
										"enum": [
											"recall",
											"referral",
											"estimate",
											"statement_cover",
											"custom"
										]
									},
									"body": {
										"type": "string",
										"minLength": 1,
										"maxLength": 20000
									}
								},
								"required": [
									"name",
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"recall",
												"referral",
												"estimate",
												"statement_cover",
												"custom"
											]
										},
										"body": {
											"type": "string"
										},
										"mergeFields": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"body",
										"mergeFields",
										"version",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/letter-templates/{id}": {
			"patch": {
				"summary": "Update a letter template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"kind": {
										"default": "custom",
										"type": "string",
										"enum": [
											"recall",
											"referral",
											"estimate",
											"statement_cover",
											"custom"
										]
									},
									"body": {
										"type": "string",
										"minLength": 1,
										"maxLength": 20000
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"recall",
												"referral",
												"estimate",
												"statement_cover",
												"custom"
											]
										},
										"body": {
											"type": "string"
										},
										"mergeFields": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"body",
										"mergeFields",
										"version",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/letter-templates/{id}/archive": {
			"post": {
				"summary": "Archive a letter template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"recall",
												"referral",
												"estimate",
												"statement_cover",
												"custom"
											]
										},
										"body": {
											"type": "string"
										},
										"mergeFields": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"body",
										"mergeFields",
										"version",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/letter-templates/{id}/restore": {
			"post": {
				"summary": "Restore an archived letter template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"recall",
												"referral",
												"estimate",
												"statement_cover",
												"custom"
											]
										},
										"body": {
											"type": "string"
										},
										"mergeFields": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"kind",
										"body",
										"mergeFields",
										"version",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/letters/{patientId}": {
			"get": {
				"summary": "List a patient's generated letters",
				"tags": [
					"Letters"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/GeneratedLetterView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Generate a letter from a template",
				"tags": [
					"Letters"
				],
				"description": "Merges the template's tags with the patient, practice and site, renders the letter to a PDF filed on the patient, and records the letter at the template's current version. Printing is the only built delivery; email, SMS link and post are recorded as intended deliveries and marked sent by hand.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"delivery": {
										"default": "print",
										"type": "string",
										"enum": [
											"print",
											"email",
											"sms_link",
											"post"
										]
									},
									"amendsLetterId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"templateId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"templateId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"templateVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"renderedDocumentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"delivery": {
											"type": "string",
											"enum": [
												"print",
												"email",
												"sms_link",
												"post"
											]
										},
										"messageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sentAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendsLetterId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"templateName": {
											"type": "string"
										},
										"clinicalDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"templateId",
										"templateVersion",
										"renderedDocumentId",
										"delivery",
										"messageId",
										"sentAt",
										"amendsLetterId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"templateName",
										"clinicalDocumentId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/letters/{patientId}/{id}/sent": {
			"post": {
				"summary": "Record that a letter went out",
				"tags": [
					"Letters"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"templateId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"templateVersion": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"renderedDocumentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"delivery": {
											"type": "string",
											"enum": [
												"print",
												"email",
												"sms_link",
												"post"
											]
										},
										"messageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sentAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"amendsLetterId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"templateName": {
											"type": "string"
										},
										"clinicalDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"templateId",
										"templateVersion",
										"renderedDocumentId",
										"delivery",
										"messageId",
										"sentAt",
										"amendsLetterId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"templateName",
										"clinicalDocumentId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/waitlist": {
			"get": {
				"summary": "The practice's open waitlist",
				"tags": [
					"Waitlist"
				],
				"description": "Open and offered requests across patients, highest priority first, optionally for one site.",
				"parameters": [
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WaitlistRequestView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/waitlist/{patientId}": {
			"get": {
				"summary": "A patient's waitlist requests",
				"tags": [
					"Waitlist"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WaitlistRequestView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Add a patient to the waitlist",
				"tags": [
					"Waitlist"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"asap",
											"short_notice",
											"referral_to_treatment"
										]
									},
									"treatmentPlanId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"appointmentTypeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"earliestOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"latestOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"priority": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 100
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"asap",
												"short_notice",
												"referral_to_treatment"
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"earliestOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"latestOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priority": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"open",
												"offered",
												"booked",
												"withdrawn"
											]
										},
										"bookedAppointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"patientName": {
											"type": "string"
										},
										"practitionerName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentTypeName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"kind",
										"treatmentPlanId",
										"appointmentTypeId",
										"practitionerId",
										"locationId",
										"earliestOn",
										"latestOn",
										"priority",
										"status",
										"bookedAppointmentId",
										"note",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"patientName",
										"practitionerName",
										"appointmentTypeName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/waitlist/{patientId}/{id}/status": {
			"post": {
				"summary": "Move a waitlist request along",
				"tags": [
					"Waitlist"
				],
				"description": "open → offered → booked (with the appointment) or back to open; open or offered → withdrawn.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"open",
											"offered",
											"booked",
											"withdrawn"
										]
									},
									"bookedAppointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"asap",
												"short_notice",
												"referral_to_treatment"
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentTypeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"earliestOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"latestOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"priority": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"open",
												"offered",
												"booked",
												"withdrawn"
											]
										},
										"bookedAppointmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"patientName": {
											"type": "string"
										},
										"practitionerName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"appointmentTypeName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"kind",
										"treatmentPlanId",
										"appointmentTypeId",
										"practitionerId",
										"locationId",
										"earliestOn",
										"latestOn",
										"priority",
										"status",
										"bookedAppointmentId",
										"note",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"patientName",
										"practitionerName",
										"appointmentTypeName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatment-templates": {
			"get": {
				"summary": "List Treatment templates",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentTemplate"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a treatment template",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"treatmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"treatmentId",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatment-templates/{id}": {
			"patch": {
				"summary": "Update a treatment template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"treatmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"treatmentId",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatment-templates/{id}/archive": {
			"post": {
				"summary": "Archive a treatment template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"treatmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"treatmentId",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatment-templates/{id}/restore": {
			"post": {
				"summary": "Restore an archived treatment template",
				"tags": [
					"settings"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"name": {
											"type": "string"
										},
										"treatmentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"name",
										"treatmentId",
										"archivedAt",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"402": {
						"description": "Payment Required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/treatment-templates/{id}/items": {
			"get": {
				"summary": "A treatment template's items",
				"tags": [
					"Treatment templates"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentTemplateItemView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Replace a treatment template's items",
				"tags": [
					"Treatment templates"
				],
				"description": "Every item names an act code of the catalogue (409 CODE_KIND); the same code appears once per visit.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"procedureCodeId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"quantity": {
													"default": 1,
													"type": "integer",
													"minimum": 1,
													"maximum": 32
												},
												"visitPosition": {
													"default": 1,
													"type": "integer",
													"minimum": 1,
													"maximum": 20
												}
											},
											"required": [
												"procedureCodeId"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentTemplateItemView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/plans/{patientId}/{id}/apply-template": {
			"post": {
				"summary": "Add a treatment template's procedures to a draft plan",
				"tags": [
					"Treatment templates"
				],
				"description": "Plans one procedure per template item (the record_procedure act, priced from the plan's price list at the plan's site) and adds them to the plan. The plan must be a draft (409).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"templateId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"number": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"importedStatus": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"presented",
												"accepted",
												"in_progress",
												"completed",
												"declined",
												"cancelled"
											]
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"priceListId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"journeyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"presentedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"acceptedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"declinedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"externalTotalCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanProcedure"
											}
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanVisit"
											}
										},
										"snapshots": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentPlanSnapshot"
											}
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"locationId",
										"practitionerId",
										"number",
										"externalReference",
										"importedStatus",
										"name",
										"status",
										"version",
										"priceListId",
										"journeyId",
										"presentedAt",
										"acceptedAt",
										"declinedAt",
										"completedAt",
										"cancelledAt",
										"expiresAt",
										"externalTotalCents",
										"currency",
										"note",
										"authoringSource",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"procedures",
										"visits",
										"snapshots",
										"totalCents"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/statements/{patientId}": {
			"get": {
				"summary": "List the statements of a patient's account",
				"tags": [
					"Statements"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Statement"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Generate an account statement",
				"tags": [
					"Statements"
				],
				"description": "Renders the account's charges, payments and outstanding balance for the period, aged from each charge's date, to a PDF filed on the account, and records the statement. Delivery defaults to the account's statement delivery, then print. A fee posts as a charge on the account citing the statement.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"default": "account",
										"type": "string",
										"enum": [
											"account",
											"patient"
										]
									},
									"periodStart": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"periodEnd": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"delivery": {
										"type": "string",
										"enum": [
											"print",
											"email",
											"sms_link",
											"portal"
										]
									},
									"dunningLevel": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 9
									},
									"feeCents": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"periodStart",
									"periodEnd"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"accountMemberId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"account",
												"patient"
											]
										},
										"periodStart": {
											"type": "string"
										},
										"periodEnd": {
											"type": "string"
										},
										"balanceCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"pleasePayCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"aging": {},
										"dunningLevel": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"documentId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"delivery": {
											"type": "string",
											"enum": [
												"print",
												"email",
												"sms_link",
												"portal"
											]
										},
										"messageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"generatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"feeEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"accountId",
										"patientId",
										"accountMemberId",
										"kind",
										"periodStart",
										"periodEnd",
										"balanceCents",
										"pleasePayCents",
										"currency",
										"aging",
										"dunningLevel",
										"documentId",
										"delivery",
										"messageId",
										"generatedAt",
										"feeEntryId",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/memberships/{patientId}": {
			"get": {
				"summary": "A patient's memberships",
				"tags": [
					"Memberships"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/MembershipSubscriptionView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Start a membership",
				"tags": [
					"Memberships"
				],
				"description": "One active membership per patient and scheme (409 MEMBERSHIP_ACTIVE); the price list must be a membership list (409 PRICE_LIST_KIND). The monthly fee posts as a charge on the first day of each month from the start date.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"priceListId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"band": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"monthlyFeeCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"providerRef": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 60
											},
											{
												"type": "null"
											}
										]
									},
									"startsOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"assessment": {
										"anyOf": [
											{
												"type": "object",
												"propertyNames": {
													"type": "string"
												},
												"additionalProperties": {}
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"priceListId",
									"monthlyFeeCents",
									"startsOn"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"priceListId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"band": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"monthlyFeeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"startsOn": {
											"type": "string"
										},
										"endsOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"lapsed",
												"cancelled"
											]
										},
										"lastChargedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"assessment": {},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"priceListName": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"priceListId",
										"band",
										"monthlyFeeCents",
										"currency",
										"providerRef",
										"startsOn",
										"endsOn",
										"status",
										"lastChargedOn",
										"assessment",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"priceListName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/memberships/{patientId}/{id}/status": {
			"post": {
				"summary": "Lapse, reactivate or cancel a membership",
				"tags": [
					"Memberships"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"active",
											"lapsed",
											"cancelled"
										]
									},
									"endsOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"priceListId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"band": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"monthlyFeeCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"providerRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"startsOn": {
											"type": "string"
										},
										"endsOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"lapsed",
												"cancelled"
											]
										},
										"lastChargedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"assessment": {},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"priceListName": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"accountId",
										"accountMemberId",
										"priceListId",
										"band",
										"monthlyFeeCents",
										"currency",
										"providerRef",
										"startsOn",
										"endsOn",
										"status",
										"lastChargedOn",
										"assessment",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"priceListName"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/payment-plans/{patientId}": {
			"get": {
				"summary": "A patient's payment plans",
				"tags": [
					"Payment plans"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PaymentPlanView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Draft a payment plan",
				"tags": [
					"Payment plans"
				],
				"description": "Schedules instalment_count instalments from the start date at the interval, the financed amount (total minus deposit, plus the flat interest) spread evenly with the rounding on the last instalment. The plan is a draft until it is activated with its agreement.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"kind": {
										"default": "in_house",
										"type": "string",
										"enum": [
											"in_house",
											"finance_company"
										]
									},
									"financeContactId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatmentPlanId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"totalCents": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									},
									"depositCents": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"interval": {
										"type": "string",
										"enum": [
											"weekly",
											"biweekly",
											"monthly",
											"quarterly"
										]
									},
									"instalmentCount": {
										"type": "integer",
										"minimum": 1,
										"maximum": 120
									},
									"interestRateBp": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 10000
									},
									"startsOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"locationId",
									"totalCents",
									"interval",
									"instalmentCount",
									"startsOn"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"in_house",
												"finance_company"
											]
										},
										"financeContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"depositCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"instalmentCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"interval": {
											"type": "string",
											"enum": [
												"weekly",
												"biweekly",
												"monthly",
												"quarterly"
											]
										},
										"instalmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"interestRateBp": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"startsOn": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"completed",
												"defaulted",
												"cancelled"
											]
										},
										"agreementDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"activatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"instalments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"paymentPlanId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"accountId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"sequence": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"dueOn": {
														"type": "string"
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"settledCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"waivedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"waivedById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"waiveReason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"status": {
														"type": "string",
														"enum": [
															"waived",
															"paid",
															"partial",
															"missed",
															"due"
														]
													}
												},
												"required": [
													"id",
													"organizationId",
													"paymentPlanId",
													"accountId",
													"sequence",
													"dueOn",
													"amountCents",
													"currency",
													"settledCents",
													"waivedAt",
													"waivedById",
													"waiveReason",
													"createdAt",
													"updatedAt",
													"status"
												],
												"additionalProperties": false
											}
										},
										"allocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InstalmentAllocation"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"accountId",
										"patientId",
										"accountMemberId",
										"locationId",
										"kind",
										"financeContactId",
										"treatmentPlanId",
										"totalCents",
										"depositCents",
										"instalmentCents",
										"currency",
										"interval",
										"instalmentCount",
										"interestRateBp",
										"startsOn",
										"status",
										"agreementDocumentId",
										"activatedAt",
										"closedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"instalments",
										"allocations"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/payment-plans/{patientId}/{id}/activate": {
			"post": {
				"summary": "Activate a payment plan",
				"tags": [
					"Payment plans"
				],
				"description": "Renders the agreement (the schedule, the amounts and the terms) to a PDF filed on the account, then activates the plan; the instalments are frozen from here.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"in_house",
												"finance_company"
											]
										},
										"financeContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"depositCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"instalmentCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"interval": {
											"type": "string",
											"enum": [
												"weekly",
												"biweekly",
												"monthly",
												"quarterly"
											]
										},
										"instalmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"interestRateBp": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"startsOn": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"completed",
												"defaulted",
												"cancelled"
											]
										},
										"agreementDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"activatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"instalments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"paymentPlanId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"accountId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"sequence": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"dueOn": {
														"type": "string"
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"settledCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"waivedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"waivedById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"waiveReason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"status": {
														"type": "string",
														"enum": [
															"waived",
															"paid",
															"partial",
															"missed",
															"due"
														]
													}
												},
												"required": [
													"id",
													"organizationId",
													"paymentPlanId",
													"accountId",
													"sequence",
													"dueOn",
													"amountCents",
													"currency",
													"settledCents",
													"waivedAt",
													"waivedById",
													"waiveReason",
													"createdAt",
													"updatedAt",
													"status"
												],
												"additionalProperties": false
											}
										},
										"allocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InstalmentAllocation"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"accountId",
										"patientId",
										"accountMemberId",
										"locationId",
										"kind",
										"financeContactId",
										"treatmentPlanId",
										"totalCents",
										"depositCents",
										"instalmentCents",
										"currency",
										"interval",
										"instalmentCount",
										"interestRateBp",
										"startsOn",
										"status",
										"agreementDocumentId",
										"activatedAt",
										"closedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"instalments",
										"allocations"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/payment-plans/{patientId}/{id}/status": {
			"post": {
				"summary": "Complete, default or cancel a payment plan",
				"tags": [
					"Payment plans"
				],
				"description": "completed needs every instalment paid or waived (409 PLAN_TRANSITION otherwise); a plan also completes by itself when its last instalment settles.",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"completed",
											"defaulted",
											"cancelled"
										]
									}
								},
								"required": [
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"in_house",
												"finance_company"
											]
										},
										"financeContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"depositCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"instalmentCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"interval": {
											"type": "string",
											"enum": [
												"weekly",
												"biweekly",
												"monthly",
												"quarterly"
											]
										},
										"instalmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"interestRateBp": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"startsOn": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"completed",
												"defaulted",
												"cancelled"
											]
										},
										"agreementDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"activatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"instalments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"paymentPlanId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"accountId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"sequence": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"dueOn": {
														"type": "string"
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"settledCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"waivedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"waivedById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"waiveReason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"status": {
														"type": "string",
														"enum": [
															"waived",
															"paid",
															"partial",
															"missed",
															"due"
														]
													}
												},
												"required": [
													"id",
													"organizationId",
													"paymentPlanId",
													"accountId",
													"sequence",
													"dueOn",
													"amountCents",
													"currency",
													"settledCents",
													"waivedAt",
													"waivedById",
													"waiveReason",
													"createdAt",
													"updatedAt",
													"status"
												],
												"additionalProperties": false
											}
										},
										"allocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InstalmentAllocation"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"accountId",
										"patientId",
										"accountMemberId",
										"locationId",
										"kind",
										"financeContactId",
										"treatmentPlanId",
										"totalCents",
										"depositCents",
										"instalmentCents",
										"currency",
										"interval",
										"instalmentCount",
										"interestRateBp",
										"startsOn",
										"status",
										"agreementDocumentId",
										"activatedAt",
										"closedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"instalments",
										"allocations"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/payment-plans/{patientId}/{id}/instalments/{instalmentId}/waive": {
			"post": {
				"summary": "Waive an instalment",
				"tags": [
					"Payment plans"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "instalmentId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"in_house",
												"finance_company"
											]
										},
										"financeContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"depositCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"instalmentCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"interval": {
											"type": "string",
											"enum": [
												"weekly",
												"biweekly",
												"monthly",
												"quarterly"
											]
										},
										"instalmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"interestRateBp": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"startsOn": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"completed",
												"defaulted",
												"cancelled"
											]
										},
										"agreementDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"activatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"instalments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"paymentPlanId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"accountId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"sequence": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"dueOn": {
														"type": "string"
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"settledCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"waivedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"waivedById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"waiveReason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"status": {
														"type": "string",
														"enum": [
															"waived",
															"paid",
															"partial",
															"missed",
															"due"
														]
													}
												},
												"required": [
													"id",
													"organizationId",
													"paymentPlanId",
													"accountId",
													"sequence",
													"dueOn",
													"amountCents",
													"currency",
													"settledCents",
													"waivedAt",
													"waivedById",
													"waiveReason",
													"createdAt",
													"updatedAt",
													"status"
												],
												"additionalProperties": false
											}
										},
										"allocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InstalmentAllocation"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"accountId",
										"patientId",
										"accountMemberId",
										"locationId",
										"kind",
										"financeContactId",
										"treatmentPlanId",
										"totalCents",
										"depositCents",
										"instalmentCents",
										"currency",
										"interval",
										"instalmentCount",
										"interestRateBp",
										"startsOn",
										"status",
										"agreementDocumentId",
										"activatedAt",
										"closedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"instalments",
										"allocations"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/payment-plans/{patientId}/{id}/allocate": {
			"post": {
				"summary": "Allocate a payment to the plan's instalments",
				"tags": [
					"Payment plans"
				],
				"description": "Settles the earliest open instalments first, in as many parts as the amount covers; never past an instalment, never past the payment (409 ALLOCATION_REFUSED).",
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"ledgerEntryId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"amountCents": {
										"type": "integer",
										"minimum": 1,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"ledgerEntryId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"in_house",
												"finance_company"
											]
										},
										"financeContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"depositCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"instalmentCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"interval": {
											"type": "string",
											"enum": [
												"weekly",
												"biweekly",
												"monthly",
												"quarterly"
											]
										},
										"instalmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"interestRateBp": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"startsOn": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"completed",
												"defaulted",
												"cancelled"
											]
										},
										"agreementDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"activatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"instalments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"paymentPlanId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"accountId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"sequence": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"dueOn": {
														"type": "string"
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"settledCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"waivedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"waivedById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"waiveReason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"status": {
														"type": "string",
														"enum": [
															"waived",
															"paid",
															"partial",
															"missed",
															"due"
														]
													}
												},
												"required": [
													"id",
													"organizationId",
													"paymentPlanId",
													"accountId",
													"sequence",
													"dueOn",
													"amountCents",
													"currency",
													"settledCents",
													"waivedAt",
													"waivedById",
													"waiveReason",
													"createdAt",
													"updatedAt",
													"status"
												],
												"additionalProperties": false
											}
										},
										"allocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InstalmentAllocation"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"accountId",
										"patientId",
										"accountMemberId",
										"locationId",
										"kind",
										"financeContactId",
										"treatmentPlanId",
										"totalCents",
										"depositCents",
										"instalmentCents",
										"currency",
										"interval",
										"instalmentCount",
										"interestRateBp",
										"startsOn",
										"status",
										"agreementDocumentId",
										"activatedAt",
										"closedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"instalments",
										"allocations"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/payment-plans/{patientId}/{id}/allocations/{allocationId}/reverse": {
			"post": {
				"summary": "Reverse an instalment allocation",
				"tags": [
					"Payment plans"
				],
				"parameters": [
					{
						"name": "patientId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "allocationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"accountId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"accountMemberId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"in_house",
												"finance_company"
											]
										},
										"financeContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"treatmentPlanId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"totalCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"depositCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"instalmentCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"interval": {
											"type": "string",
											"enum": [
												"weekly",
												"biweekly",
												"monthly",
												"quarterly"
											]
										},
										"instalmentCount": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"interestRateBp": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"startsOn": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"active",
												"completed",
												"defaulted",
												"cancelled"
											]
										},
										"agreementDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"activatedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"instalments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"paymentPlanId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"accountId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"sequence": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"dueOn": {
														"type": "string"
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"settledCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"waivedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"waivedById": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"waiveReason": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"status": {
														"type": "string",
														"enum": [
															"waived",
															"paid",
															"partial",
															"missed",
															"due"
														]
													}
												},
												"required": [
													"id",
													"organizationId",
													"paymentPlanId",
													"accountId",
													"sequence",
													"dueOn",
													"amountCents",
													"currency",
													"settledCents",
													"waivedAt",
													"waivedById",
													"waiveReason",
													"createdAt",
													"updatedAt",
													"status"
												],
												"additionalProperties": false
											}
										},
										"allocations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InstalmentAllocation"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"accountId",
										"patientId",
										"accountMemberId",
										"locationId",
										"kind",
										"financeContactId",
										"treatmentPlanId",
										"totalCents",
										"depositCents",
										"instalmentCents",
										"currency",
										"interval",
										"instalmentCount",
										"interestRateBp",
										"startsOn",
										"status",
										"agreementDocumentId",
										"activatedAt",
										"closedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"instalments",
										"allocations"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/till/sessions": {
			"get": {
				"summary": "Recent till sessions",
				"tags": [
					"Till"
				],
				"parameters": [
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TillSessionView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Open the till at a location",
				"tags": [
					"Till"
				],
				"description": "One open session per location (409 TILL_OPEN). Cash payments and refunds taken at the location while it is open are recorded on it.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"openingFloatCents": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"openedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"closedByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"openingFloatCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"countedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"expectedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"varianceCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"terminalSettlementRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bankDepositRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"open",
												"closed",
												"reconciled"
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"locationName": {
											"type": "string"
										},
										"cashMovementCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"entries": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"sessionId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"ledgerEntryId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"paymentMethodKind": {
														"type": "string",
														"enum": [
															"cash",
															"card",
															"terminal",
															"bank_transfer",
															"cheque",
															"online",
															"finance",
															"other"
														]
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"patientName": {
														"type": "string"
													},
													"entryKind": {
														"type": "string"
													},
													"entryDate": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"organizationId",
													"sessionId",
													"locationId",
													"ledgerEntryId",
													"paymentMethodKind",
													"amountCents",
													"currency",
													"createdAt",
													"patientId",
													"patientName",
													"entryKind",
													"entryDate"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"openedAt",
										"closedAt",
										"closedById",
										"closedByName",
										"openingFloatCents",
										"countedCashCents",
										"expectedCashCents",
										"varianceCents",
										"currency",
										"terminalSettlementRef",
										"bankDepositRef",
										"status",
										"reconciledAt",
										"reconciledById",
										"reconciledByName",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"locationName",
										"cashMovementCents",
										"entries"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/till/sessions/{id}": {
			"get": {
				"summary": "A till session with its entries",
				"tags": [
					"Till"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"openedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"closedByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"openingFloatCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"countedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"expectedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"varianceCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"terminalSettlementRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bankDepositRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"open",
												"closed",
												"reconciled"
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"locationName": {
											"type": "string"
										},
										"cashMovementCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"entries": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"sessionId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"ledgerEntryId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"paymentMethodKind": {
														"type": "string",
														"enum": [
															"cash",
															"card",
															"terminal",
															"bank_transfer",
															"cheque",
															"online",
															"finance",
															"other"
														]
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"patientName": {
														"type": "string"
													},
													"entryKind": {
														"type": "string"
													},
													"entryDate": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"organizationId",
													"sessionId",
													"locationId",
													"ledgerEntryId",
													"paymentMethodKind",
													"amountCents",
													"currency",
													"createdAt",
													"patientId",
													"patientName",
													"entryKind",
													"entryDate"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"openedAt",
										"closedAt",
										"closedById",
										"closedByName",
										"openingFloatCents",
										"countedCashCents",
										"expectedCashCents",
										"varianceCents",
										"currency",
										"terminalSettlementRef",
										"bankDepositRef",
										"status",
										"reconciledAt",
										"reconciledById",
										"reconciledByName",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"locationName",
										"cashMovementCents",
										"entries"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/till/sessions/{id}/close": {
			"post": {
				"summary": "Close the till",
				"tags": [
					"Till"
				],
				"description": "Stamps the expected cash (opening float plus the cash taken minus the cash refunded) and the variance against the count.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"countedCashCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"countedCashCents"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"openedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"closedByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"openingFloatCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"countedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"expectedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"varianceCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"terminalSettlementRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bankDepositRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"open",
												"closed",
												"reconciled"
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"locationName": {
											"type": "string"
										},
										"cashMovementCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"entries": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"sessionId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"ledgerEntryId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"paymentMethodKind": {
														"type": "string",
														"enum": [
															"cash",
															"card",
															"terminal",
															"bank_transfer",
															"cheque",
															"online",
															"finance",
															"other"
														]
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"patientName": {
														"type": "string"
													},
													"entryKind": {
														"type": "string"
													},
													"entryDate": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"organizationId",
													"sessionId",
													"locationId",
													"ledgerEntryId",
													"paymentMethodKind",
													"amountCents",
													"currency",
													"createdAt",
													"patientId",
													"patientName",
													"entryKind",
													"entryDate"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"openedAt",
										"closedAt",
										"closedById",
										"closedByName",
										"openingFloatCents",
										"countedCashCents",
										"expectedCashCents",
										"varianceCents",
										"currency",
										"terminalSettlementRef",
										"bankDepositRef",
										"status",
										"reconciledAt",
										"reconciledById",
										"reconciledByName",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"locationName",
										"cashMovementCents",
										"entries"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/till/sessions/{id}/reconcile": {
			"post": {
				"summary": "Reconcile a closed till session",
				"tags": [
					"Till"
				],
				"description": "Records the card/terminal settlement and bank deposit references, each set once, and marks the session reconciled.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"terminalSettlementRef": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"bankDepositRef": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"openedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"closedByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"openingFloatCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"countedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"expectedCashCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"varianceCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"terminalSettlementRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"bankDepositRef": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"open",
												"closed",
												"reconciled"
											]
										},
										"reconciledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reconciledByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"locationName": {
											"type": "string"
										},
										"cashMovementCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"entries": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"organizationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
														"description": "Canonical lowercase UUID organization identifier"
													},
													"sessionId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"locationId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"ledgerEntryId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"paymentMethodKind": {
														"type": "string",
														"enum": [
															"cash",
															"card",
															"terminal",
															"bank_transfer",
															"cheque",
															"online",
															"finance",
															"other"
														]
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"currency": {
														"type": "string",
														"enum": [
															"EUR",
															"GBP",
															"USD"
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"patientId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"patientName": {
														"type": "string"
													},
													"entryKind": {
														"type": "string"
													},
													"entryDate": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"organizationId",
													"sessionId",
													"locationId",
													"ledgerEntryId",
													"paymentMethodKind",
													"amountCents",
													"currency",
													"createdAt",
													"patientId",
													"patientName",
													"entryKind",
													"entryDate"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"openedAt",
										"closedAt",
										"closedById",
										"closedByName",
										"openingFloatCents",
										"countedCashCents",
										"expectedCashCents",
										"varianceCents",
										"currency",
										"terminalSettlementRef",
										"bankDepositRef",
										"status",
										"reconciledAt",
										"reconciledById",
										"reconciledByName",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"locationName",
										"cashMovementCents",
										"entries"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/accounting": {
			"get": {
				"summary": "The accounting connection and its account mappings",
				"tags": [
					"Accounting"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connection": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AccountingConnection"
												},
												{
													"type": "null"
												}
											]
										},
										"mappings": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AccountingAccountMapping"
											}
										},
										"providers": {
											"type": "object",
											"properties": {
												"xero": {
													"type": "boolean"
												},
												"quickbooks": {
													"type": "boolean"
												}
											},
											"required": [
												"xero",
												"quickbooks"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"connection",
										"mappings",
										"providers"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/accounting/oauth/start": {
			"post": {
				"summary": "Start a Xero or QuickBooks connect",
				"tags": [
					"Accounting"
				],
				"description": "Mints a single-use signed handshake and returns the provider's authorize URL. The callback stores the grant and marks the connection active; a reconnect bumps the credential generation.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"enum": [
											"xero",
											"quickbooks"
										]
									}
								},
								"required": [
									"provider"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"authorizeUrl": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"authorizeUrl"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/accounting/connection/status": {
			"post": {
				"summary": "Pause, resume or disconnect the accounting connection",
				"tags": [
					"Accounting"
				],
				"description": "Disconnecting bumps the credential generation, so an in-flight delivery claimed under the old grant parks instead of posting.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"active",
											"paused",
											"disconnected"
										]
									}
								},
								"required": [
									"status"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"provider": {
											"type": "string",
											"enum": [
												"xero",
												"quickbooks"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"connecting",
												"active",
												"paused",
												"error",
												"disconnected"
											]
										},
										"credentialGeneration": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"externalCompanyId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalCompanyName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"settings": {},
										"lastSyncAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"builtThroughDate": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"provider",
										"status",
										"credentialGeneration",
										"externalCompanyId",
										"externalCompanyName",
										"settings",
										"lastSyncAt",
										"lastError",
										"builtThroughDate",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/accounting/accounts": {
			"get": {
				"summary": "The provider's chart of accounts and tax rates",
				"tags": [
					"Accounting"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"accounts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"name": {
														"type": "string"
													},
													"code": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													},
													"kind": {
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"name",
													"code",
													"kind"
												],
												"additionalProperties": false
											}
										},
										"taxRates": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"accounts",
										"taxRates"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/accounting/mappings": {
			"put": {
				"summary": "Replace the account mappings",
				"tags": [
					"Accounting"
				],
				"description": "The whole set at once: revenue by procedure category, each payment method, each location's bank account, and the control accounts (deposits held, refunds, write-offs, patient liability, VAT).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 500,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"type": "string",
													"enum": [
														"revenue_by_category",
														"payment_method",
														"bank_account",
														"deposits_held",
														"refunds",
														"write_offs",
														"patient_liability",
														"vat_exempt",
														"vat_standard",
														"stamp_duty"
													]
												},
												"procedureCategoryId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"paymentMethodId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"locationId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"externalAccountId": {
													"type": "string",
													"minLength": 1,
													"maxLength": 200
												},
												"externalAccountName": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 200
														},
														{
															"type": "null"
														}
													]
												},
												"externalTaxRateId": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 200
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"kind",
												"externalAccountId"
											]
										}
									}
								},
								"required": [
									"items"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AccountingAccountMapping"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/accounting/journals": {
			"get": {
				"summary": "Journal revisions and their delivery attempts",
				"tags": [
					"Accounting"
				],
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AccountingJournalView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/accounting/journals/build": {
			"post": {
				"summary": "Build the day's journal for a location",
				"tags": [
					"Accounting"
				],
				"description": "Reads the day's live ledger entries at the location, maps them to accounts and records one balanced revision for the lane to post. A day already posted with the same figures is unchanged; changed figures post a reversal and a new generation.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"periodDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									}
								},
								"required": [
									"locationId",
									"periodDate"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"outcome": {
											"type": "string",
											"enum": [
												"built",
												"unchanged",
												"empty",
												"unmapped"
											]
										},
										"revision": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AccountingJournalRevision"
												},
												{
													"type": "null"
												}
											]
										},
										"missing": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"enum": [
															"revenue_by_category",
															"payment_method",
															"bank_account",
															"deposits_held",
															"refunds",
															"write_offs",
															"patient_liability",
															"vat_exempt",
															"vat_standard",
															"stamp_duty"
														]
													},
													"label": {
														"type": "string"
													}
												},
												"required": [
													"kind",
													"label"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"outcome",
										"revision",
										"missing"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/staff-records": {
			"get": {
				"summary": "Staff records with their expiry dates",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "boolean"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/StaffRecord"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Add a staff record",
				"tags": [
					"Compliance"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"userId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"staffName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"kind": {
										"type": "string",
										"enum": [
											"registration",
											"indemnity",
											"dbs_check",
											"immunisation",
											"training",
											"licence",
											"dea",
											"cpr",
											"radiography",
											"safeguarding",
											"other"
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"reference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"issuer": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"issuedOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"expiresOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"reminderDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 3660
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"staffName",
									"kind",
									"title"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"staffName": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"registration",
												"indemnity",
												"dbs_check",
												"immunisation",
												"training",
												"licence",
												"dea",
												"cpr",
												"radiography",
												"safeguarding",
												"other"
											]
										},
										"title": {
											"type": "string"
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"issuer": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"issuedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reminderDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"userId",
										"practitionerId",
										"staffName",
										"kind",
										"title",
										"reference",
										"issuer",
										"issuedOn",
										"expiresOn",
										"documentId",
										"reminderDays",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/staff-records/{id}": {
			"patch": {
				"summary": "Update or archive a staff record",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"userId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"staffName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"kind": {
										"type": "string",
										"enum": [
											"registration",
											"indemnity",
											"dbs_check",
											"immunisation",
											"training",
											"licence",
											"dea",
											"cpr",
											"radiography",
											"safeguarding",
											"other"
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"reference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"issuer": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"issuedOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"expiresOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"reminderDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 3660
											},
											{
												"type": "null"
											}
										]
									},
									"archived": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"staffName": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"registration",
												"indemnity",
												"dbs_check",
												"immunisation",
												"training",
												"licence",
												"dea",
												"cpr",
												"radiography",
												"safeguarding",
												"other"
											]
										},
										"title": {
											"type": "string"
										},
										"reference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"issuer": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"issuedOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"expiresOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reminderDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"userId",
										"practitionerId",
										"staffName",
										"kind",
										"title",
										"reference",
										"issuer",
										"issuedOn",
										"expiresOn",
										"documentId",
										"reminderDays",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/policies": {
			"get": {
				"summary": "Policies: every version, drafts first",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "boolean"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CompliancePolicyView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Draft a policy version",
				"tags": [
					"Compliance"
				],
				"description": "A new key starts at version 1; an existing key drafts the next version, which supersedes the live one when published.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"key": {
										"type": "string",
										"pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"category": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 80
											},
											{
												"type": "null"
											}
										]
									},
									"body": {},
									"bodyText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200000
											},
											{
												"type": "null"
											}
										]
									},
									"reviewDueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"requiresAcknowledgement": {
										"type": "boolean"
									}
								},
								"required": [
									"key",
									"title"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"title": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reviewDueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesPolicyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresAcknowledgement": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"acknowledgements": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PolicyAcknowledgement"
											}
										},
										"acknowledgedByMe": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"organizationId",
										"key",
										"version",
										"title",
										"category",
										"body",
										"bodyText",
										"documentId",
										"reviewDueOn",
										"publishedAt",
										"publishedById",
										"supersedesPolicyId",
										"requiresAcknowledgement",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"acknowledgements",
										"acknowledgedByMe"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/policies/{id}": {
			"patch": {
				"summary": "Edit a draft, or set a published version's review date",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"category": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 80
											},
											{
												"type": "null"
											}
										]
									},
									"body": {},
									"bodyText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200000
											},
											{
												"type": "null"
											}
										]
									},
									"reviewDueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"requiresAcknowledgement": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"title": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reviewDueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesPolicyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresAcknowledgement": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"acknowledgements": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PolicyAcknowledgement"
											}
										},
										"acknowledgedByMe": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"organizationId",
										"key",
										"version",
										"title",
										"category",
										"body",
										"bodyText",
										"documentId",
										"reviewDueOn",
										"publishedAt",
										"publishedById",
										"supersedesPolicyId",
										"requiresAcknowledgement",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"acknowledgements",
										"acknowledgedByMe"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/policies/{id}/publish": {
			"post": {
				"summary": "Publish a draft; the previous live version is archived",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"title": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reviewDueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesPolicyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresAcknowledgement": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"acknowledgements": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PolicyAcknowledgement"
											}
										},
										"acknowledgedByMe": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"organizationId",
										"key",
										"version",
										"title",
										"category",
										"body",
										"bodyText",
										"documentId",
										"reviewDueOn",
										"publishedAt",
										"publishedById",
										"supersedesPolicyId",
										"requiresAcknowledgement",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"acknowledgements",
										"acknowledgedByMe"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/policies/{id}/archive": {
			"post": {
				"summary": "Archive a published version, or delete a draft",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/policies/{id}/acknowledge": {
			"post": {
				"summary": "Acknowledge the published version as the signed-in member",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"title": {
											"type": "string"
										},
										"category": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {},
										"bodyText": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"reviewDueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"publishedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersedesPolicyId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"requiresAcknowledgement": {
											"type": "boolean"
										},
										"archivedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"acknowledgements": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PolicyAcknowledgement"
											}
										},
										"acknowledgedByMe": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"organizationId",
										"key",
										"version",
										"title",
										"category",
										"body",
										"bodyText",
										"documentId",
										"reviewDueOn",
										"publishedAt",
										"publishedById",
										"supersedesPolicyId",
										"requiresAcknowledgement",
										"archivedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"acknowledgements",
										"acknowledgedByMe"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/checks": {
			"get": {
				"summary": "Recurring and ad-hoc checks with their latest entry",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "includeInactive",
						"in": "query",
						"required": false,
						"schema": {
							"type": "boolean"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ComplianceCheckView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Define a check",
				"tags": [
					"Compliance"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"autoclave_cycle",
											"daily_test",
											"spore_test",
											"equipment",
											"fire",
											"first_aid",
											"fridge_temperature",
											"xray_qa",
											"audit",
											"custom"
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"intervalDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 3660
											},
											{
												"type": "null"
											}
										]
									},
									"assigneeUserId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"fields": {
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"key": {
													"type": "string",
													"pattern": "^[a-z0-9_]{1,40}$"
												},
												"label": {
													"type": "string",
													"minLength": 1,
													"maxLength": 80
												},
												"kind": {
													"type": "string",
													"enum": [
														"text",
														"number",
														"boolean"
													]
												},
												"unit": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 20
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"key",
												"label",
												"kind"
											]
										}
									},
									"active": {
										"type": "boolean"
									}
								},
								"required": [
									"kind",
									"title"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"autoclave_cycle",
												"daily_test",
												"spore_test",
												"equipment",
												"fire",
												"first_aid",
												"fridge_temperature",
												"xray_qa",
												"audit",
												"custom"
											]
										},
										"title": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"intervalDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"assigneeUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fields": {},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lastEntry": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ComplianceCheckEntry"
												},
												{
													"type": "null"
												}
											]
										},
										"nextDueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"title",
										"locationId",
										"intervalDays",
										"assigneeUserId",
										"fields",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"lastEntry",
										"nextDueOn"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/checks/{id}": {
			"patch": {
				"summary": "Edit or deactivate a check",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"autoclave_cycle",
											"daily_test",
											"spore_test",
											"equipment",
											"fire",
											"first_aid",
											"fridge_temperature",
											"xray_qa",
											"audit",
											"custom"
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"intervalDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 3660
											},
											{
												"type": "null"
											}
										]
									},
									"assigneeUserId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"fields": {
										"maxItems": 40,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"key": {
													"type": "string",
													"pattern": "^[a-z0-9_]{1,40}$"
												},
												"label": {
													"type": "string",
													"minLength": 1,
													"maxLength": 80
												},
												"kind": {
													"type": "string",
													"enum": [
														"text",
														"number",
														"boolean"
													]
												},
												"unit": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 20
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"key",
												"label",
												"kind"
											]
										}
									},
									"active": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"autoclave_cycle",
												"daily_test",
												"spore_test",
												"equipment",
												"fire",
												"first_aid",
												"fridge_temperature",
												"xray_qa",
												"audit",
												"custom"
											]
										},
										"title": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"intervalDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"assigneeUserId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"fields": {},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lastEntry": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ComplianceCheckEntry"
												},
												{
													"type": "null"
												}
											]
										},
										"nextDueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"title",
										"locationId",
										"intervalDays",
										"assigneeUserId",
										"fields",
										"active",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"lastEntry",
										"nextDueOn"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/checks/{id}/entries": {
			"post": {
				"summary": "Record a completed check",
				"tags": [
					"Compliance"
				],
				"description": "Append-only. Completing the task a due check opened closes it; an autoclave or spore check may cite the sterilisation cycle it verified.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"dueOn": {
										"anyOf": [
											{
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											{
												"type": "null"
											}
										]
									},
									"values": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "number"
												},
												{
													"type": "boolean"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"outcome": {
										"type": "string",
										"enum": [
											"pass",
											"fail",
											"na"
										]
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 4000
											},
											{
												"type": "null"
											}
										]
									},
									"taskId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"sterilisationCycleId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"outcome"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"checkId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"dueOn": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"completedById": {
											"type": "string"
										},
										"values": {},
										"outcome": {
											"type": "string",
											"enum": [
												"pass",
												"fail",
												"na"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"taskId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sterilisationCycleId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"checkId",
										"locationId",
										"dueOn",
										"completedAt",
										"completedById",
										"values",
										"outcome",
										"note",
										"documentId",
										"taskId",
										"sterilisationCycleId",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"get": {
				"summary": "A check's entries, newest first",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ComplianceCheckEntry"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/incidents": {
			"get": {
				"summary": "Incidents, open first",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"reported",
								"investigating",
								"closed"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ComplianceIncident"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Report an incident",
				"tags": [
					"Compliance"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"clinical",
											"safeguarding",
											"data_breach",
											"injury",
											"equipment",
											"complaint",
											"other"
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"description": {
										"type": "string",
										"minLength": 1,
										"maxLength": 8000
									},
									"locationId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"occurredAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"patientId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"severity": {
										"type": "string",
										"enum": [
											"low",
											"medium",
											"high",
											"critical"
										]
									}
								},
								"required": [
									"kind",
									"title",
									"description",
									"occurredAt",
									"severity"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"clinical",
												"safeguarding",
												"data_breach",
												"injury",
												"equipment",
												"complaint",
												"other"
											]
										},
										"title": {
											"type": "string"
										},
										"description": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"occurredAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"reportedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"reportedById": {
											"type": "string"
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"type": "string",
											"enum": [
												"low",
												"medium",
												"high",
												"critical"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"reported",
												"investigating",
												"closed"
											]
										},
										"investigationNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"rootCause": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"actionsTaken": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reportedExternallyAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"title",
										"description",
										"locationId",
										"occurredAt",
										"reportedAt",
										"reportedById",
										"patientId",
										"severity",
										"status",
										"investigationNote",
										"rootCause",
										"actionsTaken",
										"externalReference",
										"reportedExternallyAt",
										"closedAt",
										"closedById",
										"documentId",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/incidents/{id}": {
			"patch": {
				"summary": "Investigate or close an incident",
				"tags": [
					"Compliance"
				],
				"description": "reported → investigating → closed, or straight to closed; a closed incident is immutable (409 INCIDENT_TRANSITION).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"investigating",
											"closed"
										]
									},
									"investigationNote": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 8000
											},
											{
												"type": "null"
											}
										]
									},
									"rootCause": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 8000
											},
											{
												"type": "null"
											}
										]
									},
									"actionsTaken": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 8000
											},
											{
												"type": "null"
											}
										]
									},
									"externalReference": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"reportedExternallyAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"kind": {
											"type": "string",
											"enum": [
												"clinical",
												"safeguarding",
												"data_breach",
												"injury",
												"equipment",
												"complaint",
												"other"
											]
										},
										"title": {
											"type": "string"
										},
										"description": {
											"type": "string"
										},
										"locationId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"occurredAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"reportedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"reportedById": {
											"type": "string"
										},
										"patientId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"type": "string",
											"enum": [
												"low",
												"medium",
												"high",
												"critical"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"reported",
												"investigating",
												"closed"
											]
										},
										"investigationNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"rootCause": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"actionsTaken": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"externalReference": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"reportedExternallyAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"documentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"kind",
										"title",
										"description",
										"locationId",
										"occurredAt",
										"reportedAt",
										"reportedById",
										"patientId",
										"severity",
										"status",
										"investigationNote",
										"rootCause",
										"actionsTaken",
										"externalReference",
										"reportedExternallyAt",
										"closedAt",
										"closedById",
										"documentId",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/sterilisation-cycles": {
			"get": {
				"summary": "Recent sterilisation cycles with their uses",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SterilisationCycleView"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Start a sterilisation cycle",
				"tags": [
					"Compliance"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"autoclaveRef": {
										"type": "string",
										"minLength": 1,
										"maxLength": 80
									},
									"cycleNumber": {
										"type": "string",
										"minLength": 1,
										"maxLength": 80
									},
									"startedAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									}
								},
								"required": [
									"locationId",
									"autoclaveRef",
									"cycleNumber"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"autoclaveRef": {
											"type": "string"
										},
										"cycleNumber": {
											"type": "string"
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"outcome": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"pass",
														"fail",
														"aborted"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"operatorUserId": {
											"type": "string"
										},
										"printoutDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"checkEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"uses": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SterilisationCycleUse"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"autoclaveRef",
										"cycleNumber",
										"startedAt",
										"endedAt",
										"outcome",
										"operatorUserId",
										"printoutDocumentId",
										"checkEntryId",
										"createdAt",
										"uses"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/sterilisation-cycles/{id}/complete": {
			"post": {
				"summary": "Complete a cycle with its outcome, sealed once",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"outcome": {
										"type": "string",
										"enum": [
											"pass",
											"fail",
											"aborted"
										]
									},
									"endedAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"checkId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"outcome"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"autoclaveRef": {
											"type": "string"
										},
										"cycleNumber": {
											"type": "string"
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"outcome": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"pass",
														"fail",
														"aborted"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"operatorUserId": {
											"type": "string"
										},
										"printoutDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"checkEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"uses": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SterilisationCycleUse"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"autoclaveRef",
										"cycleNumber",
										"startedAt",
										"endedAt",
										"outcome",
										"operatorUserId",
										"printoutDocumentId",
										"checkEntryId",
										"createdAt",
										"uses"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/compliance/sterilisation-cycles/{id}/uses": {
			"post": {
				"summary": "Record instruments from a passed cycle used on a patient",
				"tags": [
					"Compliance"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"appointmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"procedureId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"instrumentSet": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"patientId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"locationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"autoclaveRef": {
											"type": "string"
										},
										"cycleNumber": {
											"type": "string"
										},
										"startedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"outcome": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"pass",
														"fail",
														"aborted"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"operatorUserId": {
											"type": "string"
										},
										"printoutDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"checkEntryId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"uses": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SterilisationCycleUse"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"autoclaveRef",
										"cycleNumber",
										"startedAt",
										"endedAt",
										"outcome",
										"operatorUserId",
										"printoutDocumentId",
										"checkEntryId",
										"createdAt",
										"uses"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice-archive": {
			"get": {
				"summary": "Archive requests, newest first",
				"tags": [
					"Practice archive"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PracticeArchive"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Request a complete archive of the practice's records",
				"tags": [
					"Practice archive"
				],
				"description": "Every table of the practice is written as JSON Lines parts to the practice's clinical bucket in bounded steps, then a manifest and a validation report close the archive. One archive is produced at a time (409 EXPORT_IN_PROGRESS); earlier completed archives stay downloadable.",
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"requested",
												"running",
												"completed",
												"acknowledged",
												"failed",
												"superseded"
											]
										},
										"requestedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"cutoffAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lifecycleGeneration": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lifecycleState": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"active",
														"closing",
														"purging",
														"custodian"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"runningAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"manifest": {},
										"manifestDigest": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"exportDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completenessProof": {},
										"acknowledgedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"acknowledgedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"failedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"failedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cursor": {},
										"leaseToken": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseExpiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"generation",
										"status",
										"requestedAt",
										"cutoffAt",
										"lifecycleGeneration",
										"lifecycleState",
										"runningAt",
										"completedAt",
										"manifest",
										"manifestDigest",
										"exportDocumentId",
										"completenessProof",
										"acknowledgedById",
										"acknowledgedAt",
										"failedAt",
										"failedReason",
										"supersededAt",
										"cursor",
										"leaseToken",
										"leaseExpiresAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice-archive/{id}/acknowledge": {
			"post": {
				"summary": "Acknowledge a completed archive as the closure record",
				"tags": [
					"Practice archive"
				],
				"description": "Only an archive whose validation report is complete and that was requested and completed in the same `closing` lifecycle generation is acknowledged (409 EXPORT_NOT_CONSISTENT otherwise); an archive produced while the practice was active stays a downloadable snapshot.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"requested",
												"running",
												"completed",
												"acknowledged",
												"failed",
												"superseded"
											]
										},
										"requestedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"cutoffAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lifecycleGeneration": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lifecycleState": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"active",
														"closing",
														"purging",
														"custodian"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"runningAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"manifest": {},
										"manifestDigest": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"exportDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completenessProof": {},
										"acknowledgedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"acknowledgedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"failedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"failedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cursor": {},
										"leaseToken": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseExpiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"generation",
										"status",
										"requestedAt",
										"cutoffAt",
										"lifecycleGeneration",
										"lifecycleState",
										"runningAt",
										"completedAt",
										"manifest",
										"manifestDigest",
										"exportDocumentId",
										"completenessProof",
										"acknowledgedById",
										"acknowledgedAt",
										"failedAt",
										"failedReason",
										"supersededAt",
										"cursor",
										"leaseToken",
										"leaseExpiresAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice-archive/{id}/run": {
			"post": {
				"summary": "Run one bounded step of a requested archive",
				"tags": [
					"Practice archive"
				],
				"description": "The archive is produced by the practice's own page: each call writes a few parts under a short lease and returns the archive as it stands. Call again while it is requested or running; a closed page pauses the archive at its cursor and a later call resumes it. A step whose lease was taken over by another page stops without writing (409 EXPORT_LEASE_LOST is logged, the archive is returned as the new holder left it).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"generation": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"status": {
											"type": "string",
											"enum": [
												"requested",
												"running",
												"completed",
												"acknowledged",
												"failed",
												"superseded"
											]
										},
										"requestedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"cutoffAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"lifecycleGeneration": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"lifecycleState": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"active",
														"closing",
														"purging",
														"custodian"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"runningAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"completedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"manifest": {},
										"manifestDigest": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"exportDocumentId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"completenessProof": {},
										"acknowledgedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"acknowledgedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"failedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"failedReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"supersededAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cursor": {},
										"leaseToken": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"leaseExpiresAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdByName": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"generation",
										"status",
										"requestedAt",
										"cutoffAt",
										"lifecycleGeneration",
										"lifecycleState",
										"runningAt",
										"completedAt",
										"manifest",
										"manifestDigest",
										"exportDocumentId",
										"completenessProof",
										"acknowledgedById",
										"acknowledgedAt",
										"failedAt",
										"failedReason",
										"supersededAt",
										"cursor",
										"leaseToken",
										"leaseExpiresAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice-archive/{id}/documents/{documentId}/link": {
			"get": {
				"summary": "A one-minute download link for one part, one index part, the manifest, or one original document the archive lists",
				"tags": [
					"Practice archive"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					{
						"name": "documentId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"path": {
											"type": "string"
										},
										"expiresAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"path",
										"expiresAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/sistema-ts": {
			"get": {
				"summary": "The Sistema TS connection",
				"tags": [
					"Sistema TS"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"connection": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/StsConnection"
												},
												{
													"type": "null"
												}
											]
										},
										"vatNumber": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"connection",
										"vatNumber"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Connect, or replace the credentials of, Sistema TS",
				"tags": [
					"Sistema TS"
				],
				"description": "The username, password and pincode are encrypted at rest and never returned; replacing them starts a new credential generation, so a document claimed under the old one parks and replays.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"environment": {
										"type": "string",
										"enum": [
											"test",
											"production"
										]
									},
									"username": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"password": {
										"type": "string",
										"minLength": 1,
										"maxLength": 128
									},
									"pincode": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"cfProprietario": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[A-Z0-9]{11,16}$"
											},
											{
												"type": "null"
											}
										]
									},
									"codiceRegione": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[A-Z0-9]{3}$"
											},
											{
												"type": "null"
											}
										]
									},
									"codiceAsl": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[A-Z0-9]{3}$"
											},
											{
												"type": "null"
											}
										]
									},
									"codiceSsa": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[A-Z0-9]{5,6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"dispositivo": {
										"default": 1,
										"type": "integer",
										"minimum": 1,
										"maximum": 999
									}
								},
								"required": [
									"environment",
									"username",
									"password",
									"pincode",
									"cfProprietario",
									"codiceRegione",
									"codiceAsl",
									"codiceSsa"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"environment": {
											"type": "string",
											"enum": [
												"test",
												"production"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"error",
												"disconnected"
											]
										},
										"credentialGeneration": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"cfProprietario": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codiceRegione": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codiceAsl": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codiceSsa": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"dispositivo": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"lastSyncAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"environment",
										"status",
										"credentialGeneration",
										"cfProprietario",
										"codiceRegione",
										"codiceAsl",
										"codiceSsa",
										"dispositivo",
										"lastSyncAt",
										"lastError",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Disconnect Sistema TS",
				"tags": [
					"Sistema TS"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"environment": {
											"type": "string",
											"enum": [
												"test",
												"production"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"error",
												"disconnected"
											]
										},
										"credentialGeneration": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"cfProprietario": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codiceRegione": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codiceAsl": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"codiceSsa": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"dispositivo": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"lastSyncAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"lastError": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"environment",
										"status",
										"credentialGeneration",
										"cfProprietario",
										"codiceRegione",
										"codiceAsl",
										"codiceSsa",
										"dispositivo",
										"lastSyncAt",
										"lastError",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/sistema-ts/run": {
			"post": {
				"summary": "Build the submissions the practice owes right now",
				"tags": [
					"Sistema TS"
				],
				"description": "The same pass the nightly producer makes: every paid Italian invoice Sistema TS has not acquired becomes a submission the delivery lane carries within the minute.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"produced": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"produced"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/sistema-ts/submissions": {
			"get": {
				"summary": "Documents reported to Sistema TS, newest first",
				"tags": [
					"Sistema TS"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/StsSubmission"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/worklists/{kind}": {
			"get": {
				"summary": "One worklist",
				"tags": [
					"pms"
				],
				"description": "A derived list of work that needs doing — recalls due, unbooked treatment, unsigned notes, unpaid balances, lab cases back from the lab, referrals awaiting an outcome or insurance claims sent with no acknowledgement — one page at a time with a cursor to continue; nothing is stored.",
				"parameters": [
					{
						"name": "kind",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"recalls-due",
								"unbooked-treatment",
								"unsigned-notes",
								"unpaid-balances",
								"lab-returns",
								"referral-outcomes",
								"unacknowledged-claims"
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "locationId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"kind": {
											"type": "string",
											"enum": [
												"recalls-due",
												"unbooked-treatment",
												"unsigned-notes",
												"unpaid-balances",
												"lab-returns",
												"referral-outcomes",
												"unacknowledged-claims"
											]
										},
										"asOf": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"currency": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"EUR",
														"GBP",
														"USD"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WorklistItem"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"kind",
										"asOf",
										"currency",
										"items",
										"nextCursor"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/rota/absences": {
			"get": {
				"summary": "Absences in a window",
				"tags": [
					"scheduling"
				],
				"description": "Every absence of every member of staff overlapping the window — every upcoming one when no bound is given, the past with `to` alone; `mine=true` narrows to the caller's own.",
				"parameters": [
					{
						"name": "from",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "to",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"format": "date",
							"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"requested",
								"approved",
								"declined",
								"cancelled"
							]
						}
					},
					{
						"name": "mine",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"true"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ScheduleAbsenceListItem"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Request time off",
				"tags": [
					"scheduling"
				],
				"description": "Anyone requests their own; a manager requests on someone's behalf, and a manager's request is approved at once.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"ownerType": {
										"type": "string",
										"enum": [
											"member",
											"practitioner"
										]
									},
									"practitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"userId": {
										"type": "string"
									},
									"kind": {
										"type": "string",
										"enum": [
											"holiday",
											"sick",
											"training",
											"other"
										]
									},
									"startsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"endsAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"startsAt",
									"endsAt"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"ownerType": {
											"type": "string",
											"enum": [
												"member",
												"practitioner"
											]
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"holiday",
												"sick",
												"training",
												"other"
											]
										},
										"startsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"status": {
											"type": "string",
											"enum": [
												"requested",
												"approved",
												"declined",
												"cancelled"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"requestedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"decisionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"ownerType",
										"userId",
										"practitionerId",
										"kind",
										"startsAt",
										"endsAt",
										"status",
										"note",
										"requestedById",
										"decidedById",
										"decidedAt",
										"decisionNote",
										"cancelledAt",
										"cancelledById",
										"cancelReason",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/rota/absences/{id}/approve": {
			"post": {
				"summary": "Approve a request",
				"tags": [
					"scheduling"
				],
				"description": "Owners and managers; the approved absence leaves online booking.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"decisionNote": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"ownerType": {
											"type": "string",
											"enum": [
												"member",
												"practitioner"
											]
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"holiday",
												"sick",
												"training",
												"other"
											]
										},
										"startsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"status": {
											"type": "string",
											"enum": [
												"requested",
												"approved",
												"declined",
												"cancelled"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"requestedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"decisionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"ownerType",
										"userId",
										"practitionerId",
										"kind",
										"startsAt",
										"endsAt",
										"status",
										"note",
										"requestedById",
										"decidedById",
										"decidedAt",
										"decisionNote",
										"cancelledAt",
										"cancelledById",
										"cancelReason",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/rota/absences/{id}/decline": {
			"post": {
				"summary": "Decline a request",
				"tags": [
					"scheduling"
				],
				"description": "Owners and managers, with a note for the requester.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"decisionNote": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"ownerType": {
											"type": "string",
											"enum": [
												"member",
												"practitioner"
											]
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"holiday",
												"sick",
												"training",
												"other"
											]
										},
										"startsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"status": {
											"type": "string",
											"enum": [
												"requested",
												"approved",
												"declined",
												"cancelled"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"requestedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"decisionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"ownerType",
										"userId",
										"practitionerId",
										"kind",
										"startsAt",
										"endsAt",
										"status",
										"note",
										"requestedById",
										"decidedById",
										"decidedAt",
										"decisionNote",
										"cancelledAt",
										"cancelledById",
										"cancelReason",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/rota/absences/{id}/cancel": {
			"post": {
				"summary": "Cancel an absence",
				"tags": [
					"scheduling"
				],
				"description": "The requester or a manager, with the reason kept as evidence; an approved absence that is cancelled returns to online booking.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"reason"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
											"description": "Canonical lowercase UUID organization identifier"
										},
										"ownerType": {
											"type": "string",
											"enum": [
												"member",
												"practitioner"
											]
										},
										"userId": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"practitionerId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"holiday",
												"sick",
												"training",
												"other"
											]
										},
										"startsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"endsAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"status": {
											"type": "string",
											"enum": [
												"requested",
												"approved",
												"declined",
												"cancelled"
											]
										},
										"note": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"requestedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"decidedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"decisionNote": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelledById": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"cancelReason": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"organizationId",
										"ownerType",
										"userId",
										"practitionerId",
										"kind",
										"startsAt",
										"endsAt",
										"status",
										"note",
										"requestedById",
										"decidedById",
										"decidedAt",
										"decisionNote",
										"cancelledAt",
										"cancelledById",
										"cancelReason",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/schedules/members/{userId}/{locationId}": {
			"get": {
				"summary": "Get a staff member's rota",
				"tags": [
					"scheduling"
				],
				"description": "The working pattern of a non-clinical member of staff at one location; feeds nothing bookable, only the rota and time off.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "locationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PractitionerSchedule"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Replace a staff member's rota",
				"tags": [
					"scheduling"
				],
				"description": "Whole-write, as the practitioner rota.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "locationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"timezone": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									},
									"rules": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"default": "working",
													"type": "string",
													"enum": [
														"working",
														"break",
														"block"
													]
												},
												"label": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 200
														},
														{
															"type": "null"
														}
													]
												},
												"days": {
													"default": [],
													"maxItems": 7,
													"type": "array",
													"items": {
														"type": "integer",
														"minimum": 0,
														"maximum": 6
													}
												},
												"startTime": {
													"type": "string",
													"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
												},
												"endTime": {
													"type": "string",
													"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
												},
												"date": {
													"anyOf": [
														{
															"type": "string",
															"format": "date",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"startTime",
												"endTime"
											]
										}
									}
								},
								"required": [
									"expectedVersion",
									"rules"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PractitionerSchedule"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		}
	},
	"components": {
		"schemas": {
			"ApiError": {
				"type": "object",
				"properties": {
					"error": {
						"type": "string"
					},
					"code": {
						"type": "string"
					},
					"details": {}
				},
				"required": [
					"error"
				],
				"additionalProperties": false
			},
			"Patient": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"enquiry",
							"lead",
							"patient",
							"inactive",
							"archived",
							"deceased"
						]
					},
					"title": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"chartNumber": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityRuleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityRuleKind": {
						"type": "string"
					},
					"dateOfBirth": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"gender": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"male",
									"female",
									"other",
									"unknown"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"fiscalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"stsOpposition": {
						"type": "boolean"
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneOther": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine2": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"province": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"country": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"language": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"preferredContactMethod": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"phone",
									"sms",
									"email",
									"whatsapp"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"preferredContactTime": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"smsOptOut": {
						"type": "boolean"
					},
					"emailOptOut": {
						"type": "boolean"
					},
					"whatsappOptOut": {
						"type": "boolean"
					},
					"phoneOptOut": {
						"type": "boolean"
					},
					"consentSource": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"consentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"leadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"referrerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"referredByPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"mergedIntoPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"medicalAlert": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultPriceListId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"dentistPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"hygienistPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"customFields": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"status",
					"title",
					"firstName",
					"lastName",
					"preferredName",
					"chartNumber",
					"ethnicityCode",
					"ethnicityRuleId",
					"ethnicityRuleKind",
					"dateOfBirth",
					"gender",
					"fiscalCode",
					"stsOpposition",
					"email",
					"phoneMobile",
					"phoneOther",
					"addressLine1",
					"addressLine2",
					"city",
					"province",
					"postalCode",
					"country",
					"language",
					"preferredContactMethod",
					"preferredContactTime",
					"smsOptOut",
					"emailOptOut",
					"whatsappOptOut",
					"phoneOptOut",
					"consentSource",
					"consentAt",
					"leadSourceId",
					"referrerId",
					"referredByPatientId",
					"mergedIntoPatientId",
					"medicalAlert",
					"note",
					"defaultPriceListId",
					"dentistPractitionerId",
					"hygienistPractitionerId",
					"customFields",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PatientDetail": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"enquiry",
							"lead",
							"patient",
							"inactive",
							"archived",
							"deceased"
						]
					},
					"title": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"chartNumber": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityRuleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityRuleKind": {
						"type": "string"
					},
					"dateOfBirth": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"gender": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"male",
									"female",
									"other",
									"unknown"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"fiscalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"stsOpposition": {
						"type": "boolean"
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneOther": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine2": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"province": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"country": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"language": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"preferredContactMethod": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"phone",
									"sms",
									"email",
									"whatsapp"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"preferredContactTime": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"smsOptOut": {
						"type": "boolean"
					},
					"emailOptOut": {
						"type": "boolean"
					},
					"whatsappOptOut": {
						"type": "boolean"
					},
					"phoneOptOut": {
						"type": "boolean"
					},
					"consentSource": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"consentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"leadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"referrerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"referredByPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"mergedIntoPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"medicalAlert": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultPriceListId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"dentistPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"hygienistPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"customFields": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"tags": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Tag"
						}
					},
					"timeline": {
						"type": "object",
						"properties": {
							"items": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/Activity"
								}
							},
							"total": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"limit": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"offset": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"items",
							"total",
							"limit",
							"offset"
						],
						"additionalProperties": false
					},
					"journeys": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/JourneyWithEnrollment"
						}
					},
					"touches": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadTouchSummary"
						}
					},
					"pms": {
						"$ref": "#/components/schemas/PatientPmsInfo"
					},
					"deposits": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PatientDisplayDeposit"
						}
					},
					"referral": {
						"$ref": "#/components/schemas/PatientReferralInfo"
					},
					"marketingPreferences": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PatientContactPreference"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"status",
					"title",
					"firstName",
					"lastName",
					"preferredName",
					"chartNumber",
					"ethnicityCode",
					"ethnicityRuleId",
					"ethnicityRuleKind",
					"dateOfBirth",
					"gender",
					"fiscalCode",
					"stsOpposition",
					"email",
					"phoneMobile",
					"phoneOther",
					"addressLine1",
					"addressLine2",
					"city",
					"province",
					"postalCode",
					"country",
					"language",
					"preferredContactMethod",
					"preferredContactTime",
					"smsOptOut",
					"emailOptOut",
					"whatsappOptOut",
					"phoneOptOut",
					"consentSource",
					"consentAt",
					"leadSourceId",
					"referrerId",
					"referredByPatientId",
					"mergedIntoPatientId",
					"medicalAlert",
					"note",
					"defaultPriceListId",
					"dentistPractitionerId",
					"hygienistPractitionerId",
					"customFields",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"tags"
				],
				"additionalProperties": false
			},
			"PatientListItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"enquiry",
							"lead",
							"patient",
							"inactive",
							"archived",
							"deceased"
						]
					},
					"title": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"chartNumber": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityRuleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ethnicityRuleKind": {
						"type": "string"
					},
					"dateOfBirth": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"gender": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"male",
									"female",
									"other",
									"unknown"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"fiscalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"stsOpposition": {
						"type": "boolean"
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneOther": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine2": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"province": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"country": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"language": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"preferredContactMethod": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"phone",
									"sms",
									"email",
									"whatsapp"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"preferredContactTime": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"smsOptOut": {
						"type": "boolean"
					},
					"emailOptOut": {
						"type": "boolean"
					},
					"whatsappOptOut": {
						"type": "boolean"
					},
					"phoneOptOut": {
						"type": "boolean"
					},
					"consentSource": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"consentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"leadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"referrerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"referredByPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"mergedIntoPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"medicalAlert": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultPriceListId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"dentistPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"hygienistPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"customFields": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"tags": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Tag"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"status",
					"title",
					"firstName",
					"lastName",
					"preferredName",
					"chartNumber",
					"ethnicityCode",
					"ethnicityRuleId",
					"ethnicityRuleKind",
					"dateOfBirth",
					"gender",
					"fiscalCode",
					"stsOpposition",
					"email",
					"phoneMobile",
					"phoneOther",
					"addressLine1",
					"addressLine2",
					"city",
					"province",
					"postalCode",
					"country",
					"language",
					"preferredContactMethod",
					"preferredContactTime",
					"smsOptOut",
					"emailOptOut",
					"whatsappOptOut",
					"phoneOptOut",
					"consentSource",
					"consentAt",
					"leadSourceId",
					"referrerId",
					"referredByPatientId",
					"mergedIntoPatientId",
					"medicalAlert",
					"note",
					"defaultPriceListId",
					"dentistPractitionerId",
					"hygienistPractitionerId",
					"customFields",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SavedView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"entity": {
						"type": "string",
						"enum": [
							"patients",
							"conversations"
						]
					},
					"ownerId": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string"
					},
					"shared": {
						"type": "boolean"
					},
					"filters": {},
					"columns": {},
					"sort": {
						"type": "string"
					},
					"direction": {
						"type": "string"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"entity",
					"ownerId",
					"name",
					"shared",
					"filters",
					"columns",
					"sort",
					"direction",
					"position",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Activity": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"taskId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"messageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"conversationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"type": {
						"type": "string",
						"enum": [
							"note",
							"call",
							"sms",
							"email",
							"whatsapp",
							"webchat",
							"messenger",
							"instagram",
							"form_submission",
							"stage_change",
							"status_change",
							"task_event",
							"appointment_event",
							"pms_event",
							"system",
							"telegram",
							"tiktok",
							"facebook_comments",
							"instagram_comments"
						]
					},
					"direction": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"inbound",
									"outbound"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"actorSource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"actorUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"actorName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"title": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"body": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"messagePreview": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"properties": {},
					"happensAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"deletedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"journeyId",
					"appointmentId",
					"taskId",
					"messageId",
					"conversationId",
					"type",
					"direction",
					"actorSource",
					"actorUserId",
					"actorName",
					"title",
					"body",
					"messagePreview",
					"properties",
					"happensAt",
					"createdAt",
					"deletedAt"
				],
				"additionalProperties": false
			},
			"Journey": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"treatmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"pipelineId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"stageId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"stageCategory": {
						"type": "string",
						"enum": [
							"open",
							"won"
						]
					},
					"lastOpenStageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"won",
							"lost"
						]
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"lostReasonId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lostNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"junkMarkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"ownerId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"potentialValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"confirmedValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"snoozedUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstContactAttemptedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstContactMadeAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"aiHandledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"aiHandledSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"rule",
									"user"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"aiReleasedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"enteredStageAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"closedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstTouchId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastTouchId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"paid_search",
									"paid_social",
									"organic_search",
									"social",
									"referral_website",
									"referral_friend",
									"referral_practice",
									"existing_patient",
									"email",
									"chat",
									"direct",
									"phone",
									"walk_in",
									"print",
									"other",
									"unknown",
									"ai",
									"paid_ai"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"customFields": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"patientId",
					"treatmentId",
					"pipelineId",
					"stageId",
					"stageCategory",
					"lastOpenStageId",
					"status",
					"version",
					"lostReasonId",
					"lostNote",
					"junkMarkedAt",
					"ownerId",
					"practitionerId",
					"potentialValueCents",
					"confirmedValueCents",
					"currency",
					"snoozedUntil",
					"firstContactAttemptedAt",
					"firstContactMadeAt",
					"aiHandledAt",
					"aiHandledSource",
					"aiReleasedAt",
					"enteredStageAt",
					"position",
					"closedAt",
					"firstTouchId",
					"lastTouchId",
					"channel",
					"customFields",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"JourneyPatientSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string"
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"firstName",
					"lastName",
					"preferredName",
					"status",
					"email",
					"phoneMobile"
				],
				"additionalProperties": false
			},
			"JourneyWithPatient": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"treatmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"pipelineId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"stageId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"stageCategory": {
						"type": "string",
						"enum": [
							"open",
							"won"
						]
					},
					"lastOpenStageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"won",
							"lost"
						]
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"lostReasonId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lostNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"junkMarkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"ownerId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"potentialValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"confirmedValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"snoozedUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstContactAttemptedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstContactMadeAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"aiHandledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"aiHandledSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"rule",
									"user"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"aiReleasedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"enteredStageAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"closedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstTouchId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastTouchId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"paid_search",
									"paid_social",
									"organic_search",
									"social",
									"referral_website",
									"referral_friend",
									"referral_practice",
									"existing_patient",
									"email",
									"chat",
									"direct",
									"phone",
									"walk_in",
									"print",
									"other",
									"unknown",
									"ai",
									"paid_ai"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"customFields": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"patient": {
						"$ref": "#/components/schemas/JourneyPatientSummary"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"patientId",
					"treatmentId",
					"pipelineId",
					"stageId",
					"stageCategory",
					"lastOpenStageId",
					"status",
					"version",
					"lostReasonId",
					"lostNote",
					"junkMarkedAt",
					"ownerId",
					"practitionerId",
					"potentialValueCents",
					"confirmedValueCents",
					"currency",
					"snoozedUntil",
					"firstContactAttemptedAt",
					"firstContactMadeAt",
					"aiHandledAt",
					"aiHandledSource",
					"aiReleasedAt",
					"enteredStageAt",
					"position",
					"closedAt",
					"firstTouchId",
					"lastTouchId",
					"channel",
					"customFields",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Pipeline": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"isDefault": {
						"type": "boolean"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"isDefault",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PipelineStage": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"pipelineId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"category": {
						"type": "string",
						"enum": [
							"open",
							"won"
						]
					},
					"isEntry": {
						"type": "boolean"
					},
					"systemKey": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"probability": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"rottenDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"color": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"pipelineId",
					"name",
					"category",
					"isEntry",
					"systemKey",
					"probability",
					"rottenDays",
					"color",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PipelineWithStages": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"isDefault": {
						"type": "boolean"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"stages": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PipelineStage"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"isDefault",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"stages"
				],
				"additionalProperties": false
			},
			"Task": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"assigneeId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string"
					},
					"title": {
						"type": "string"
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"dueAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"priority": {
						"type": "string",
						"enum": [
							"normal",
							"urgent"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"done",
							"cancelled"
						]
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"outcome": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"considering",
									"callback_later",
									"booked",
									"no_answer",
									"message_sent",
									"not_proceeding",
									"attended",
									"no_show",
									"stage_moved"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"patientId",
					"journeyId",
					"assigneeId",
					"kind",
					"title",
					"note",
					"dueAt",
					"priority",
					"status",
					"version",
					"outcome",
					"completedAt",
					"completedById",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"TaskOutcomeReceipt": {
				"type": "object",
				"properties": {
					"task": {
						"$ref": "#/components/schemas/Task"
					},
					"journey": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/Journey"
							},
							{
								"type": "null"
							}
						]
					},
					"undo": {
						"type": "object",
						"properties": {
							"expiresAt": {
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							"followUpTaskId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"stageMoved": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"fromStageId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"toStageId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											}
										},
										"required": [
											"fromStageId",
											"toStageId"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							},
							"stamped": {
								"type": "object",
								"properties": {
									"attempted": {
										"type": "boolean"
									},
									"made": {
										"type": "boolean"
									}
								},
								"required": [
									"attempted",
									"made"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"expiresAt",
							"followUpTaskId",
							"stageMoved",
							"stamped"
						],
						"additionalProperties": false
					},
					"booking": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"appointmentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"status": {
										"type": "string",
										"enum": [
											"pending",
											"booked",
											"confirmed",
											"arrived",
											"in_chair",
											"fulfilled",
											"cancelled",
											"no_show"
										]
									}
								},
								"required": [
									"appointmentId",
									"status"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"task",
					"journey",
					"undo",
					"booking"
				],
				"additionalProperties": false
			},
			"UndoTaskOutcome": {
				"type": "object",
				"properties": {
					"task": {
						"$ref": "#/components/schemas/Task"
					},
					"journey": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/Journey"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"task",
					"journey"
				],
				"additionalProperties": false
			},
			"TodayPatientSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"enquiry",
							"lead",
							"patient",
							"inactive",
							"archived",
							"deceased"
						]
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"leadSourceName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"unread": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"firstName",
					"lastName",
					"preferredName",
					"status",
					"email",
					"phoneMobile",
					"createdAt",
					"leadSourceName",
					"unread"
				],
				"additionalProperties": false
			},
			"TodayJourneySummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"won",
							"lost"
						]
					},
					"stageId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"stageName": {
						"type": "string"
					},
					"treatmentName": {
						"type": "string"
					},
					"potentialValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"snoozedUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"enteredStageAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"paid_search",
									"paid_social",
									"organic_search",
									"social",
									"referral_website",
									"referral_friend",
									"referral_practice",
									"existing_patient",
									"email",
									"chat",
									"direct",
									"phone",
									"walk_in",
									"print",
									"other",
									"unknown",
									"ai",
									"paid_ai"
								]
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"version",
					"status",
					"stageId",
					"stageName",
					"treatmentName",
					"potentialValueCents",
					"snoozedUntil",
					"enteredStageAt",
					"channel"
				],
				"additionalProperties": false
			},
			"TodayTaskRow": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"const": "task"
					},
					"task": {
						"$ref": "#/components/schemas/Task"
					},
					"patient": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/TodayPatientSummary"
							},
							{
								"type": "null"
							}
						]
					},
					"journey": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/TodayJourneySummary"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"type",
					"task",
					"patient",
					"journey"
				],
				"additionalProperties": false
			},
			"TodayEnquiryRow": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"const": "enquiry"
					},
					"patient": {
						"$ref": "#/components/schemas/TodayPatientSummary"
					}
				},
				"required": [
					"type",
					"patient"
				],
				"additionalProperties": false
			},
			"TodayQueue": {
				"type": "object",
				"properties": {
					"buckets": {
						"type": "object",
						"properties": {
							"callNow": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/TodayTaskRow"
								}
							},
							"overdue": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/TodayTaskRow"
								}
							},
							"today": {
								"type": "array",
								"items": {
									"oneOf": [
										{
											"$ref": "#/components/schemas/TodayTaskRow"
										},
										{
											"$ref": "#/components/schemas/TodayEnquiryRow"
										}
									]
								}
							},
							"upcoming": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/TodayTaskRow"
								}
							}
						},
						"required": [
							"callNow",
							"overdue",
							"today",
							"upcoming"
						],
						"additionalProperties": false
					},
					"total": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"timezone": {
						"type": "string"
					},
					"serverTime": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"week": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/TodayDayCount"
						}
					},
					"lookups": {
						"type": "object",
						"properties": {
							"dialer": {
								"$ref": "#/components/schemas/DialerBootstrap"
							},
							"entitlements": {
								"$ref": "#/components/schemas/Entitlements"
							},
							"payments": {
								"$ref": "#/components/schemas/PaymentsSummary"
							},
							"members": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/MemberSummary"
								}
							},
							"treatments": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/TreatmentSummary"
								}
							},
							"contactMethods": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ContactMethod"
								}
							},
							"leadSources": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/LeadSource"
								}
							},
							"intakeReview": {
								"type": "object",
								"properties": {
									"items": {
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/IntakeReviewIssue"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"reasonTotals": {
										"type": "object",
										"properties": {
											"archived_location": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"archived_treatment": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"archived_lead_source": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"invalid_optional_reference": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"intake_receipt_stalled": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"contact_value_unparsed": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"archived_location",
											"archived_treatment",
											"archived_lead_source",
											"invalid_optional_reference",
											"intake_receipt_stalled",
											"contact_value_unparsed"
										],
										"additionalProperties": false
									}
								},
								"required": [
									"items",
									"nextCursor",
									"reasonTotals"
								],
								"additionalProperties": false
							},
							"ingestReview": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"openTotal": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"openTotal"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							},
							"missedCalls": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"unreturned": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"unreturned"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							},
							"lostReasons": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/LostReason"
								}
							}
						},
						"required": [
							"dialer",
							"entitlements",
							"payments",
							"members",
							"treatments",
							"contactMethods",
							"leadSources",
							"intakeReview",
							"ingestReview",
							"missedCalls",
							"lostReasons"
						],
						"additionalProperties": false
					},
					"selectedDate": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					}
				},
				"required": [
					"buckets",
					"total",
					"timezone",
					"serverTime",
					"week",
					"selectedDate"
				],
				"additionalProperties": false
			},
			"CalendarDay": {
				"type": "object",
				"properties": {
					"date": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"newLeads": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"contactedLeads": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"revenueWonCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"journeysWon": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"journeysLost": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"appointments": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"tasksDue": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"date",
					"newLeads",
					"contactedLeads",
					"revenueWonCents",
					"journeysWon",
					"journeysLost",
					"appointments",
					"tasksDue"
				],
				"additionalProperties": false
			},
			"CalendarOverview": {
				"type": "object",
				"properties": {
					"timezone": {
						"type": "string"
					},
					"month": {
						"type": "string"
					},
					"from": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"to": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"days": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CalendarDay"
						}
					}
				},
				"required": [
					"timezone",
					"month",
					"from",
					"to",
					"days"
				],
				"additionalProperties": false
			},
			"CalendarLeadItem": {
				"type": "object",
				"properties": {
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"leadSourceName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"patientId",
					"firstName",
					"lastName",
					"preferredName",
					"leadSourceName",
					"createdAt"
				],
				"additionalProperties": false
			},
			"CalendarContactItem": {
				"type": "object",
				"properties": {
					"activityId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"note",
							"call",
							"sms",
							"email",
							"whatsapp",
							"webchat",
							"messenger",
							"instagram",
							"form_submission",
							"stage_change",
							"status_change",
							"task_event",
							"appointment_event",
							"pms_event",
							"system",
							"telegram",
							"tiktok",
							"facebook_comments",
							"instagram_comments"
						]
					},
					"direction": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"inbound",
									"outbound"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"contactMethodLabel": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"happensAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"activityId",
					"patientId",
					"firstName",
					"lastName",
					"preferredName",
					"kind",
					"direction",
					"contactMethodLabel",
					"happensAt"
				],
				"additionalProperties": false
			},
			"CalendarAppointmentItem": {
				"type": "object",
				"properties": {
					"appointmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentTypeName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"booked",
							"confirmed",
							"arrived",
							"in_chair",
							"fulfilled",
							"cancelled",
							"no_show"
						]
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"appointmentId",
					"patientId",
					"firstName",
					"lastName",
					"preferredName",
					"appointmentTypeName",
					"treatmentName",
					"status",
					"startsAt",
					"endsAt"
				],
				"additionalProperties": false
			},
			"CalendarJourneyItem": {
				"type": "object",
				"properties": {
					"journeyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentName": {
						"type": "string"
					},
					"valueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"won",
							"lost"
						]
					},
					"closedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"journeyId",
					"patientId",
					"firstName",
					"lastName",
					"preferredName",
					"treatmentName",
					"valueCents",
					"status",
					"closedAt"
				],
				"additionalProperties": false
			},
			"CalendarTaskItem": {
				"type": "object",
				"properties": {
					"taskId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"title": {
						"type": "string"
					},
					"kind": {
						"type": "string"
					},
					"priority": {
						"type": "string",
						"enum": [
							"normal",
							"urgent"
						]
					},
					"dueAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"taskId",
					"patientId",
					"firstName",
					"lastName",
					"preferredName",
					"title",
					"kind",
					"priority",
					"dueAt"
				],
				"additionalProperties": false
			},
			"CalendarStats": {
				"type": "object",
				"properties": {
					"newLeads": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"contactedLeads": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"revenueWonCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"journeysWon": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"journeysLost": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"appointments": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"tasksDue": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"newLeads",
					"contactedLeads",
					"revenueWonCents",
					"journeysWon",
					"journeysLost",
					"appointments",
					"tasksDue"
				],
				"additionalProperties": false
			},
			"CalendarDetail": {
				"type": "object",
				"properties": {
					"from": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"to": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"timezone": {
						"type": "string"
					},
					"stats": {
						"$ref": "#/components/schemas/CalendarStats"
					},
					"newLeads": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CalendarLeadItem"
						}
					},
					"contacts": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CalendarContactItem"
						}
					},
					"appointments": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CalendarAppointmentItem"
						}
					},
					"journeysWon": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CalendarJourneyItem"
						}
					},
					"journeysLost": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CalendarJourneyItem"
						}
					},
					"tasksDue": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CalendarTaskItem"
						}
					},
					"truncated": {
						"type": "boolean"
					}
				},
				"required": [
					"from",
					"to",
					"timezone",
					"stats",
					"newLeads",
					"contacts",
					"appointments",
					"journeysWon",
					"journeysLost",
					"tasksDue",
					"truncated"
				],
				"additionalProperties": false
			},
			"ReportKpi": {
				"type": "object",
				"properties": {
					"key": {
						"type": "string"
					},
					"label": {
						"type": "string"
					},
					"format": {
						"type": "string",
						"enum": [
							"number",
							"cents",
							"percent",
							"durationMs",
							"multiple"
						]
					},
					"value": {
						"anyOf": [
							{
								"type": "number"
							},
							{
								"type": "null"
							}
						]
					},
					"previousValue": {
						"anyOf": [
							{
								"type": "number"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"key",
					"label",
					"format",
					"value",
					"previousValue"
				],
				"additionalProperties": false
			},
			"ReportSeries": {
				"type": "object",
				"properties": {
					"key": {
						"type": "string"
					},
					"label": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"timeseries",
							"categorical",
							"matrix"
						]
					},
					"format": {
						"type": "string",
						"enum": [
							"number",
							"cents",
							"percent",
							"durationMs",
							"multiple"
						]
					},
					"grain": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"day",
									"week",
									"month"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"stacks": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"key": {
									"type": "string"
								},
								"label": {
									"type": "string"
								}
							},
							"required": [
								"key",
								"label"
							],
							"additionalProperties": false
						}
					},
					"points": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"bucket": {
									"type": "string"
								},
								"values": {
									"type": "object",
									"propertyNames": {
										"type": "string"
									},
									"additionalProperties": {
										"type": "number"
									}
								}
							},
							"required": [
								"bucket",
								"values"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"key",
					"label",
					"kind",
					"format",
					"grain",
					"stacks",
					"points"
				],
				"additionalProperties": false
			},
			"ReportTable": {
				"type": "object",
				"properties": {
					"key": {
						"type": "string"
					},
					"label": {
						"type": "string"
					},
					"columns": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"key": {
									"type": "string"
								},
								"label": {
									"type": "string"
								},
								"format": {
									"type": "string",
									"enum": [
										"text",
										"number",
										"cents",
										"percent",
										"durationMs",
										"multiple"
									]
								}
							},
							"required": [
								"key",
								"label",
								"format"
							],
							"additionalProperties": false
						}
					},
					"rows": {
						"type": "array",
						"items": {
							"type": "object",
							"propertyNames": {
								"type": "string"
							},
							"additionalProperties": {
								"anyOf": [
									{
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "number"
											}
										]
									},
									{
										"type": "null"
									}
								]
							}
						}
					}
				},
				"required": [
					"key",
					"label",
					"columns",
					"rows"
				],
				"additionalProperties": false
			},
			"ReportFlow": {
				"type": "object",
				"properties": {
					"key": {
						"type": "string"
					},
					"label": {
						"type": "string"
					},
					"stages": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"key": {
									"type": "string",
									"enum": [
										"channel",
										"source",
										"campaign",
										"contactedBy",
										"owner",
										"treatment",
										"location",
										"stage",
										"outcome"
									]
								},
								"label": {
									"type": "string"
								}
							},
							"required": [
								"key",
								"label"
							],
							"additionalProperties": false
						}
					},
					"nodes": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string"
								},
								"stage": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"key": {
									"type": "string"
								},
								"label": {
									"type": "string"
								},
								"value": {
									"type": "number"
								},
								"meta": {
									"type": "object",
									"properties": {
										"image": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										},
										"channel": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"value",
												"null",
												"other"
											]
										}
									},
									"additionalProperties": false
								}
							},
							"required": [
								"id",
								"stage",
								"key",
								"label",
								"value"
							],
							"additionalProperties": false
						}
					},
					"links": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"source": {
									"type": "string"
								},
								"target": {
									"type": "string"
								},
								"value": {
									"type": "number"
								}
							},
							"required": [
								"source",
								"target",
								"value"
							],
							"additionalProperties": false
						}
					},
					"crossLinks": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"source": {
									"type": "string"
								},
								"target": {
									"type": "string"
								},
								"value": {
									"type": "number"
								}
							},
							"required": [
								"source",
								"target",
								"value"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"key",
					"label",
					"stages",
					"nodes",
					"links",
					"crossLinks"
				],
				"additionalProperties": false
			},
			"ReportResponse": {
				"type": "object",
				"properties": {
					"report": {
						"type": "string",
						"enum": [
							"dashboard",
							"snapshot",
							"lead-volume",
							"lead-sources",
							"lead-attribution",
							"calls",
							"funnel",
							"conversion-summary",
							"speed-to-lead",
							"lost-journeys",
							"revenue-summary",
							"revenue-by-treatment",
							"pipeline-value",
							"patient-value",
							"patient-retention",
							"appointment-volume",
							"attendance",
							"team-activity",
							"team-conversion",
							"practitioner-performance",
							"referral-program",
							"lead-flow",
							"seo-weekly-digest",
							"ads-weekly-digest",
							"day-sheet",
							"aged-debt",
							"production",
							"collections",
							"associate-pay",
							"utilisation"
						]
					},
					"timezone": {
						"type": "string"
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"range": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"from": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"to": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									}
								},
								"required": [
									"from",
									"to"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"previousRange": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"from": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"to": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									}
								},
								"required": [
									"from",
									"to"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"grain": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"day",
									"week",
									"month"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"kpis": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReportKpi"
						}
					},
					"series": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReportSeries"
						}
					},
					"tables": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReportTable"
						}
					},
					"flows": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReportFlow"
						}
					}
				},
				"required": [
					"report",
					"timezone",
					"currency",
					"range",
					"previousRange",
					"grain",
					"kpis",
					"series",
					"tables",
					"flows"
				],
				"additionalProperties": false
			},
			"ReportSubscriptionSchedule": {
				"oneOf": [
					{
						"type": "object",
						"properties": {
							"cadence": {
								"type": "string",
								"const": "daily"
							},
							"localHour": {
								"type": "integer",
								"minimum": 0,
								"maximum": 23
							}
						},
						"required": [
							"cadence",
							"localHour"
						],
						"additionalProperties": false
					},
					{
						"type": "object",
						"properties": {
							"cadence": {
								"type": "string",
								"const": "weekly"
							},
							"localHour": {
								"type": "integer",
								"minimum": 0,
								"maximum": 23
							},
							"dayOfWeek": {
								"type": "integer",
								"minimum": 0,
								"maximum": 6
							}
						},
						"required": [
							"cadence",
							"localHour",
							"dayOfWeek"
						],
						"additionalProperties": false
					},
					{
						"type": "object",
						"properties": {
							"cadence": {
								"type": "string",
								"const": "monthly"
							},
							"localHour": {
								"type": "integer",
								"minimum": 0,
								"maximum": 23
							},
							"dayOfMonth": {
								"type": "integer",
								"minimum": 1,
								"maximum": 28
							}
						},
						"required": [
							"cadence",
							"localHour",
							"dayOfMonth"
						],
						"additionalProperties": false
					}
				]
			},
			"ReportSubscription": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"report": {
						"type": "string",
						"enum": [
							"dashboard",
							"snapshot",
							"lead-volume",
							"lead-sources",
							"lead-attribution",
							"calls",
							"funnel",
							"conversion-summary",
							"speed-to-lead",
							"lost-journeys",
							"revenue-summary",
							"revenue-by-treatment",
							"pipeline-value",
							"patient-value",
							"patient-retention",
							"appointment-volume",
							"attendance",
							"team-activity",
							"team-conversion",
							"practitioner-performance",
							"referral-program",
							"lead-flow",
							"seo-weekly-digest",
							"ads-weekly-digest",
							"day-sheet",
							"aged-debt",
							"production",
							"collections",
							"associate-pay",
							"utilisation"
						]
					},
					"filters": {
						"type": "object",
						"properties": {
							"date": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"from": {
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											"to": {
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											}
										},
										"additionalProperties": false
									},
									{
										"type": "object",
										"properties": {
											"preset": {
												"type": "string",
												"enum": [
													"today",
													"yesterday",
													"thisWeek",
													"lastWeek",
													"thisMonth",
													"lastMonth",
													"last7days",
													"last30days",
													"last90days",
													"last12months",
													"last24months",
													"thisYear"
												]
											}
										},
										"required": [
											"preset"
										],
										"additionalProperties": false
									}
								]
							},
							"pipelineId": {
								"type": "object",
								"properties": {
									"in": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"present": {
										"type": "boolean"
									}
								},
								"additionalProperties": false
							},
							"treatmentId": {
								"type": "object",
								"properties": {
									"in": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"present": {
										"type": "boolean"
									}
								},
								"additionalProperties": false
							},
							"channel": {
								"type": "object",
								"properties": {
									"in": {
										"minItems": 1,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"paid_search",
												"paid_social",
												"organic_search",
												"social",
												"referral_website",
												"referral_friend",
												"referral_practice",
												"existing_patient",
												"email",
												"chat",
												"direct",
												"phone",
												"walk_in",
												"print",
												"other",
												"unknown",
												"ai",
												"paid_ai"
											]
										}
									}
								},
								"required": [
									"in"
								],
								"additionalProperties": false
							},
							"leadSourceId": {
								"type": "object",
								"properties": {
									"in": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"present": {
										"type": "boolean"
									}
								},
								"additionalProperties": false
							},
							"locationId": {
								"type": "object",
								"properties": {
									"in": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"present": {
										"type": "boolean"
									}
								},
								"additionalProperties": false
							},
							"ownerId": {
								"type": "object",
								"properties": {
									"in": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1
										}
									},
									"present": {
										"type": "boolean"
									}
								},
								"additionalProperties": false
							},
							"practitionerId": {
								"type": "object",
								"properties": {
									"in": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										}
									},
									"present": {
										"type": "boolean"
									}
								},
								"additionalProperties": false
							}
						},
						"additionalProperties": false
					},
					"grain": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"day",
									"week",
									"month"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"recipient": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"minLength": 1
									},
									"name": {
										"type": "string"
									},
									"email": {
										"type": "string",
										"format": "email",
										"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
									}
								},
								"required": [
									"id",
									"name",
									"email"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"timezone": {
						"type": "string"
					},
					"schedule": {
						"$ref": "#/components/schemas/ReportSubscriptionSchedule"
					},
					"enabled": {
						"type": "boolean"
					},
					"nextRunAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastSentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"consecutiveFailures": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"report",
					"filters",
					"grain",
					"recipient",
					"timezone",
					"schedule",
					"enabled",
					"nextRunAt",
					"lastSentAt",
					"consecutiveFailures",
					"lastError",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ReportDelivery": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"subscriptionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"recipientUserId": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1
							},
							{
								"type": "null"
							}
						]
					},
					"scheduledFor": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"periodStart": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"periodEnd": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"scheduled",
							"test"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"sent",
							"failed"
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"generation": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"replayOfId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"providerMessageId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"error": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"subscriptionId",
					"recipientUserId",
					"scheduledFor",
					"periodStart",
					"periodEnd",
					"kind",
					"status",
					"attemptCount",
					"generation",
					"replayOfId",
					"providerMessageId",
					"error",
					"sentAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Notification": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"lead.created",
							"lead.uncontacted",
							"call.missed",
							"voicemail.received",
							"voice.ai_handoff_unanswered",
							"voice.emergency_dialed",
							"message.received",
							"booking.created",
							"booking.cancelled",
							"deposit.paid",
							"review.received",
							"feedback.received",
							"integration.failed",
							"ingest.review_required",
							"tracking.ceiling_reached",
							"team.message"
						]
					},
					"group": {
						"type": "string",
						"enum": [
							"leads",
							"conversations",
							"bookings",
							"reputation",
							"operations",
							"team"
						]
					},
					"priority": {
						"type": "string",
						"enum": [
							"normal",
							"urgent"
						]
					},
					"subjectType": {
						"type": "string",
						"enum": [
							"journey",
							"conversation",
							"call",
							"appointment",
							"deposit_request",
							"review",
							"pms_connection",
							"provider_connection",
							"ingest_review_item",
							"voice_usage_alert",
							"team_thread"
						]
					},
					"subjectId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"title": {
						"type": "string"
					},
					"body": {
						"type": "string"
					},
					"linkPath": {
						"type": "string"
					},
					"context": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {}
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"readAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"dismissedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"kind",
					"group",
					"priority",
					"subjectType",
					"subjectId",
					"title",
					"body",
					"linkPath",
					"context",
					"createdAt",
					"readAt",
					"dismissedAt"
				],
				"additionalProperties": false
			},
			"NotificationList": {
				"type": "object",
				"properties": {
					"items": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Notification"
						}
					},
					"unreadCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"unreadCountCapped": {
						"type": "boolean"
					},
					"nextCursor": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"createdAt": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"createdAt",
									"id"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"items",
					"unreadCount",
					"unreadCountCapped",
					"nextCursor"
				],
				"additionalProperties": false
			},
			"MarkNotificationsRead": {
				"type": "object",
				"properties": {
					"markedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"remainingCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"unreadCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"unreadCountCapped": {
						"type": "boolean"
					}
				},
				"required": [
					"markedCount",
					"remainingCount",
					"unreadCount",
					"unreadCountCapped"
				],
				"additionalProperties": false
			},
			"NotificationSettings": {
				"type": "object",
				"properties": {
					"kinds": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"kind": {
									"type": "string",
									"enum": [
										"lead.created",
										"lead.uncontacted",
										"call.missed",
										"voicemail.received",
										"voice.ai_handoff_unanswered",
										"voice.emergency_dialed",
										"message.received",
										"booking.created",
										"booking.cancelled",
										"deposit.paid",
										"review.received",
										"feedback.received",
										"integration.failed",
										"ingest.review_required",
										"tracking.ceiling_reached",
										"team.message"
									]
								},
								"group": {
									"type": "string",
									"enum": [
										"leads",
										"conversations",
										"bookings",
										"reputation",
										"operations",
										"team"
									]
								},
								"label": {
									"type": "string"
								},
								"priority": {
									"type": "string",
									"enum": [
										"normal",
										"urgent"
									]
								},
								"inApp": {
									"type": "boolean"
								},
								"push": {
									"type": "boolean"
								},
								"email": {
									"type": "boolean"
								},
								"lockedChannels": {
									"type": "array",
									"items": {
										"type": "string",
										"enum": [
											"inApp",
											"push",
											"email"
										]
									}
								}
							},
							"required": [
								"kind",
								"group",
								"label",
								"priority",
								"inApp",
								"push",
								"email",
								"lockedChannels"
							],
							"additionalProperties": false
						}
					},
					"timezone": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"quietHoursStartHour": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 23
							},
							{
								"type": "null"
							}
						]
					},
					"quietHoursEndHour": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 23
							},
							{
								"type": "null"
							}
						]
					},
					"webPushVapidPublicKey": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"readOnly": {
						"type": "boolean"
					}
				},
				"required": [
					"kinds",
					"timezone",
					"quietHoursStartHour",
					"quietHoursEndHour",
					"webPushVapidPublicKey",
					"readOnly"
				],
				"additionalProperties": false
			},
			"NotificationsBootstrap": {
				"type": "object",
				"properties": {
					"unreadCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"unreadCountCapped": {
						"type": "boolean"
					}
				},
				"required": [
					"unreadCount",
					"unreadCountCapped"
				],
				"additionalProperties": false
			},
			"TeamThread": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"dm",
							"group"
						]
					},
					"title": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"memberUserIds": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"lastSeq": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastActivityAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastMessage": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/TeamMessage"
							},
							{
								"type": "null"
							}
						]
					},
					"unreadCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"unreadCountCapped": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"kind",
					"title",
					"memberUserIds",
					"lastSeq",
					"lastActivityAt",
					"lastMessage",
					"unreadCount",
					"unreadCountCapped"
				],
				"additionalProperties": false
			},
			"TeamMessage": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"threadId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"seq": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"senderUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"clientMessageId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"body": {
						"type": "string"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"threadId",
					"seq",
					"senderUserId",
					"clientMessageId",
					"body",
					"createdAt"
				],
				"additionalProperties": false
			},
			"TeamChatBootstrap": {
				"type": "object",
				"properties": {
					"unreadCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"unreadCountCapped": {
						"type": "boolean"
					}
				},
				"required": [
					"unreadCount",
					"unreadCountCapped"
				],
				"additionalProperties": false
			},
			"CampaignAudience": {
				"oneOf": [
					{
						"type": "object",
						"properties": {
							"kind": {
								"type": "string",
								"const": "segment"
							},
							"q": {
								"type": "string",
								"minLength": 1,
								"maxLength": 200
							},
							"filters": {
								"default": {},
								"type": "object",
								"properties": {
									"status": {
										"type": "object",
										"properties": {
											"in": {
												"minItems": 1,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"enquiry",
														"lead",
														"patient",
														"inactive",
														"archived",
														"deceased"
													]
												}
											}
										},
										"required": [
											"in"
										],
										"additionalProperties": false
									},
									"gender": {
										"type": "object",
										"properties": {
											"in": {
												"minItems": 1,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"male",
														"female",
														"other",
														"unknown"
													]
												}
											}
										},
										"required": [
											"in"
										],
										"additionalProperties": false
									},
									"preferredContactMethod": {
										"type": "object",
										"properties": {
											"in": {
												"minItems": 1,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"phone",
														"sms",
														"email",
														"whatsapp"
													]
												}
											}
										},
										"required": [
											"in"
										],
										"additionalProperties": false
									},
									"email": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"phoneMobile": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"fiscalCode": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"city": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"province": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"postalCode": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"country": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"language": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"medicalAlert": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"note": {
										"type": "object",
										"properties": {
											"contains": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"eq": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"dateOfBirth": {
										"type": "object",
										"properties": {
											"from": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											},
											"to": {
												"type": "string",
												"format": "date",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
											}
										},
										"additionalProperties": false
									},
									"createdAt": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"from": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"to": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"preset": {
														"type": "string",
														"enum": [
															"today",
															"yesterday",
															"thisWeek",
															"lastWeek",
															"thisMonth",
															"lastMonth",
															"last7days",
															"last30days",
															"last90days",
															"last12months",
															"last24months",
															"thisYear"
														]
													}
												},
												"required": [
													"preset"
												],
												"additionalProperties": false
											}
										]
									},
									"updatedAt": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"from": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"to": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"preset": {
														"type": "string",
														"enum": [
															"today",
															"yesterday",
															"thisWeek",
															"lastWeek",
															"thisMonth",
															"lastMonth",
															"last7days",
															"last30days",
															"last90days",
															"last12months",
															"last24months",
															"thisYear"
														]
													}
												},
												"required": [
													"preset"
												],
												"additionalProperties": false
											}
										]
									},
									"smsOptOut": {
										"type": "object",
										"properties": {
											"eq": {
												"type": "boolean"
											}
										},
										"required": [
											"eq"
										],
										"additionalProperties": false
									},
									"emailOptOut": {
										"type": "object",
										"properties": {
											"eq": {
												"type": "boolean"
											}
										},
										"required": [
											"eq"
										],
										"additionalProperties": false
									},
									"whatsappOptOut": {
										"type": "object",
										"properties": {
											"eq": {
												"type": "boolean"
											}
										},
										"required": [
											"eq"
										],
										"additionalProperties": false
									},
									"leadSourceId": {
										"type": "object",
										"properties": {
											"in": {
												"minItems": 1,
												"maxItems": 100,
												"type": "array",
												"items": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"locationId": {
										"type": "object",
										"properties": {
											"in": {
												"minItems": 1,
												"maxItems": 100,
												"type": "array",
												"items": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"referrerId": {
										"type": "object",
										"properties": {
											"in": {
												"minItems": 1,
												"maxItems": 100,
												"type": "array",
												"items": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"tags": {
										"type": "object",
										"properties": {
											"anyOf": {
												"minItems": 1,
												"maxItems": 100,
												"type": "array",
												"items": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"noneOf": {
												"minItems": 1,
												"maxItems": 100,
												"type": "array",
												"items": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"present": {
												"type": "boolean"
											}
										},
										"additionalProperties": false
									},
									"journey": {
										"type": "object",
										"properties": {
											"exists": {
												"type": "boolean"
											},
											"statusIn": {
												"minItems": 1,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"active",
														"won",
														"lost"
													]
												}
											},
											"pipelineId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"stageIdIn": {
												"minItems": 1,
												"maxItems": 100,
												"type": "array",
												"items": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											}
										},
										"additionalProperties": false
									}
								},
								"additionalProperties": false
							},
							"sourceViewId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"sourceViewName": {
								"type": "string",
								"minLength": 1,
								"maxLength": 120
							}
						},
						"required": [
							"kind",
							"filters"
						],
						"additionalProperties": false
					},
					{
						"type": "object",
						"properties": {
							"kind": {
								"type": "string",
								"const": "selected"
							},
							"patientIds": {
								"minItems": 1,
								"maxItems": 500,
								"type": "array",
								"items": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								}
							}
						},
						"required": [
							"kind",
							"patientIds"
						],
						"additionalProperties": false
					}
				]
			},
			"CampaignMetrics": {
				"type": "object",
				"properties": {
					"sent": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"delivered": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"read": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"replied": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"optOuts": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"failed": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"appointments": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"attributedRevenueCents": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"sent",
					"delivered",
					"read",
					"replied",
					"optOuts",
					"failed",
					"appointments",
					"attributedRevenueCents"
				],
				"additionalProperties": false
			},
			"CampaignListItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"scheduled",
							"dispatching",
							"paused",
							"completed",
							"cancelled",
							"failed"
						]
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"sms",
									"email",
									"whatsapp"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"sendAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"launchedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"audienceCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"eligibleCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"excludedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"metrics": {
						"$ref": "#/components/schemas/CampaignMetrics"
					},
					"pauseReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"version",
					"status",
					"channel",
					"sendAt",
					"launchedAt",
					"audienceCount",
					"eligibleCount",
					"excludedCount",
					"metrics",
					"pauseReason",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Campaign": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"scheduled",
							"dispatching",
							"paused",
							"completed",
							"cancelled",
							"failed"
						]
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"sms",
									"email",
									"whatsapp"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"sendAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"launchedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"audienceCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"eligibleCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"excludedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"metrics": {
						"$ref": "#/components/schemas/CampaignMetrics"
					},
					"pauseReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"connectionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"templateId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"audience": {
						"$ref": "#/components/schemas/CampaignAudience"
					},
					"subject": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"body": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"bodyHtml": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"doc": {},
					"whatsappTemplateRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"whatsappLanguage": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"hourlyLimit": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"dailyLimit": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"maxRecipients": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"maxCredits": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"allowOverage": {
						"type": "boolean"
					},
					"dispatchStartedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"version",
					"status",
					"channel",
					"sendAt",
					"launchedAt",
					"audienceCount",
					"eligibleCount",
					"excludedCount",
					"metrics",
					"pauseReason",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"connectionId",
					"templateId",
					"audience",
					"subject",
					"body",
					"bodyHtml",
					"doc",
					"whatsappTemplateRef",
					"whatsappLanguage",
					"hourlyLimit",
					"dailyLimit",
					"maxRecipients",
					"maxCredits",
					"allowOverage",
					"dispatchStartedAt",
					"completedAt",
					"lastError"
				],
				"additionalProperties": false
			},
			"CampaignRecipient": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"campaignId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"subjectPatientIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"conversationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"channel": {
						"type": "string",
						"enum": [
							"sms",
							"email",
							"whatsapp"
						]
					},
					"displayName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"destination": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"queued",
							"sent",
							"delivered",
							"read",
							"replied",
							"skipped",
							"failed",
							"cancelled",
							"delivery_unknown"
						]
					},
					"skipReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"creditEstimate": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"creditActual": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"queuedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"providerAcceptedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deliveredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"readAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"repliedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"campaignId",
					"patientId",
					"subjectPatientIds",
					"conversationId",
					"channel",
					"displayName",
					"destination",
					"status",
					"skipReason",
					"creditEstimate",
					"creditActual",
					"attemptCount",
					"lastError",
					"queuedAt",
					"providerAcceptedAt",
					"sentAt",
					"deliveredAt",
					"readAt",
					"repliedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"CampaignPreview": {
				"type": "object",
				"properties": {
					"audienceCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"eligibleCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"excludedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"estimatedCredits": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"exclusions": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"reason": {
									"type": "string"
								},
								"count": {
									"type": "integer",
									"exclusiveMinimum": 0,
									"maximum": 9007199254740991
								}
							},
							"required": [
								"reason",
								"count"
							],
							"additionalProperties": false
						}
					},
					"warnings": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"code": {
									"type": "string"
								},
								"message": {
									"type": "string"
								},
								"count": {
									"type": "integer",
									"minimum": 0,
									"maximum": 9007199254740991
								}
							},
							"required": [
								"code",
								"message"
							],
							"additionalProperties": false
						}
					},
					"sample": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"patientId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"displayName": {
									"type": "string"
								},
								"destination": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"eligible": {
									"type": "boolean"
								},
								"exclusionReason": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"estimatedCredits": {
									"type": "integer",
									"minimum": 0,
									"maximum": 9007199254740991
								}
							},
							"required": [
								"patientId",
								"displayName",
								"destination",
								"eligible",
								"exclusionReason",
								"estimatedCredits"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"audienceCount",
					"eligibleCount",
					"excludedCount",
					"estimatedCredits",
					"exclusions",
					"warnings",
					"sample"
				],
				"additionalProperties": false
			},
			"PatientContactPreference": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"channel": {
						"type": "string",
						"enum": [
							"sms",
							"email",
							"whatsapp",
							"phone"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"opted_in",
							"opted_out"
						]
					},
					"basis": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"explicit",
									"soft_opt_in"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string"
					},
					"noticeVersion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"evidenceNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"effectiveAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"channel",
					"status",
					"basis",
					"source",
					"noticeVersion",
					"evidenceNote",
					"effectiveAt",
					"updatedById",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ContactPreferenceEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"preferenceId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"channel": {
						"type": "string",
						"enum": [
							"sms",
							"email",
							"whatsapp",
							"phone"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"opted_in",
							"opted_out"
						]
					},
					"basis": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"explicit",
									"soft_opt_in"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string"
					},
					"noticeVersion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"evidenceNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"metadata": {},
					"occurredAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"preferenceId",
					"patientId",
					"channel",
					"status",
					"basis",
					"source",
					"noticeVersion",
					"evidenceNote",
					"metadata",
					"occurredAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"MarketingUnsubscribe": {
				"type": "object",
				"properties": {
					"channel": {
						"type": "string",
						"enum": [
							"sms",
							"email",
							"whatsapp",
							"phone"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"opted_in",
							"opted_out"
						]
					}
				},
				"required": [
					"channel",
					"status"
				],
				"additionalProperties": false
			},
			"Appointment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"uid": {
						"type": "string"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentTypeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"booked",
							"confirmed",
							"arrived",
							"in_chair",
							"fulfilled",
							"cancelled",
							"no_show"
						]
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"timezone": {
						"type": "string"
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"patientInstruction": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"isFirstVisit": {
						"type": "boolean"
					},
					"bookedVia": {
						"type": "string",
						"enum": [
							"staff",
							"online",
							"api",
							"automation",
							"pms",
							"import"
						]
					},
					"cancellationReasonId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"rescheduledFromId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"idempotencyKey": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"idempotencyDigest": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"heldUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"confirmedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"arrivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"seatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"fulfilledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"noShowAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"sourceCorrectionPendingAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewState": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"practitioner_unassigned",
									"operatory_unassigned",
									"unassigned"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"customFields": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"uid",
					"patientId",
					"journeyId",
					"appointmentTypeId",
					"treatmentId",
					"status",
					"version",
					"startsAt",
					"endsAt",
					"timezone",
					"note",
					"patientInstruction",
					"isFirstVisit",
					"bookedVia",
					"cancellationReasonId",
					"rescheduledFromId",
					"idempotencyKey",
					"idempotencyDigest",
					"heldUntil",
					"confirmedAt",
					"arrivedAt",
					"seatedAt",
					"fulfilledAt",
					"cancelledAt",
					"noShowAt",
					"sourceCorrectionPendingAt",
					"reviewState",
					"customFields",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Tag": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"label": {
						"type": "string"
					},
					"color": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"label",
					"color",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Treatment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"slug": {
						"type": "string"
					},
					"name": {
						"type": "string"
					},
					"patientFacingName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"category": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultPriceCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"depositAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"defaultDurationMin": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"consultationPractitionerIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"defaultPipelineId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"color": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"pitchDoc": {},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"slug",
					"name",
					"patientFacingName",
					"category",
					"defaultPriceCents",
					"depositAmountCents",
					"currency",
					"defaultDurationMin",
					"consultationPractitionerIds",
					"defaultPipelineId",
					"color",
					"pitchDoc",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadSource": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"channel": {
						"type": "string",
						"enum": [
							"paid_search",
							"paid_social",
							"organic_search",
							"social",
							"referral_website",
							"referral_friend",
							"referral_practice",
							"existing_patient",
							"email",
							"chat",
							"direct",
							"phone",
							"walk_in",
							"print",
							"other",
							"unknown",
							"ai",
							"paid_ai"
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"channel",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LostReason": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"label": {
						"type": "string"
					},
					"marksJunk": {
						"type": "boolean"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"label",
					"marksJunk",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"CancellationReason": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"label": {
						"type": "string"
					},
					"type": {
						"type": "string",
						"enum": [
							"cancelled",
							"no_show"
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"label",
					"type",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ContactMethod": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"label": {
						"type": "string"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"label",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AppointmentType": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"durationMin": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"bufferBeforeMin": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"bufferAfterMin": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"minNoticeMin": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"color": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"requiresConfirmation": {
						"type": "boolean"
					},
					"isOnlineBookable": {
						"type": "boolean"
					},
					"depositAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"defaultTreatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"durationMin",
					"bufferBeforeMin",
					"bufferAfterMin",
					"minNoticeMin",
					"color",
					"requiresConfirmation",
					"isOnlineBookable",
					"depositAmountCents",
					"currency",
					"defaultTreatmentId",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Location": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"timezone": {
						"type": "string",
						"minLength": 1,
						"maxLength": 64
					},
					"phone": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneE164": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine2": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"province": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"country": {
						"type": "string",
						"enum": [
							"AD",
							"AE",
							"AF",
							"AG",
							"AI",
							"AL",
							"AM",
							"AO",
							"AQ",
							"AR",
							"AS",
							"AT",
							"AU",
							"AW",
							"AX",
							"AZ",
							"BA",
							"BB",
							"BD",
							"BE",
							"BF",
							"BG",
							"BH",
							"BI",
							"BJ",
							"BL",
							"BM",
							"BN",
							"BO",
							"BQ",
							"BR",
							"BS",
							"BT",
							"BV",
							"BW",
							"BY",
							"BZ",
							"CA",
							"CC",
							"CD",
							"CF",
							"CG",
							"CH",
							"CI",
							"CK",
							"CL",
							"CM",
							"CN",
							"CO",
							"CR",
							"CU",
							"CV",
							"CW",
							"CX",
							"CY",
							"CZ",
							"DE",
							"DJ",
							"DK",
							"DM",
							"DO",
							"DZ",
							"EC",
							"EE",
							"EG",
							"EH",
							"ER",
							"ES",
							"ET",
							"FI",
							"FJ",
							"FK",
							"FM",
							"FO",
							"FR",
							"GA",
							"GB",
							"GD",
							"GE",
							"GF",
							"GG",
							"GH",
							"GI",
							"GL",
							"GM",
							"GN",
							"GP",
							"GQ",
							"GR",
							"GS",
							"GT",
							"GU",
							"GW",
							"GY",
							"HK",
							"HM",
							"HN",
							"HR",
							"HT",
							"HU",
							"ID",
							"IE",
							"IL",
							"IM",
							"IN",
							"IO",
							"IQ",
							"IR",
							"IS",
							"IT",
							"JE",
							"JM",
							"JO",
							"JP",
							"KE",
							"KG",
							"KH",
							"KI",
							"KM",
							"KN",
							"KP",
							"KR",
							"KW",
							"KY",
							"KZ",
							"LA",
							"LB",
							"LC",
							"LI",
							"LK",
							"LR",
							"LS",
							"LT",
							"LU",
							"LV",
							"LY",
							"MA",
							"MC",
							"MD",
							"ME",
							"MF",
							"MG",
							"MH",
							"MK",
							"ML",
							"MM",
							"MN",
							"MO",
							"MP",
							"MQ",
							"MR",
							"MS",
							"MT",
							"MU",
							"MV",
							"MW",
							"MX",
							"MY",
							"MZ",
							"NA",
							"NC",
							"NE",
							"NF",
							"NG",
							"NI",
							"NL",
							"NO",
							"NP",
							"NR",
							"NU",
							"NZ",
							"OM",
							"PA",
							"PE",
							"PF",
							"PG",
							"PH",
							"PK",
							"PL",
							"PM",
							"PN",
							"PR",
							"PS",
							"PT",
							"PW",
							"PY",
							"QA",
							"RE",
							"RO",
							"RS",
							"RU",
							"RW",
							"SA",
							"SB",
							"SC",
							"SD",
							"SE",
							"SG",
							"SH",
							"SI",
							"SJ",
							"SK",
							"SL",
							"SM",
							"SN",
							"SO",
							"SR",
							"SS",
							"ST",
							"SV",
							"SX",
							"SY",
							"SZ",
							"TC",
							"TD",
							"TF",
							"TG",
							"TH",
							"TJ",
							"TK",
							"TL",
							"TM",
							"TN",
							"TO",
							"TR",
							"TT",
							"TV",
							"TW",
							"TZ",
							"UA",
							"UG",
							"UM",
							"US",
							"UY",
							"UZ",
							"VA",
							"VC",
							"VE",
							"VG",
							"VI",
							"VN",
							"VU",
							"WF",
							"WS",
							"YE",
							"YT",
							"ZA",
							"ZM",
							"ZW"
						]
					},
					"subdivision": {
						"type": "string"
					},
					"jurisdiction": {
						"type": "string",
						"enum": [
							"unsupported",
							"gb_england",
							"gb_wales",
							"gb_scotland",
							"gb_northern_ireland",
							"us_al",
							"us_ak",
							"us_az",
							"us_ar",
							"us_ca",
							"us_co",
							"us_ct",
							"us_de",
							"us_dc",
							"us_fl",
							"us_ga",
							"us_hi",
							"us_id",
							"us_il",
							"us_in",
							"us_ia",
							"us_ks",
							"us_ky",
							"us_la",
							"us_me",
							"us_md",
							"us_ma",
							"us_mi",
							"us_mn",
							"us_ms",
							"us_mo",
							"us_mt",
							"us_ne",
							"us_nv",
							"us_nh",
							"us_nj",
							"us_nm",
							"us_ny",
							"us_nc",
							"us_nd",
							"us_oh",
							"us_ok",
							"us_or",
							"us_pa",
							"us_ri",
							"us_sc",
							"us_sd",
							"us_tn",
							"us_tx",
							"us_ut",
							"us_vt",
							"us_va",
							"us_wa",
							"us_wv",
							"us_wi",
							"us_wy",
							"it"
						]
					},
					"requireOperatory": {
						"type": "boolean"
					},
					"latitude": {
						"anyOf": [
							{
								"type": "number",
								"minimum": -90,
								"maximum": 90
							},
							{
								"type": "null"
							}
						]
					},
					"longitude": {
						"anyOf": [
							{
								"type": "number",
								"minimum": -180,
								"maximum": 180
							},
							{
								"type": "null"
							}
						]
					},
					"coordinatesConfirmedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"openingHours": {
						"type": "object",
						"propertyNames": {
							"type": "string",
							"enum": [
								"mon",
								"tue",
								"wed",
								"thu",
								"fri",
								"sat",
								"sun"
							]
						},
						"additionalProperties": {
							"maxItems": 4,
							"type": "array",
							"items": {
								"type": "object",
								"properties": {
									"open": {
										"type": "string",
										"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
									},
									"close": {
										"type": "string",
										"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
									}
								},
								"required": [
									"open",
									"close"
								],
								"additionalProperties": false
							}
						}
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"timezone",
					"phone",
					"phoneE164",
					"email",
					"addressLine1",
					"addressLine2",
					"city",
					"province",
					"postalCode",
					"country",
					"subdivision",
					"jurisdiction",
					"requireOperatory",
					"latitude",
					"longitude",
					"coordinatesConfirmedAt",
					"openingHours",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"MemberLocation": {
				"type": "object",
				"properties": {
					"userId": {
						"type": "string"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					}
				},
				"required": [
					"userId",
					"locationId"
				],
				"additionalProperties": false
			},
			"InvitationPublication": {
				"type": "object",
				"properties": {
					"invitationId": {
						"type": "string"
					},
					"deliveryRevision": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"publishing",
							"published",
							"parked"
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"publishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastErrorCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"invitationId",
					"deliveryRevision",
					"status",
					"attemptCount",
					"publishedAt",
					"parkedAt",
					"lastErrorCode"
				],
				"additionalProperties": false
			},
			"Operatory": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"color": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"active": {
						"type": "boolean"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"name",
					"color",
					"position",
					"active",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Practitioner": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"userId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"displayName": {
						"type": "string"
					},
					"role": {
						"type": "string",
						"enum": [
							"dentist",
							"hygienist",
							"therapist",
							"nurse",
							"other"
						]
					},
					"color": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"active": {
						"type": "boolean"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"userId",
					"displayName",
					"role",
					"color",
					"active",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"CaptureHook": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string"
					},
					"token": {
						"type": "string"
					},
					"fieldMap": {},
					"extraFields": {},
					"defaultTreatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultLeadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultIntakeMethod": {
						"type": "string",
						"enum": [
							"form",
							"website_form",
							"webhook",
							"zapier",
							"lead_ad",
							"whatsapp",
							"sms",
							"call",
							"chat",
							"manual",
							"import",
							"booking",
							"referral"
						]
					},
					"managedPurpose": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"affiliateLabel": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"active": {
						"type": "boolean"
					},
					"authMode": {
						"type": "string",
						"enum": [
							"public",
							"signed"
						]
					},
					"previousSecretExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"name",
					"token",
					"fieldMap",
					"extraFields",
					"defaultTreatmentId",
					"defaultLeadSourceId",
					"defaultIntakeMethod",
					"managedPurpose",
					"affiliateLabel",
					"active",
					"authMode",
					"previousSecretExpiresAt",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"CaptureHookSetup": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string"
					},
					"token": {
						"type": "string"
					},
					"fieldMap": {},
					"extraFields": {},
					"defaultTreatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultLeadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultIntakeMethod": {
						"type": "string",
						"enum": [
							"form",
							"website_form",
							"webhook",
							"zapier",
							"lead_ad",
							"whatsapp",
							"sms",
							"call",
							"chat",
							"manual",
							"import",
							"booking",
							"referral"
						]
					},
					"managedPurpose": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"affiliateLabel": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"active": {
						"type": "boolean"
					},
					"authMode": {
						"type": "string",
						"enum": [
							"public",
							"signed"
						]
					},
					"previousSecretExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"signingSecret": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"name",
					"token",
					"fieldMap",
					"extraFields",
					"defaultTreatmentId",
					"defaultLeadSourceId",
					"defaultIntakeMethod",
					"managedPurpose",
					"affiliateLabel",
					"active",
					"authMode",
					"previousSecretExpiresAt",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"signingSecret"
				],
				"additionalProperties": false
			},
			"SiteConfig": {
				"type": "object",
				"properties": {
					"modules": {
						"maxItems": 8,
						"type": "array",
						"items": {
							"type": "string",
							"maxLength": 32
						}
					},
					"consentPolicy": {
						"type": "string",
						"enum": [
							"auto",
							"always_required",
							"not_required"
						]
					},
					"forms": {
						"maxItems": 200,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"token": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"fingerprint": {
									"type": "string"
								},
								"selector": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"status": {
									"type": "string",
									"enum": [
										"pending",
										"active",
										"paused"
									]
								}
							},
							"required": [
								"token",
								"fingerprint",
								"selector",
								"status"
							],
							"additionalProperties": false
						}
					},
					"chatgptPixelId": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 512
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"modules",
					"consentPolicy",
					"forms",
					"chatgptPixelId"
				],
				"additionalProperties": false
			},
			"HostedForm": {
				"type": "object",
				"properties": {
					"practiceName": {
						"type": "string"
					},
					"brandColor": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"builderConfig": {
						"$ref": "#/components/schemas/FormBuilderConfig"
					},
					"captureToken": {
						"type": "string"
					},
					"turnstileSiteKey": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"practiceName",
					"brandColor",
					"builderConfig",
					"captureToken",
					"turnstileSiteKey"
				],
				"additionalProperties": false
			},
			"FormBuilderConfig": {
				"type": "object",
				"properties": {
					"fields": {
						"minItems": 1,
						"maxItems": 30,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"key": {
									"type": "string",
									"minLength": 1,
									"maxLength": 64
								},
								"label": {
									"type": "string",
									"minLength": 1,
									"maxLength": 200
								},
								"kind": {
									"type": "string",
									"enum": [
										"text",
										"email",
										"tel",
										"textarea",
										"checkbox"
									]
								},
								"required": {
									"type": "boolean"
								}
							},
							"required": [
								"key",
								"label",
								"kind",
								"required"
							],
							"additionalProperties": false
						},
						"description": "Field keys must be unique"
					},
					"submitLabel": {
						"type": "string",
						"minLength": 1,
						"maxLength": 60
					},
					"successMessage": {
						"type": "string",
						"minLength": 1,
						"maxLength": 500
					}
				},
				"required": [
					"fields"
				],
				"additionalProperties": false
			},
			"WebsiteTracking": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"siteKey": {
						"type": "string"
					},
					"enabled": {
						"type": "boolean"
					},
					"siteUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"pinnedDomains": {
						"maxItems": 10,
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"consentPolicy": {
						"type": "string",
						"enum": [
							"auto",
							"always_required",
							"not_required"
						]
					},
					"cmsDetected": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"wordpress",
									"wix",
									"squarespace",
									"webflow",
									"shopify",
									"custom",
									"unknown"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"cmsDetectedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"scriptFirstSeenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"scriptLastSeenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"config": {},
					"callTranscriptionEnabled": {
						"type": "boolean"
					},
					"setupEmailLastSentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"maxConcurrentCalls": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"dailyMinutesCeiling": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"ga4MeasurementId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"siteKey",
					"enabled",
					"siteUrl",
					"pinnedDomains",
					"consentPolicy",
					"cmsDetected",
					"cmsDetectedAt",
					"scriptFirstSeenAt",
					"scriptLastSeenAt",
					"config",
					"callTranscriptionEnabled",
					"setupEmailLastSentAt",
					"maxConcurrentCalls",
					"dailyMinutesCeiling",
					"ga4MeasurementId",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"WebsiteSetupStatus": {
				"type": "object",
				"properties": {
					"scriptSeen": {
						"type": "boolean"
					},
					"scriptLastSeenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cmsDetected": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"wordpress",
									"wix",
									"squarespace",
									"webflow",
									"shopify",
									"custom",
									"unknown"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"formsFound": {
						"type": "boolean"
					},
					"testLeadReceived": {
						"type": "boolean"
					},
					"mappingConfirmed": {
						"type": "boolean"
					},
					"tracking": {
						"$ref": "#/components/schemas/WebsiteTracking"
					}
				},
				"required": [
					"scriptSeen",
					"scriptLastSeenAt",
					"cmsDetected",
					"formsFound",
					"testLeadReceived",
					"mappingConfirmed",
					"tracking"
				],
				"additionalProperties": false
			},
			"Form": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"type": {
						"type": "string",
						"enum": [
							"crm",
							"discovered",
							"custom"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"active",
							"paused"
						]
					},
					"captureHookId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"domain": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"builderConfig": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/FormBuilderConfig"
							},
							{
								"type": "null"
							}
						]
					},
					"fingerprint": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"pageUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"selector": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fieldInventory": {},
					"lastSeenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"proposedFieldMap": {},
					"proposalSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"ai",
									"heuristic"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"mappingConfirmedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"mappingConfirmedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"hostedPageToken": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"hostedPageEnabled": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"name": {
						"type": "string"
					},
					"token": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"organizationId",
					"type",
					"status",
					"captureHookId",
					"domain",
					"builderConfig",
					"fingerprint",
					"pageUrl",
					"selector",
					"fieldInventory",
					"lastSeenAt",
					"proposedFieldMap",
					"proposalSource",
					"mappingConfirmedAt",
					"mappingConfirmedById",
					"hostedPageToken",
					"hostedPageEnabled",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"name",
					"token"
				],
				"additionalProperties": false
			},
			"FormListItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"type": {
						"type": "string",
						"enum": [
							"crm",
							"discovered",
							"custom"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"active",
							"paused"
						]
					},
					"captureHookId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"domain": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"builderConfig": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/FormBuilderConfig"
							},
							{
								"type": "null"
							}
						]
					},
					"fingerprint": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"pageUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"selector": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fieldInventory": {},
					"lastSeenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"proposedFieldMap": {},
					"proposalSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"ai",
									"heuristic"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"mappingConfirmedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"mappingConfirmedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"hostedPageToken": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"hostedPageEnabled": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"name": {
						"type": "string"
					},
					"token": {
						"type": "string"
					},
					"lastAcceptedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"authMode": {
						"type": "string",
						"enum": [
							"public",
							"signed"
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"type",
					"status",
					"captureHookId",
					"domain",
					"builderConfig",
					"fingerprint",
					"pageUrl",
					"selector",
					"fieldInventory",
					"lastSeenAt",
					"proposedFieldMap",
					"proposalSource",
					"mappingConfirmedAt",
					"mappingConfirmedById",
					"hostedPageToken",
					"hostedPageEnabled",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"name",
					"token",
					"lastAcceptedAt",
					"authMode"
				],
				"additionalProperties": false
			},
			"FormMappingProposal": {
				"type": "object",
				"properties": {
					"fieldMap": {
						"type": "object",
						"properties": {
							"firstName": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"lastName": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"email": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"phoneMobile": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"phoneOther": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"dateOfBirth": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"gender": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"addressLine1": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"addressLine2": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"city": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"province": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"postalCode": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"country": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"preferredContactMethod": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"preferredContactTime": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"treatmentSlug": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"location": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"message": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"note": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							"marketingConsent": {
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							}
						},
						"additionalProperties": false
					},
					"source": {
						"type": "string",
						"enum": [
							"ai",
							"heuristic"
						]
					}
				},
				"required": [
					"fieldMap",
					"source"
				],
				"additionalProperties": false
			},
			"IngestReviewItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"ingress-vault",
							"stripe-event",
							"pms-staging",
							"lead-ad-submission",
							"dialer-event",
							"discovered-form",
							"call-lead-capture",
							"missed-call-followup",
							"patient-account"
						]
					},
					"source": {
						"type": "string"
					},
					"sourceRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"state": {
						"type": "string",
						"enum": [
							"pending",
							"needs_review",
							"resolved",
							"discarded"
						]
					},
					"receivedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"failureSummary": {
						"type": "string"
					},
					"attempts": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"resolutionNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"pendingSubmissions": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"holdReason": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"plan_limit"
								]
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"kind",
					"source",
					"sourceRef",
					"state",
					"receivedAt",
					"failureSummary",
					"attempts",
					"resolvedAt",
					"resolvedById",
					"resolvedByName",
					"resolutionNote",
					"createdAt",
					"pendingSubmissions",
					"holdReason"
				],
				"additionalProperties": false
			},
			"IntakeReviewIssue": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reason": {
						"type": "string",
						"enum": [
							"archived_location",
							"archived_treatment",
							"archived_lead_source",
							"invalid_optional_reference",
							"intake_receipt_stalled",
							"contact_value_unparsed"
						]
					},
					"referenceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"resolved"
						]
					},
					"resolutionNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"patient": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"firstName": {
										"type": "string"
									},
									"lastName": {
										"type": "string"
									},
									"preferredName": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneMobile": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"id",
									"firstName",
									"lastName",
									"preferredName",
									"phoneMobile"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"captureHook": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string"
									},
									"formId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"id",
									"name",
									"formId"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"contactValue": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"reason",
					"referenceId",
					"status",
					"resolutionNote",
					"resolvedById",
					"resolvedAt",
					"createdAt",
					"patient",
					"captureHook",
					"contactValue"
				],
				"additionalProperties": false
			},
			"ConnectedApp": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"clientId": {
						"type": "string"
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"icon": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"uri": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"scopes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"connectedByUserId": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1
							},
							{
								"type": "null"
							}
						]
					},
					"connectedByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"connectedByEmail": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"clientId",
					"name",
					"icon",
					"uri",
					"scopes",
					"connectedByUserId",
					"connectedByName",
					"connectedByEmail",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadIntakeResult": {
				"type": "object",
				"properties": {
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"journeyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"taskId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientWasCreated": {
						"type": "boolean"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"eventId": {
						"type": "string"
					}
				},
				"required": [
					"patientId",
					"journeyId",
					"taskId",
					"patientWasCreated",
					"organizationId",
					"eventId"
				],
				"additionalProperties": false
			},
			"LeadIntakeAccepted": {
				"type": "object",
				"properties": {
					"accepted": {
						"type": "boolean",
						"const": true
					},
					"eventId": {
						"type": "string"
					}
				},
				"required": [
					"accepted",
					"eventId"
				],
				"additionalProperties": false
			},
			"WebhookEndpoint": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"url": {
						"type": "string"
					},
					"events": {
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"patient.created",
								"patient.updated",
								"patient.archived",
								"journey.created",
								"journey.updated",
								"journey.stage_changed",
								"journey.won",
								"journey.lost",
								"journey.reopened",
								"task.created",
								"task.updated",
								"task.completed",
								"task.reopened",
								"task.cancelled",
								"appointment.created",
								"appointment.updated",
								"appointment.status_changed",
								"appointment.rescheduled",
								"conversation.created",
								"conversation.updated",
								"message.received",
								"message.sent",
								"message.status_changed",
								"deposit_request.created",
								"deposit_request.status_changed",
								"reputation_request.status_changed",
								"reputation_feedback.received",
								"reputation_review.received",
								"reputation_review.updated",
								"reputation_reply.status_changed",
								"lead_ad_submission.received",
								"lead_ad_submission.status_changed",
								"lead_ad_connection.health_changed",
								"pms_connection.health_changed",
								"pms_patient.link_changed",
								"pms_sync.review_required",
								"pms_treatment_plan.updated",
								"pms_invoice.updated",
								"pms_payment.updated",
								"channel_connection.health_changed"
							]
						}
					},
					"enabled": {
						"type": "boolean"
					},
					"verifiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"pausedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"pauseReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"failureStreak": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastTestedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastSuccessAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastFailureAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"previousSecretExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"managedByApp": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"url",
					"events",
					"enabled",
					"verifiedAt",
					"pausedAt",
					"pauseReason",
					"failureStreak",
					"lastTestedAt",
					"lastSuccessAt",
					"lastFailureAt",
					"previousSecretExpiresAt",
					"managedByApp",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"WebhookEndpointSetup": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"url": {
						"type": "string"
					},
					"events": {
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"patient.created",
								"patient.updated",
								"patient.archived",
								"journey.created",
								"journey.updated",
								"journey.stage_changed",
								"journey.won",
								"journey.lost",
								"journey.reopened",
								"task.created",
								"task.updated",
								"task.completed",
								"task.reopened",
								"task.cancelled",
								"appointment.created",
								"appointment.updated",
								"appointment.status_changed",
								"appointment.rescheduled",
								"conversation.created",
								"conversation.updated",
								"message.received",
								"message.sent",
								"message.status_changed",
								"deposit_request.created",
								"deposit_request.status_changed",
								"reputation_request.status_changed",
								"reputation_feedback.received",
								"reputation_review.received",
								"reputation_review.updated",
								"reputation_reply.status_changed",
								"lead_ad_submission.received",
								"lead_ad_submission.status_changed",
								"lead_ad_connection.health_changed",
								"pms_connection.health_changed",
								"pms_patient.link_changed",
								"pms_sync.review_required",
								"pms_treatment_plan.updated",
								"pms_invoice.updated",
								"pms_payment.updated",
								"channel_connection.health_changed"
							]
						}
					},
					"enabled": {
						"type": "boolean"
					},
					"verifiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"pausedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"pauseReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"failureStreak": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastTestedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastSuccessAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastFailureAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"previousSecretExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"managedByApp": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"signingSecret": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"url",
					"events",
					"enabled",
					"verifiedAt",
					"pausedAt",
					"pauseReason",
					"failureStreak",
					"lastTestedAt",
					"lastSuccessAt",
					"lastFailureAt",
					"previousSecretExpiresAt",
					"managedByApp",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"signingSecret"
				],
				"additionalProperties": false
			},
			"WebhookDelivery": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"endpointId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"logicalEventId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"event": {
						"type": "string",
						"enum": [
							"patient.created",
							"patient.updated",
							"patient.archived",
							"journey.created",
							"journey.updated",
							"journey.stage_changed",
							"journey.won",
							"journey.lost",
							"journey.reopened",
							"task.created",
							"task.updated",
							"task.completed",
							"task.reopened",
							"task.cancelled",
							"appointment.created",
							"appointment.updated",
							"appointment.status_changed",
							"appointment.rescheduled",
							"conversation.created",
							"conversation.updated",
							"message.received",
							"message.sent",
							"message.status_changed",
							"deposit_request.created",
							"deposit_request.status_changed",
							"reputation_request.status_changed",
							"reputation_feedback.received",
							"reputation_review.received",
							"reputation_review.updated",
							"reputation_reply.status_changed",
							"lead_ad_submission.received",
							"lead_ad_submission.status_changed",
							"lead_ad_connection.health_changed",
							"pms_connection.health_changed",
							"pms_patient.link_changed",
							"pms_sync.review_required",
							"pms_treatment_plan.updated",
							"pms_invoice.updated",
							"pms_payment.updated",
							"channel_connection.health_changed"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"leased",
							"delivered",
							"failed"
						]
					},
					"generation": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"replayOfId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"isTest": {
						"type": "boolean"
					},
					"attemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"nextAttemptAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"responseStatus": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"responseSnippet": {
						"anyOf": [
							{
								"type": "string",
								"description": "Response excerpt, at most 65536 UTF-8 bytes."
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"endpointId",
					"logicalEventId",
					"event",
					"status",
					"generation",
					"replayOfId",
					"isTest",
					"attemptCount",
					"nextAttemptAt",
					"responseStatus",
					"responseSnippet",
					"lastError",
					"createdAt",
					"updatedAt",
					"completedAt"
				],
				"additionalProperties": false
			},
			"ChannelConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"channel": {
						"type": "string",
						"enum": [
							"whatsapp",
							"sms",
							"email",
							"webchat",
							"messenger",
							"instagram",
							"telegram",
							"tiktok",
							"facebook_comments",
							"instagram_comments"
						]
					},
					"provider": {
						"type": "string",
						"enum": [
							"whatsapp_cloud",
							"twilio",
							"telnyx",
							"resend",
							"webchat",
							"meta_messaging",
							"telegram",
							"tiktok_messaging",
							"meta_comments",
							"gmail",
							"outlook"
						]
					},
					"name": {
						"type": "string"
					},
					"address": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalMeta": {},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"active",
							"error",
							"disconnected"
						]
					},
					"statusError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastInboundAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"webhookUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"inboundAddress": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"mailboxSync": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"skippedCount": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"skippedCount"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"channel",
					"provider",
					"name",
					"address",
					"externalId",
					"externalMeta",
					"status",
					"statusError",
					"lastInboundAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"webhookUrl",
					"inboundAddress"
				],
				"additionalProperties": false
			},
			"ChannelConnectionSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"channel": {
						"type": "string",
						"enum": [
							"whatsapp",
							"sms",
							"email",
							"webchat",
							"messenger",
							"instagram",
							"telegram",
							"tiktok",
							"facebook_comments",
							"instagram_comments"
						]
					},
					"provider": {
						"type": "string",
						"enum": [
							"whatsapp_cloud",
							"twilio",
							"telnyx",
							"resend",
							"webchat",
							"meta_messaging",
							"telegram",
							"tiktok_messaging",
							"meta_comments",
							"gmail",
							"outlook"
						]
					},
					"name": {
						"type": "string"
					},
					"address": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"active",
							"error",
							"disconnected"
						]
					},
					"canPrivateReply": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"channel",
					"provider",
					"name",
					"address",
					"locationId",
					"status",
					"canPrivateReply"
				],
				"additionalProperties": false
			},
			"EmailSendingDomain": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"domain": {
						"type": "string"
					},
					"region": {
						"type": "string",
						"enum": [
							"us-east-1",
							"eu-west-1"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending_provider",
							"pending_dns",
							"verified",
							"failed",
							"review_required",
							"deleted"
						]
					},
					"records": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/EmailSendingDomainDnsRecord"
						}
					},
					"recommendedDmarc": {
						"$ref": "#/components/schemas/EmailSendingDomainDnsRecord"
					},
					"verifiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"canRetryTeardown": {
						"type": "boolean"
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"domain",
					"region",
					"status",
					"records",
					"recommendedDmarc",
					"verifiedAt",
					"parkedAt",
					"archivedAt",
					"canRetryTeardown",
					"lastError",
					"createdAt"
				],
				"additionalProperties": false
			},
			"EmailSendingDomainDnsRecord": {
				"type": "object",
				"properties": {
					"record": {
						"type": "string"
					},
					"name": {
						"type": "string"
					},
					"type": {
						"type": "string"
					},
					"value": {
						"type": "string"
					},
					"ttl": {
						"type": "string"
					},
					"priority": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string"
					}
				},
				"required": [
					"record",
					"name",
					"type",
					"value"
				],
				"additionalProperties": false
			},
			"EmailSendingDomainDnsHost": {
				"type": "object",
				"properties": {
					"sendingDomain": {
						"type": "string"
					},
					"zoneApex": {
						"type": "string"
					},
					"detection": {
						"type": "string",
						"enum": [
							"unavailable",
							"unknown",
							"single",
							"split"
						]
					},
					"hosts": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string"
								},
								"name": {
									"type": "string"
								}
							},
							"required": [
								"id",
								"name"
							],
							"additionalProperties": false
						}
					},
					"nameservers": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"dnsPageUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"autoSetupReady": {
						"type": "boolean"
					},
					"domainConnect": {
						"type": "object",
						"properties": {
							"available": {
								"type": "boolean"
							},
							"providerName": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"available",
							"providerName"
						],
						"additionalProperties": false
					},
					"cloudflare": {
						"type": "object",
						"properties": {
							"available": {
								"type": "boolean"
							}
						},
						"required": [
							"available"
						],
						"additionalProperties": false
					},
					"records": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/EmailSendingDomainDnsRecord"
						}
					}
				},
				"required": [
					"sendingDomain",
					"zoneApex",
					"detection",
					"hosts",
					"nameservers",
					"dnsPageUrl",
					"autoSetupReady",
					"domainConnect",
					"cloudflare",
					"records"
				],
				"additionalProperties": false
			},
			"EmailSendingDomainDnsApply": {
				"type": "object",
				"properties": {
					"domain": {
						"$ref": "#/components/schemas/EmailSendingDomain"
					},
					"status": {
						"type": "string",
						"enum": [
							"applied",
							"partial",
							"blocked",
							"stale",
							"pre_write_failure",
							"write_unknown",
							"postflight_failed"
						]
					},
					"results": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/EmailSendingDomainDnsApplyResult"
						}
					},
					"checkStarted": {
						"type": "boolean"
					},
					"code": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"domain",
					"status",
					"results",
					"checkStarted",
					"code"
				],
				"additionalProperties": false
			},
			"EmailSendingDomainDnsApplyResult": {
				"type": "object",
				"properties": {
					"record": {
						"type": "string",
						"enum": [
							"dkim",
							"spf",
							"mx",
							"dmarc"
						]
					},
					"name": {
						"type": "string"
					},
					"outcome": {
						"type": "string",
						"enum": [
							"created",
							"unchanged",
							"skipped_existing",
							"managed_elsewhere",
							"blocked_cname",
							"blocked_in_use",
							"unsupported",
							"missing_after_write",
							"unknown"
						]
					}
				},
				"required": [
					"record",
					"name",
					"outcome"
				],
				"additionalProperties": false
			},
			"PmsConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"provider": {
						"type": "string",
						"enum": [
							"dentally",
							"aerona",
							"exact",
							"carestream_r4",
							"systems_for_dentists",
							"pearl",
							"dentrix",
							"eaglesoft",
							"open_dental",
							"denticon",
							"sensei",
							"curve_dental",
							"carestack",
							"tab32",
							"archy",
							"oryx",
							"other"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending_vendor_activation",
							"connecting",
							"active",
							"paused",
							"error",
							"disconnected"
						]
					},
					"externalAccountRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"canReadPatients": {
						"type": "boolean"
					},
					"canWritePatients": {
						"type": "boolean"
					},
					"canReadAppointments": {
						"type": "boolean"
					},
					"canWriteAppointments": {
						"type": "boolean"
					},
					"canConfirmCancel": {
						"type": "boolean"
					},
					"hasWebhooks": {
						"type": "boolean"
					},
					"pollIntervalMin": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"nextPollAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"pollLeaseExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastPollStartedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastPollCompletedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastWebhookAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastFullSyncAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"sites": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PmsConnectionSite"
						}
					},
					"pendingMatchCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"failedWriteCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"pendingAppointmentCorrectionCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"unprocessedStagingCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"provider",
					"status",
					"externalAccountRef",
					"canReadPatients",
					"canWritePatients",
					"canReadAppointments",
					"canWriteAppointments",
					"canConfirmCancel",
					"hasWebhooks",
					"pollIntervalMin",
					"nextPollAt",
					"pollLeaseExpiresAt",
					"lastPollStartedAt",
					"lastPollCompletedAt",
					"lastWebhookAt",
					"lastFullSyncAt",
					"lastError",
					"createdAt",
					"updatedAt",
					"sites",
					"pendingMatchCount",
					"failedWriteCount",
					"pendingAppointmentCorrectionCount",
					"unprocessedStagingCount"
				],
				"additionalProperties": false
			},
			"PmsConnectionSite": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalSiteId": {
						"type": "string"
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"enabled": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"externalSiteId",
					"name",
					"locationId",
					"enabled"
				],
				"additionalProperties": false
			},
			"PmsUnresolvedPractitioner": {
				"type": "object",
				"properties": {
					"linkId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalId": {
						"type": "string"
					},
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"displayName": {
						"type": "string"
					}
				},
				"required": [
					"linkId",
					"externalId",
					"practitionerId",
					"displayName"
				],
				"additionalProperties": false
			},
			"PmsConnectionSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"dentally",
							"aerona",
							"exact",
							"carestream_r4",
							"systems_for_dentists",
							"pearl",
							"dentrix",
							"eaglesoft",
							"open_dental",
							"denticon",
							"sensei",
							"curve_dental",
							"carestack",
							"tab32",
							"archy",
							"oryx",
							"other"
						]
					},
					"locationIds": {
						"anyOf": [
							{
								"type": "array",
								"items": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								}
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending_vendor_activation",
							"connecting",
							"active",
							"paused",
							"error",
							"disconnected"
						]
					},
					"fixture": {
						"type": "boolean"
					},
					"canWritePatients": {
						"type": "boolean"
					},
					"canReadAppointments": {
						"type": "boolean"
					},
					"canWriteAppointments": {
						"type": "boolean"
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"provider",
					"locationIds",
					"status",
					"fixture",
					"canWritePatients",
					"canReadAppointments",
					"canWriteAppointments",
					"lastSyncedAt"
				],
				"additionalProperties": false
			},
			"PmsExternalPatientPreview": {
				"type": "object",
				"properties": {
					"externalId": {
						"type": "string"
					},
					"firstName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"dateOfBirth": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"externalId",
					"firstName",
					"lastName",
					"dateOfBirth",
					"postalCode",
					"email",
					"phoneMobile"
				],
				"additionalProperties": false
			},
			"PmsMatchCandidate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalId": {
						"type": "string"
					},
					"score": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"matchedOn": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"state": {
						"type": "string",
						"enum": [
							"suggested",
							"accepted",
							"rejected"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"patient": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"firstName": {
								"type": "string"
							},
							"lastName": {
								"type": "string"
							},
							"dateOfBirth": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"email": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"phoneMobile": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"status": {
								"type": "string"
							}
						},
						"required": [
							"id",
							"firstName",
							"lastName",
							"dateOfBirth",
							"email",
							"phoneMobile",
							"status"
						],
						"additionalProperties": false
					},
					"external": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/PmsExternalPatientPreview"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"connectionId",
					"patientId",
					"externalId",
					"score",
					"matchedOn",
					"state",
					"createdAt",
					"patient",
					"external"
				],
				"additionalProperties": false
			},
			"PmsLinkSummary": {
				"type": "object",
				"properties": {
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"matchState": {
						"type": "string",
						"enum": [
							"auto_matched",
							"human_confirmed",
							"pending_review",
							"pushed",
							"unlinked"
						]
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"connectionId",
					"externalId",
					"matchState",
					"lastSyncedAt"
				],
				"additionalProperties": false
			},
			"PmsProviderMatches": {
				"type": "object",
				"properties": {
					"items": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PmsExternalPatientPreview"
						}
					},
					"create": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"missing": {
										"type": "array",
										"items": {
											"type": "string"
										}
									},
									"unconfirmed": {
										"type": "boolean"
									}
								},
								"required": [
									"missing",
									"unconfirmed"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"items",
					"create"
				],
				"additionalProperties": false
			},
			"PmsWriteSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"entityType": {
						"type": "string",
						"enum": [
							"patient",
							"appointment",
							"practitioner",
							"operatory",
							"appointment_type",
							"treatment_plan",
							"invoice",
							"payment",
							"procedure",
							"invoice_line",
							"allocation",
							"practitioner_user"
						]
					},
					"operation": {
						"type": "string",
						"enum": [
							"update",
							"confirm",
							"cancel"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"sent",
							"confirmed",
							"failed",
							"undone"
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"entityType",
					"operation",
					"status",
					"lastError",
					"createdAt"
				],
				"additionalProperties": false
			},
			"PmsAppointmentOperation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"eventId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"claimed",
							"submitted",
							"ambiguous",
							"reconciling",
							"confirmed",
							"completed",
							"rejected",
							"review_required"
						]
					},
					"attempts": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"providerAppointmentId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"nextAttemptAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"submittedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"confirmedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"eventId",
					"appointmentId",
					"connectionId",
					"status",
					"attempts",
					"providerAppointmentId",
					"nextAttemptAt",
					"lastError",
					"submittedAt",
					"confirmedAt",
					"resolvedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PmsAppointmentCorrection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"state": {
						"type": "string",
						"enum": [
							"pending",
							"accepted",
							"kept_local",
							"superseded"
						]
					},
					"action": {
						"type": "string",
						"enum": [
							"upsert",
							"delete"
						]
					},
					"providerUpdatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"appointmentVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"current": {
						"type": "object",
						"properties": {
							"status": {
								"type": "string",
								"enum": [
									"pending",
									"booked",
									"confirmed",
									"arrived",
									"in_chair",
									"fulfilled",
									"cancelled",
									"no_show"
								]
							},
							"startsAt": {
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							"endsAt": {
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							"locationId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"locationName": {
								"type": "string"
							},
							"note": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"statusAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"version": {
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"status",
							"startsAt",
							"endsAt",
							"locationId",
							"locationName",
							"note",
							"statusAt",
							"version"
						],
						"additionalProperties": false
					},
					"proposed": {
						"type": "object",
						"properties": {
							"status": {
								"type": "string",
								"enum": [
									"pending",
									"booked",
									"confirmed",
									"arrived",
									"in_chair",
									"fulfilled",
									"cancelled",
									"no_show"
								]
							},
							"startsAt": {
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							"endsAt": {
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							"locationId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"locationName": {
								"type": "string"
							},
							"note": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"statusAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"practitioners": {
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"name"
									],
									"additionalProperties": false
								}
							}
						},
						"required": [
							"status",
							"startsAt",
							"endsAt",
							"locationId",
							"locationName",
							"note",
							"statusAt",
							"practitioners"
						],
						"additionalProperties": false
					},
					"patient": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"firstName": {
								"type": "string"
							},
							"lastName": {
								"type": "string"
							}
						},
						"required": [
							"id",
							"firstName",
							"lastName"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"id",
					"connectionId",
					"appointmentId",
					"state",
					"action",
					"providerUpdatedAt",
					"createdAt",
					"appointmentVersion",
					"current",
					"proposed",
					"patient"
				],
				"additionalProperties": false
			},
			"PatientLedgerSummary": {
				"type": "object",
				"properties": {
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"chargedCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"paidCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"balanceCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"invoices": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"externalReference": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"externalNumber": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"number": {
									"anyOf": [
										{
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										{
											"type": "null"
										}
									]
								},
								"numberPeriod": {
									"type": "string"
								},
								"status": {
									"type": "string",
									"enum": [
										"issued",
										"void"
									]
								},
								"totalCents": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"issuedOn": {
									"type": "string"
								},
								"lines": {
									"type": "array",
									"items": {
										"type": "object",
										"properties": {
											"description": {
												"type": "string"
											},
											"quantity": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"amountCents": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"description",
											"quantity",
											"amountCents"
										],
										"additionalProperties": false
									}
								}
							},
							"required": [
								"id",
								"externalReference",
								"externalNumber",
								"number",
								"numberPeriod",
								"status",
								"totalCents",
								"issuedOn",
								"lines"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"currency",
					"chargedCents",
					"paidCents",
					"balanceCents",
					"invoices"
				],
				"additionalProperties": false
			},
			"PatientPmsInfo": {
				"type": "object",
				"properties": {
					"connection": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"provider": {
										"type": "string",
										"enum": [
											"dentally",
											"aerona",
											"exact",
											"carestream_r4",
											"systems_for_dentists",
											"pearl",
											"dentrix",
											"eaglesoft",
											"open_dental",
											"denticon",
											"sensei",
											"curve_dental",
											"carestack",
											"tab32",
											"archy",
											"oryx",
											"other"
										]
									},
									"status": {
										"type": "string",
										"enum": [
											"pending_vendor_activation",
											"connecting",
											"active",
											"paused",
											"error",
											"disconnected"
										]
									},
									"canWritePatients": {
										"type": "boolean"
									},
									"canWriteAppointments": {
										"type": "boolean"
									}
								},
								"required": [
									"id",
									"provider",
									"status",
									"canWritePatients",
									"canWriteAppointments"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"link": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/PmsLinkSummary"
							},
							{
								"type": "null"
							}
						]
					},
					"suggestedCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"treatmentPlans": {
						"maxItems": 50,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PmsTreatmentPlanSummary"
						}
					},
					"financials": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/PatientLedgerSummary"
							},
							{
								"type": "null"
							}
						]
					},
					"pendingWrites": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PmsWriteSummary"
						}
					}
				},
				"required": [
					"connection",
					"link",
					"suggestedCount",
					"treatmentPlans",
					"financials",
					"pendingWrites"
				],
				"additionalProperties": false
			},
			"Conversation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"contactPartyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"peerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"pending",
							"snoozed",
							"closed"
						]
					},
					"snoozedUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"assigneeId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"unreadCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastMessageAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastMessagePreview": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastMessageDirection": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"inbound",
									"outbound"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"metadata": {},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endpoints": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ConversationEndpoint"
						}
					},
					"representedPatients": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"patientId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"role": {
									"type": "string",
									"enum": [
										"self",
										"parent",
										"guardian",
										"guarantor",
										"family",
										"other"
									]
								},
								"isPrimary": {
									"type": "boolean"
								},
								"firstName": {
									"type": "string"
								},
								"lastName": {
									"type": "string"
								},
								"preferredName": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"smsOptOut": {
									"type": "boolean"
								},
								"emailOptOut": {
									"type": "boolean"
								},
								"whatsappOptOut": {
									"type": "boolean"
								}
							},
							"required": [
								"patientId",
								"role",
								"isPrimary",
								"firstName",
								"lastName",
								"preferredName",
								"smsOptOut",
								"emailOptOut",
								"whatsappOptOut"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"contactPartyId",
					"patientId",
					"journeyId",
					"peerName",
					"status",
					"snoozedUntil",
					"assigneeId",
					"unreadCount",
					"lastMessageAt",
					"lastMessagePreview",
					"lastMessageDirection",
					"metadata",
					"createdAt",
					"updatedAt",
					"endpoints",
					"representedPatients"
				],
				"additionalProperties": false
			},
			"ConversationEndpoint": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"conversationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"channel": {
						"type": "string",
						"enum": [
							"whatsapp",
							"sms",
							"email",
							"webchat",
							"messenger",
							"instagram",
							"telegram",
							"tiktok",
							"facebook_comments",
							"instagram_comments"
						]
					},
					"externalKey": {
						"type": "string"
					},
					"handle": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastInboundAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"conversationId",
					"connectionId",
					"channel",
					"externalKey",
					"handle",
					"lastInboundAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ConversationListItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"contactPartyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"peerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"pending",
							"snoozed",
							"closed"
						]
					},
					"snoozedUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"assigneeId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"unreadCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastMessageAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastMessagePreview": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastMessageDirection": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"inbound",
									"outbound"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"metadata": {},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endpoints": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ConversationEndpoint"
						}
					},
					"representedPatients": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"patientId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"role": {
									"type": "string",
									"enum": [
										"self",
										"parent",
										"guardian",
										"guarantor",
										"family",
										"other"
									]
								},
								"isPrimary": {
									"type": "boolean"
								},
								"firstName": {
									"type": "string"
								},
								"lastName": {
									"type": "string"
								},
								"preferredName": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"smsOptOut": {
									"type": "boolean"
								},
								"emailOptOut": {
									"type": "boolean"
								},
								"whatsappOptOut": {
									"type": "boolean"
								}
							},
							"required": [
								"patientId",
								"role",
								"isPrimary",
								"firstName",
								"lastName",
								"preferredName",
								"smsOptOut",
								"emailOptOut",
								"whatsappOptOut"
							],
							"additionalProperties": false
						}
					},
					"patient": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ConversationPatientSummary"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"contactPartyId",
					"patientId",
					"journeyId",
					"peerName",
					"status",
					"snoozedUntil",
					"assigneeId",
					"unreadCount",
					"lastMessageAt",
					"lastMessagePreview",
					"lastMessageDirection",
					"metadata",
					"createdAt",
					"updatedAt",
					"endpoints",
					"representedPatients",
					"patient"
				],
				"additionalProperties": false
			},
			"ConversationDetail": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"contactPartyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"peerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"pending",
							"snoozed",
							"closed"
						]
					},
					"snoozedUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"assigneeId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"unreadCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastMessageAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastMessagePreview": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastMessageDirection": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"inbound",
									"outbound"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"metadata": {},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endpoints": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ConversationEndpoint"
						}
					},
					"representedPatients": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"patientId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"role": {
									"type": "string",
									"enum": [
										"self",
										"parent",
										"guardian",
										"guarantor",
										"family",
										"other"
									]
								},
								"isPrimary": {
									"type": "boolean"
								},
								"firstName": {
									"type": "string"
								},
								"lastName": {
									"type": "string"
								},
								"preferredName": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"smsOptOut": {
									"type": "boolean"
								},
								"emailOptOut": {
									"type": "boolean"
								},
								"whatsappOptOut": {
									"type": "boolean"
								}
							},
							"required": [
								"patientId",
								"role",
								"isPrimary",
								"firstName",
								"lastName",
								"preferredName",
								"smsOptOut",
								"emailOptOut",
								"whatsappOptOut"
							],
							"additionalProperties": false
						}
					},
					"patient": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ConversationPatientSummary"
							},
							{
								"type": "null"
							}
						]
					},
					"messages": {
						"type": "object",
						"properties": {
							"items": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/Message"
								}
							},
							"nextCursor": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"items",
							"nextCursor"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"id",
					"organizationId",
					"contactPartyId",
					"patientId",
					"journeyId",
					"peerName",
					"status",
					"snoozedUntil",
					"assigneeId",
					"unreadCount",
					"lastMessageAt",
					"lastMessagePreview",
					"lastMessageDirection",
					"metadata",
					"createdAt",
					"updatedAt",
					"endpoints",
					"representedPatients",
					"patient"
				],
				"additionalProperties": false
			},
			"ConversationPatientSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"enquiry",
							"lead",
							"patient",
							"inactive",
							"archived",
							"deceased"
						]
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"smsOptOut": {
						"type": "boolean"
					},
					"emailOptOut": {
						"type": "boolean"
					},
					"whatsappOptOut": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"firstName",
					"lastName",
					"preferredName",
					"status",
					"email",
					"phoneMobile",
					"smsOptOut",
					"emailOptOut",
					"whatsappOptOut"
				],
				"additionalProperties": false
			},
			"Message": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"conversationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"contactPartyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"subjectPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"connectionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"whatsapp",
									"sms",
									"email",
									"webchat",
									"messenger",
									"instagram",
									"telegram",
									"tiktok",
									"facebook_comments",
									"instagram_comments"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"endpointId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"direction": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"inbound",
									"outbound"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"type": {
						"type": "string",
						"enum": [
							"text",
							"image",
							"video",
							"audio",
							"document",
							"sticker",
							"location",
							"template",
							"system",
							"note"
						]
					},
					"purpose": {
						"type": "string",
						"enum": [
							"conversational",
							"transactional",
							"marketing"
						]
					},
					"body": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"contentRedacted": {
						"type": "boolean"
					},
					"attachments": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"mime": {
									"type": "string"
								},
								"size": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"filename": {
									"type": "string"
								},
								"width": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"height": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"pending": {
									"type": "boolean"
								},
								"unavailable": {
									"type": "boolean",
									"const": true
								}
							},
							"required": [
								"mime"
							],
							"additionalProperties": false
						}
					},
					"templateId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"campaignId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"campaignRecipientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"sent",
							"delivered",
							"read",
							"failed"
						]
					},
					"errorCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"error": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"providerMessageId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"dispatchGeneration": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 1,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"metadata": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deliveredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"readAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"clientRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"bodyHtml": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"conversationId",
					"contactPartyId",
					"subjectPatientId",
					"connectionId",
					"channel",
					"endpointId",
					"direction",
					"type",
					"purpose",
					"body",
					"contentRedacted",
					"attachments",
					"templateId",
					"campaignId",
					"campaignRecipientId",
					"status",
					"errorCode",
					"error",
					"providerMessageId",
					"dispatchGeneration",
					"metadata",
					"createdById",
					"createdByName",
					"createdBySource",
					"sentAt",
					"deliveredAt",
					"readAt",
					"createdAt",
					"clientRef",
					"bodyHtml"
				],
				"additionalProperties": false
			},
			"InboxCounts": {
				"type": "object",
				"properties": {
					"open": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"mine": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"unassigned": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"unread": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"byChannel": {
						"type": "object",
						"propertyNames": {
							"type": "string",
							"enum": [
								"whatsapp",
								"sms",
								"email",
								"webchat",
								"messenger",
								"instagram",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments"
							]
						},
						"additionalProperties": {
							"type": "integer",
							"minimum": -9007199254740991,
							"maximum": 9007199254740991
						},
						"required": [
							"whatsapp",
							"sms",
							"email",
							"webchat",
							"messenger",
							"instagram",
							"telegram",
							"tiktok",
							"facebook_comments",
							"instagram_comments"
						]
					}
				},
				"required": [
					"open",
					"mine",
					"unassigned",
					"unread",
					"byChannel"
				],
				"additionalProperties": false
			},
			"MessageTemplate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"name": {
						"type": "string"
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"whatsapp",
									"sms",
									"email",
									"webchat",
									"messenger",
									"instagram",
									"telegram",
									"tiktok",
									"facebook_comments",
									"instagram_comments"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"subject": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"body": {
						"type": "string"
					},
					"whatsappTemplateRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"language": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"whatsappCategory": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"utility",
									"marketing",
									"authentication"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"whatsappStatus": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"draft",
									"submitting",
									"pending",
									"approved",
									"rejected",
									"paused",
									"disabled",
									"parked"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"doc": {},
					"bodyHtml": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"version",
					"name",
					"channel",
					"subject",
					"body",
					"whatsappTemplateRef",
					"language",
					"whatsappCategory",
					"whatsappStatus",
					"doc",
					"bodyHtml",
					"position",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"WhatsappTemplateRegistration": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"wabaId": {
						"type": "string"
					},
					"versionNo": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"name": {
						"type": "string"
					},
					"language": {
						"type": "string"
					},
					"requestedCategory": {
						"type": "string",
						"enum": [
							"utility",
							"marketing",
							"authentication"
						]
					},
					"effectiveCategory": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"utility",
									"marketing",
									"authentication"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"submitting",
							"pending",
							"approved",
							"rejected",
							"paused",
							"disabled",
							"parked"
						]
					},
					"statusReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"draftBody": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"parameterTags": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"bodyText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"supported": {
						"type": "boolean"
					},
					"providerTemplateId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"submittedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"publishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"wabaId",
					"versionNo",
					"name",
					"language",
					"requestedCategory",
					"effectiveCategory",
					"status",
					"statusReason",
					"draftBody",
					"parameterTags",
					"bodyText",
					"supported",
					"providerTemplateId",
					"submittedAt",
					"reviewedAt",
					"publishedAt",
					"parkedAt",
					"lastError",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Sequence": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"name": {
						"type": "string"
					},
					"trigger": {
						"type": "string",
						"enum": [
							"journey_created",
							"stage_entered",
							"journey_won",
							"journey_lost"
						]
					},
					"stageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"stopOnReply": {
						"type": "boolean"
					},
					"stopOnStageChange": {
						"type": "boolean"
					},
					"enabled": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"steps": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/SequenceStep"
						}
					},
					"activeEnrollments": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"version",
					"name",
					"trigger",
					"stageId",
					"treatmentIds",
					"stopOnReply",
					"stopOnStageChange",
					"enabled",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"steps",
					"activeEnrollments"
				],
				"additionalProperties": false
			},
			"SequenceStep": {
				"oneOf": [
					{
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"position": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"pausedAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"kind": {
								"type": "string",
								"const": "send_message"
							},
							"config": {
								"type": "object",
								"properties": {
									"channel": {
										"type": "string",
										"enum": [
											"email",
											"sms",
											"whatsapp"
										]
									},
									"templateId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"templateParams": {
										"anyOf": [
											{
												"maxItems": 10,
												"type": "array",
												"items": {
													"type": "string",
													"maxLength": 200
												}
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"channel",
									"templateId",
									"templateParams"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"id",
							"position",
							"pausedAt",
							"kind",
							"config"
						],
						"additionalProperties": false
					},
					{
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"position": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"pausedAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"kind": {
								"type": "string",
								"const": "wait"
							},
							"config": {
								"type": "object",
								"properties": {
									"waitMinutes": {
										"type": "integer",
										"minimum": 0,
										"maximum": 527040
									},
									"businessHoursOnly": {
										"type": "boolean"
									}
								},
								"required": [
									"waitMinutes",
									"businessHoursOnly"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"id",
							"position",
							"pausedAt",
							"kind",
							"config"
						],
						"additionalProperties": false
					},
					{
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"position": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"pausedAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"kind": {
								"type": "string",
								"const": "create_task"
							},
							"config": {
								"type": "object",
								"properties": {
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"note": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"assigneeId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"dueOffsetMinutes": {
										"type": "integer",
										"minimum": 0,
										"maximum": 527040
									},
									"priority": {
										"type": "string",
										"enum": [
											"normal",
											"urgent"
										]
									}
								},
								"required": [
									"title",
									"note",
									"assigneeId",
									"dueOffsetMinutes",
									"priority"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"id",
							"position",
							"pausedAt",
							"kind",
							"config"
						],
						"additionalProperties": false
					},
					{
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"position": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"pausedAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"kind": {
								"type": "string",
								"const": "move_stage"
							},
							"config": {
								"type": "object",
								"properties": {
									"stageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"stageId"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"id",
							"position",
							"pausedAt",
							"kind",
							"config"
						],
						"additionalProperties": false
					},
					{
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"position": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"pausedAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"kind": {
								"type": "string",
								"const": "add_note"
							},
							"config": {
								"type": "object",
								"properties": {
									"body": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"body"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"id",
							"position",
							"pausedAt",
							"kind",
							"config"
						],
						"additionalProperties": false
					}
				]
			},
			"SequenceSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"name": {
						"type": "string"
					},
					"trigger": {
						"type": "string",
						"enum": [
							"journey_created",
							"stage_entered",
							"journey_won",
							"journey_lost"
						]
					},
					"stageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"enabled": {
						"type": "boolean"
					},
					"stepCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"version",
					"name",
					"trigger",
					"stageId",
					"treatmentIds",
					"enabled",
					"stepCount"
				],
				"additionalProperties": false
			},
			"SequenceEnrollment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"sequenceId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"sequenceName": {
						"type": "string"
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"completed",
							"stopped"
						]
					},
					"stoppedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"nextStepPosition": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"nextStepAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"stepCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"startedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"sequenceId",
					"sequenceName",
					"journeyId",
					"patientId",
					"status",
					"stoppedReason",
					"nextStepPosition",
					"nextStepAt",
					"stepCount",
					"startedAt",
					"endedAt"
				],
				"additionalProperties": false
			},
			"ActiveEnrollmentSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"sequenceId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"sequenceName": {
						"type": "string"
					},
					"stepOrdinal": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"stepCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"nextStepAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"sequenceId",
					"sequenceName",
					"stepOrdinal",
					"stepCount",
					"nextStepAt"
				],
				"additionalProperties": false
			},
			"ReminderRule": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"kind": {
						"type": "string",
						"enum": [
							"booking_confirmation",
							"pre_visit",
							"post_visit",
							"no_show_followup",
							"cancellation",
							"reschedule_confirmation"
						]
					},
					"offsetMinutes": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"channel": {
						"type": "string",
						"enum": [
							"whatsapp",
							"sms",
							"email",
							"webchat",
							"messenger",
							"instagram",
							"telegram",
							"tiktok",
							"facebook_comments",
							"instagram_comments"
						]
					},
					"templateId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"templateRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"enabled": {
						"type": "boolean"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"kind",
					"offsetMinutes",
					"channel",
					"templateId",
					"templateRevisionId",
					"enabled",
					"version",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PracticeSettings": {
				"type": "object",
				"properties": {
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"website": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"socials": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"platform": {
									"type": "string",
									"enum": [
										"instagram",
										"facebook",
										"tiktok",
										"youtube",
										"linkedin",
										"x",
										"google"
									]
								},
								"url": {
									"type": "string",
									"maxLength": 500,
									"format": "uri"
								}
							},
							"required": [
								"platform",
								"url"
							],
							"additionalProperties": false
						}
					},
					"emailSignature": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"emailLogoUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"smsSenderName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"brandColor": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"vatNumber": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fiscalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"legalCountry": {
						"type": "string",
						"enum": [
							"AT",
							"BE",
							"BG",
							"CY",
							"DE",
							"EE",
							"ES",
							"FI",
							"FR",
							"GB",
							"GR",
							"IE",
							"IT",
							"LT",
							"LU",
							"LV",
							"MT",
							"NL",
							"PT",
							"SI",
							"SK",
							"US"
						]
					},
					"accountingCurrency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"priceBookVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"timezone": {
						"type": "string",
						"minLength": 1,
						"maxLength": 64
					},
					"automationLocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"gdprConsentMode": {
						"type": "string",
						"enum": [
							"legitimate_interest",
							"explicit_consent"
						]
					},
					"marketingEligibilityMode": {
						"type": "string",
						"enum": [
							"explicit_only",
							"explicit_or_soft_opt_in"
						]
					},
					"monthlyRevenueTargetCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"sendWindow": {
						"type": "object",
						"properties": {
							"days": {
								"type": "array",
								"items": {
									"type": "string",
									"enum": [
										"mon",
										"tue",
										"wed",
										"thu",
										"fri",
										"sat",
										"sun"
									]
								}
							},
							"start": {
								"type": "string"
							},
							"end": {
								"type": "string"
							}
						},
						"required": [
							"days",
							"start",
							"end"
						],
						"additionalProperties": false
					},
					"aiCallingWindow": {
						"type": "object",
						"properties": {
							"days": {
								"type": "array",
								"items": {
									"type": "string",
									"enum": [
										"mon",
										"tue",
										"wed",
										"thu",
										"fri",
										"sat",
										"sun"
									]
								}
							},
							"start": {
								"type": "string"
							},
							"end": {
								"type": "string"
							}
						},
						"required": [
							"days",
							"start",
							"end"
						],
						"additionalProperties": false
					},
					"messageRetentionDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 30,
								"maximum": 3650
							},
							{
								"type": "null"
							}
						]
					},
					"activityRetentionDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 30,
								"maximum": 3650
							},
							{
								"type": "null"
							}
						]
					},
					"auditDetailRetentionDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 30,
								"maximum": 3650
							},
							{
								"type": "null"
							}
						]
					},
					"recordingRetentionDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 7,
								"maximum": 3650
							},
							{
								"type": "null"
							}
						]
					},
					"retentionApplicationStatus": {
						"type": "string",
						"enum": [
							"applied",
							"applying",
							"attention_required"
						]
					}
				},
				"required": [
					"organizationId",
					"website",
					"socials",
					"emailSignature",
					"emailLogoUrl",
					"smsSenderName",
					"brandColor",
					"vatNumber",
					"fiscalCode",
					"legalCountry",
					"accountingCurrency",
					"priceBookVersion",
					"timezone",
					"automationLocationId",
					"gdprConsentMode",
					"marketingEligibilityMode",
					"monthlyRevenueTargetCents",
					"sendWindow",
					"aiCallingWindow",
					"messageRetentionDays",
					"activityRetentionDays",
					"auditDetailRetentionDays",
					"recordingRetentionDays",
					"retentionApplicationStatus"
				],
				"additionalProperties": false
			},
			"WebsiteProfile": {
				"type": "object",
				"properties": {
					"phone": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine2": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"province": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"country": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"AD",
									"AE",
									"AF",
									"AG",
									"AI",
									"AL",
									"AM",
									"AO",
									"AQ",
									"AR",
									"AS",
									"AT",
									"AU",
									"AW",
									"AX",
									"AZ",
									"BA",
									"BB",
									"BD",
									"BE",
									"BF",
									"BG",
									"BH",
									"BI",
									"BJ",
									"BL",
									"BM",
									"BN",
									"BO",
									"BQ",
									"BR",
									"BS",
									"BT",
									"BV",
									"BW",
									"BY",
									"BZ",
									"CA",
									"CC",
									"CD",
									"CF",
									"CG",
									"CH",
									"CI",
									"CK",
									"CL",
									"CM",
									"CN",
									"CO",
									"CR",
									"CU",
									"CV",
									"CW",
									"CX",
									"CY",
									"CZ",
									"DE",
									"DJ",
									"DK",
									"DM",
									"DO",
									"DZ",
									"EC",
									"EE",
									"EG",
									"EH",
									"ER",
									"ES",
									"ET",
									"FI",
									"FJ",
									"FK",
									"FM",
									"FO",
									"FR",
									"GA",
									"GB",
									"GD",
									"GE",
									"GF",
									"GG",
									"GH",
									"GI",
									"GL",
									"GM",
									"GN",
									"GP",
									"GQ",
									"GR",
									"GS",
									"GT",
									"GU",
									"GW",
									"GY",
									"HK",
									"HM",
									"HN",
									"HR",
									"HT",
									"HU",
									"ID",
									"IE",
									"IL",
									"IM",
									"IN",
									"IO",
									"IQ",
									"IR",
									"IS",
									"IT",
									"JE",
									"JM",
									"JO",
									"JP",
									"KE",
									"KG",
									"KH",
									"KI",
									"KM",
									"KN",
									"KP",
									"KR",
									"KW",
									"KY",
									"KZ",
									"LA",
									"LB",
									"LC",
									"LI",
									"LK",
									"LR",
									"LS",
									"LT",
									"LU",
									"LV",
									"LY",
									"MA",
									"MC",
									"MD",
									"ME",
									"MF",
									"MG",
									"MH",
									"MK",
									"ML",
									"MM",
									"MN",
									"MO",
									"MP",
									"MQ",
									"MR",
									"MS",
									"MT",
									"MU",
									"MV",
									"MW",
									"MX",
									"MY",
									"MZ",
									"NA",
									"NC",
									"NE",
									"NF",
									"NG",
									"NI",
									"NL",
									"NO",
									"NP",
									"NR",
									"NU",
									"NZ",
									"OM",
									"PA",
									"PE",
									"PF",
									"PG",
									"PH",
									"PK",
									"PL",
									"PM",
									"PN",
									"PR",
									"PS",
									"PT",
									"PW",
									"PY",
									"QA",
									"RE",
									"RO",
									"RS",
									"RU",
									"RW",
									"SA",
									"SB",
									"SC",
									"SD",
									"SE",
									"SG",
									"SH",
									"SI",
									"SJ",
									"SK",
									"SL",
									"SM",
									"SN",
									"SO",
									"SR",
									"SS",
									"ST",
									"SV",
									"SX",
									"SY",
									"SZ",
									"TC",
									"TD",
									"TF",
									"TG",
									"TH",
									"TJ",
									"TK",
									"TL",
									"TM",
									"TN",
									"TO",
									"TR",
									"TT",
									"TV",
									"TW",
									"TZ",
									"UA",
									"UG",
									"UM",
									"US",
									"UY",
									"UZ",
									"VA",
									"VC",
									"VE",
									"VG",
									"VI",
									"VN",
									"VU",
									"WF",
									"WS",
									"YE",
									"YT",
									"ZA",
									"ZM",
									"ZW"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"subdivision": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"timezone": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1,
								"maxLength": 64
							},
							{
								"type": "null"
							}
						]
					},
					"openingHours": {
						"anyOf": [
							{
								"type": "object",
								"propertyNames": {
									"type": "string",
									"enum": [
										"mon",
										"tue",
										"wed",
										"thu",
										"fri",
										"sat",
										"sun"
									]
								},
								"additionalProperties": {
									"maxItems": 4,
									"type": "array",
									"items": {
										"type": "object",
										"properties": {
											"open": {
												"type": "string",
												"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
											},
											"close": {
												"type": "string",
												"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
											}
										},
										"required": [
											"open",
											"close"
										],
										"additionalProperties": false
									}
								}
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"phone",
					"email",
					"addressLine1",
					"addressLine2",
					"city",
					"province",
					"postalCode",
					"country",
					"subdivision",
					"timezone",
					"openingHours"
				],
				"additionalProperties": false
			},
			"PracticePitch": {
				"type": "object",
				"properties": {
					"doc": {}
				},
				"required": [
					"doc"
				],
				"additionalProperties": false
			},
			"LeadPitch": {
				"type": "object",
				"properties": {
					"practice": {},
					"treatment": {}
				},
				"required": [
					"practice",
					"treatment"
				],
				"additionalProperties": false
			},
			"PaymentSettings": {
				"type": "object",
				"properties": {
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"connectionStatus": {
						"type": "string",
						"enum": [
							"not_connected",
							"onboarding",
							"switch_pending",
							"ready",
							"restricted"
						]
					},
					"chargesEnabled": {
						"type": "boolean"
					},
					"payoutsEnabled": {
						"type": "boolean"
					},
					"detailsSubmitted": {
						"type": "boolean"
					},
					"depositsEnabled": {
						"type": "boolean"
					},
					"defaultDepositAmountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"EUR",
									"GBP",
									"USD"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"noShowPolicy": {
						"type": "string",
						"enum": [
							"forfeit",
							"manual"
						]
					},
					"linkExpiryDays": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"depositWhatsappTemplateId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"organizationId",
					"connectionStatus",
					"chargesEnabled",
					"payoutsEnabled",
					"detailsSubmitted",
					"depositsEnabled",
					"defaultDepositAmountCents",
					"currency",
					"noShowPolicy",
					"linkExpiryDays",
					"depositWhatsappTemplateId"
				],
				"additionalProperties": false
			},
			"PaymentsSummary": {
				"type": "object",
				"properties": {
					"chargesEnabled": {
						"type": "boolean"
					},
					"depositsEnabled": {
						"type": "boolean"
					},
					"defaultDepositAmountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"EUR",
									"GBP",
									"USD"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"noShowPolicy": {
						"type": "string",
						"enum": [
							"forfeit",
							"manual"
						]
					}
				},
				"required": [
					"chargesEnabled",
					"depositsEnabled",
					"defaultDepositAmountCents",
					"currency",
					"noShowPolicy"
				],
				"additionalProperties": false
			},
			"DepositRequest": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"paid",
							"paid_external",
							"expired",
							"cancelled",
							"refund_pending",
							"refunded",
							"refund_failed",
							"review_required",
							"forfeited"
						]
					},
					"amountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"linkToken": {
						"type": "string"
					},
					"expiresAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"stripeCheckoutSessionId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"checkoutAttempt": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"stripePaymentIntentId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"refundedAmountCents": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"refundReviewCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"publication_exhausted",
									"publication_deadline_elapsed",
									"provider_reconciliation_exhausted",
									"provider_reconciliation_deadline_elapsed",
									"provider_outcome_ambiguous",
									"provider_amount_conflict",
									"provider_over_refund",
									"provider_refund_list_truncated",
									"provider_refund_attempt_conflict",
									"manual_recheck_exhausted"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"refundError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"clickCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"firstOpenedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"paidAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"paidExternallyAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"refundedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"forfeitedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"flaggedForReviewAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"journeyId",
					"treatmentId",
					"appointmentId",
					"status",
					"amountCents",
					"currency",
					"linkToken",
					"expiresAt",
					"stripeCheckoutSessionId",
					"checkoutAttempt",
					"stripePaymentIntentId",
					"refundedAmountCents",
					"refundReviewCode",
					"refundError",
					"clickCount",
					"firstOpenedAt",
					"paidAt",
					"paidExternallyAt",
					"refundedAt",
					"forfeitedAt",
					"cancelledAt",
					"flaggedForReviewAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PatientDisplayDeposit": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"paid",
							"paid_external",
							"expired",
							"cancelled",
							"refund_pending",
							"refunded",
							"refund_failed",
							"review_required",
							"forfeited"
						]
					},
					"amountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"linkToken": {
						"type": "string"
					},
					"expiresAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"stripeCheckoutSessionId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"checkoutAttempt": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"stripePaymentIntentId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"refundedAmountCents": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"refundReviewCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"publication_exhausted",
									"publication_deadline_elapsed",
									"provider_reconciliation_exhausted",
									"provider_reconciliation_deadline_elapsed",
									"provider_outcome_ambiguous",
									"provider_amount_conflict",
									"provider_over_refund",
									"provider_refund_list_truncated",
									"provider_refund_attempt_conflict",
									"manual_recheck_exhausted"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"refundError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"clickCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"firstOpenedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"paidAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"paidExternallyAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"refundedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"forfeitedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"flaggedForReviewAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"unexpectedPaymentRefundStatus": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"pending",
									"failed",
									"review"
								]
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"journeyId",
					"treatmentId",
					"appointmentId",
					"status",
					"amountCents",
					"currency",
					"linkToken",
					"expiresAt",
					"stripeCheckoutSessionId",
					"checkoutAttempt",
					"stripePaymentIntentId",
					"refundedAmountCents",
					"refundReviewCode",
					"refundError",
					"clickCount",
					"firstOpenedAt",
					"paidAt",
					"paidExternallyAt",
					"refundedAt",
					"forfeitedAt",
					"cancelledAt",
					"flaggedForReviewAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"unexpectedPaymentRefundStatus"
				],
				"additionalProperties": false
			},
			"DepositChannelOutcome": {
				"type": "object",
				"properties": {
					"channel": {
						"type": "string",
						"enum": [
							"sms",
							"email",
							"whatsapp"
						]
					},
					"ok": {
						"type": "boolean"
					},
					"error": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"channel",
					"ok",
					"error"
				],
				"additionalProperties": false
			},
			"DepositSendResult": {
				"type": "object",
				"properties": {
					"deposit": {
						"$ref": "#/components/schemas/DepositRequest"
					},
					"channels": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/DepositChannelOutcome"
						}
					},
					"link": {
						"type": "string"
					}
				},
				"required": [
					"deposit",
					"channels",
					"link"
				],
				"additionalProperties": false
			},
			"ReferralProgram": {
				"type": "object",
				"properties": {
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"enabled": {
						"type": "boolean"
					},
					"publicToken": {
						"type": "string"
					},
					"programUrl": {
						"type": "string"
					},
					"headline": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"description": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"termsText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"privacyNoticeText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"shareMessage": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"advocateRewardType": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"credit",
									"voucher",
									"donation",
									"custom"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"advocateRewardAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"advocateRewardCustomText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"friendRewardType": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"credit",
									"voucher",
									"donation",
									"custom"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"friendRewardAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"friendRewardCustomText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"holdDays": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"minTreatmentValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"qualifyWindowDays": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"voucherExpiryMonths": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"privateTreatmentsOnly": {
						"type": "boolean"
					},
					"defaultTreatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"updatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"version",
					"enabled",
					"publicToken",
					"programUrl",
					"headline",
					"description",
					"termsText",
					"privacyNoticeText",
					"shareMessage",
					"advocateRewardType",
					"advocateRewardAmountCents",
					"advocateRewardCustomText",
					"friendRewardType",
					"friendRewardAmountCents",
					"friendRewardCustomText",
					"holdDays",
					"minTreatmentValueCents",
					"qualifyWindowDays",
					"voucherExpiryMonths",
					"privateTreatmentsOnly",
					"defaultTreatmentId",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ReferralAdvocate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"shareCode": {
						"type": "string"
					},
					"shareUrl": {
						"type": "string"
					},
					"statusUrl": {
						"type": "string"
					},
					"revokedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"patientId",
					"shareCode",
					"shareUrl",
					"statusUrl",
					"revokedAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ReferralAdvocateListItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"shareCode": {
						"type": "string"
					},
					"revokedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"referralCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"qualifiedCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"patientId",
					"firstName",
					"lastName",
					"shareCode",
					"revokedAt",
					"createdAt",
					"referralCount",
					"qualifiedCount"
				],
				"additionalProperties": false
			},
			"Referral": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"submitted",
							"qualified",
							"disqualified",
							"expired"
						]
					},
					"effectiveStatus": {
						"type": "string",
						"enum": [
							"submitted",
							"qualified",
							"disqualified",
							"expired"
						]
					},
					"statusCorrections": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReferralStatusCorrectionEvent"
						}
					},
					"source": {
						"type": "string",
						"enum": [
							"share_link",
							"share_code",
							"staff_attribution"
						]
					},
					"advocate": {
						"type": "object",
						"properties": {
							"patientId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"firstName": {
								"type": "string"
							},
							"lastName": {
								"type": "string"
							},
							"shareCode": {
								"type": "string"
							}
						},
						"required": [
							"patientId",
							"firstName",
							"lastName",
							"shareCode"
						],
						"additionalProperties": false
					},
					"friend": {
						"type": "object",
						"properties": {
							"patientId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"firstName": {
								"type": "string"
							},
							"lastName": {
								"type": "string"
							}
						},
						"required": [
							"patientId",
							"firstName",
							"lastName"
						],
						"additionalProperties": false
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"qualifyingJourneyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"qualifiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"holdUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"disqualifiedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"rewards": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReferralReward"
						}
					}
				},
				"required": [
					"id",
					"status",
					"effectiveStatus",
					"statusCorrections",
					"source",
					"advocate",
					"friend",
					"journeyId",
					"qualifyingJourneyId",
					"journeyValueCents",
					"treatmentName",
					"qualifiedAt",
					"holdUntil",
					"expiresAt",
					"disqualifiedReason",
					"createdAt",
					"rewards"
				],
				"additionalProperties": false
			},
			"ReferralReward": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"referralId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"side": {
						"type": "string",
						"enum": [
							"advocate",
							"friend"
						]
					},
					"type": {
						"type": "string",
						"enum": [
							"credit",
							"voucher",
							"donation",
							"custom"
						]
					},
					"amountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"effectiveAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"adjustmentTotalCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"adjustmentRequired": {
						"type": "boolean"
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"description": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"approved",
							"issued",
							"declined",
							"expired"
						]
					},
					"availableAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"approvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"issuedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"declinedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"declinedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"fulfillmentRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"recipient": {
						"type": "object",
						"properties": {
							"patientId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"firstName": {
								"type": "string"
							},
							"lastName": {
								"type": "string"
							}
						},
						"required": [
							"patientId",
							"firstName",
							"lastName"
						],
						"additionalProperties": false
					},
					"fulfillmentEvents": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReferralRewardFulfillmentEvent"
						}
					}
				},
				"required": [
					"id",
					"referralId",
					"side",
					"type",
					"amountCents",
					"effectiveAmountCents",
					"adjustmentTotalCents",
					"adjustmentRequired",
					"currency",
					"description",
					"status",
					"availableAt",
					"approvedAt",
					"issuedAt",
					"declinedAt",
					"declinedReason",
					"expiresAt",
					"fulfillmentRef",
					"recipient",
					"fulfillmentEvents"
				],
				"additionalProperties": false
			},
			"ReferralRewardQueueItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"referralId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"side": {
						"type": "string",
						"enum": [
							"advocate",
							"friend"
						]
					},
					"type": {
						"type": "string",
						"enum": [
							"credit",
							"voucher",
							"donation",
							"custom"
						]
					},
					"amountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"effectiveAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"adjustmentTotalCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"adjustmentRequired": {
						"type": "boolean"
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"description": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"approved",
							"issued",
							"declined",
							"expired"
						]
					},
					"availableAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"approvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"issuedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"declinedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"declinedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"fulfillmentRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"recipient": {
						"type": "object",
						"properties": {
							"patientId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"firstName": {
								"type": "string"
							},
							"lastName": {
								"type": "string"
							}
						},
						"required": [
							"patientId",
							"firstName",
							"lastName"
						],
						"additionalProperties": false
					},
					"fulfillmentEvents": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReferralRewardFulfillmentEvent"
						}
					},
					"referral": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"status": {
								"type": "string",
								"enum": [
									"submitted",
									"qualified",
									"disqualified",
									"expired"
								]
							},
							"advocate": {
								"type": "object",
								"properties": {
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"firstName": {
										"type": "string"
									},
									"lastName": {
										"type": "string"
									},
									"shareCode": {
										"type": "string"
									}
								},
								"required": [
									"patientId",
									"firstName",
									"lastName",
									"shareCode"
								],
								"additionalProperties": false
							},
							"friend": {
								"type": "object",
								"properties": {
									"patientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"firstName": {
										"type": "string"
									},
									"lastName": {
										"type": "string"
									}
								},
								"required": [
									"patientId",
									"firstName",
									"lastName"
								],
								"additionalProperties": false
							},
							"qualifyingJourneyId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"journeyValueCents": {
								"anyOf": [
									{
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									{
										"type": "null"
									}
								]
							},
							"treatmentName": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"qualifiedAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"id",
							"status",
							"advocate",
							"friend",
							"qualifyingJourneyId",
							"journeyValueCents",
							"treatmentName",
							"qualifiedAt"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"id",
					"referralId",
					"side",
					"type",
					"amountCents",
					"effectiveAmountCents",
					"adjustmentTotalCents",
					"adjustmentRequired",
					"currency",
					"description",
					"status",
					"availableAt",
					"approvedAt",
					"issuedAt",
					"declinedAt",
					"declinedReason",
					"expiresAt",
					"fulfillmentRef",
					"recipient",
					"fulfillmentEvents",
					"referral"
				],
				"additionalProperties": false
			},
			"PatientReferralInfo": {
				"type": "object",
				"properties": {
					"programEnabled": {
						"type": "boolean"
					},
					"advocate": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ReferralAdvocate"
							},
							{
								"type": "null"
							}
						]
					},
					"referralsMade": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"status": {
									"type": "string",
									"enum": [
										"submitted",
										"qualified",
										"disqualified",
										"expired"
									]
								},
								"effectiveStatus": {
									"type": "string",
									"enum": [
										"submitted",
										"qualified",
										"disqualified",
										"expired"
									]
								},
								"friend": {
									"type": "object",
									"properties": {
										"patientId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"firstName": {
											"type": "string"
										},
										"lastName": {
											"type": "string"
										}
									},
									"required": [
										"patientId",
										"firstName",
										"lastName"
									],
									"additionalProperties": false
								},
								"createdAt": {
									"type": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
								},
								"qualifiedAt": {
									"anyOf": [
										{
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"id",
								"status",
								"effectiveStatus",
								"friend",
								"createdAt",
								"qualifiedAt"
							],
							"additionalProperties": false
						}
					},
					"rewards": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReferralReward"
						}
					},
					"referredBy": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"referralId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"status": {
										"type": "string",
										"enum": [
											"submitted",
											"qualified",
											"disqualified",
											"expired"
										]
									},
									"effectiveStatus": {
										"type": "string",
										"enum": [
											"submitted",
											"qualified",
											"disqualified",
											"expired"
										]
									},
									"advocate": {
										"type": "object",
										"properties": {
											"patientId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"firstName": {
												"type": "string"
											},
											"lastName": {
												"type": "string"
											}
										},
										"required": [
											"patientId",
											"firstName",
											"lastName"
										],
										"additionalProperties": false
									}
								},
								"required": [
									"referralId",
									"status",
									"effectiveStatus",
									"advocate"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"programEnabled",
					"advocate",
					"referralsMade",
					"rewards",
					"referredBy"
				],
				"additionalProperties": false
			},
			"ReferralLandingConfig": {
				"type": "object",
				"properties": {
					"practice": {
						"type": "object",
						"properties": {
							"name": {
								"type": "string"
							},
							"brandColor": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"phone": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"name",
							"brandColor",
							"phone"
						],
						"additionalProperties": false
					},
					"advocateFirstName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"headline": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"description": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"termsText": {
						"type": "string"
					},
					"privacyNoticeText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"advocateReward": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"friendReward": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"privateTreatmentsOnly": {
						"type": "boolean"
					},
					"requiresCode": {
						"type": "boolean"
					},
					"bookingUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"practice",
					"advocateFirstName",
					"headline",
					"description",
					"termsText",
					"privacyNoticeText",
					"advocateReward",
					"friendReward",
					"privateTreatmentsOnly",
					"requiresCode",
					"bookingUrl"
				],
				"additionalProperties": false
			},
			"ReferralSubmitResult": {
				"type": "object",
				"properties": {
					"ok": {
						"type": "boolean",
						"const": true
					},
					"practiceName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"friendReward": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"ok",
					"practiceName",
					"friendReward"
				],
				"additionalProperties": false
			},
			"ReferralAdvocateStatus": {
				"type": "object",
				"properties": {
					"practice": {
						"type": "object",
						"properties": {
							"name": {
								"type": "string"
							},
							"brandColor": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"phone": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"name",
							"brandColor",
							"phone"
						],
						"additionalProperties": false
					},
					"shareUrl": {
						"type": "string"
					},
					"shareCode": {
						"type": "string"
					},
					"shareMessage": {
						"type": "string"
					},
					"advocateReward": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"friendReward": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"termsText": {
						"type": "string"
					},
					"referrals": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"friendFirstName": {
									"type": "string"
								},
								"status": {
									"type": "string",
									"enum": [
										"invited",
										"in_progress",
										"reward_earned",
										"closed"
									]
								},
								"submittedAt": {
									"type": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
								}
							},
							"required": [
								"friendFirstName",
								"status",
								"submittedAt"
							],
							"additionalProperties": false
						}
					},
					"rewards": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"description": {
									"type": "string"
								},
								"status": {
									"type": "string",
									"enum": [
										"pending",
										"approved",
										"issued",
										"declined",
										"expired"
									]
								},
								"fulfillmentRef": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"expiresAt": {
									"anyOf": [
										{
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"description",
								"status",
								"fulfillmentRef",
								"expiresAt"
							],
							"additionalProperties": false
						}
					},
					"balance": {
						"type": "object",
						"properties": {
							"pendingCents": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"approvedCents": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"issuedCents": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"currency": {
								"type": "string",
								"enum": [
									"EUR",
									"GBP",
									"USD"
								]
							}
						},
						"required": [
							"pendingCents",
							"approvedCents",
							"issuedCents",
							"currency"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"practice",
					"shareUrl",
					"shareCode",
					"shareMessage",
					"advocateReward",
					"friendReward",
					"termsText",
					"referrals",
					"rewards",
					"balance"
				],
				"additionalProperties": false
			},
			"DialerSettings": {
				"type": "object",
				"properties": {
					"provider": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"active",
							"error"
						]
					},
					"statusError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"recordingEnabled": {
						"type": "boolean"
					},
					"defaultNumberId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kycRequired": {
						"type": "boolean"
					},
					"country": {
						"type": "string"
					},
					"kycStatus": {
						"type": "string",
						"enum": [
							"none",
							"submitted",
							"pending",
							"approved",
							"declined",
							"expired"
						]
					},
					"kycReview": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/DialerKycReview"
							},
							{
								"type": "null"
							}
						]
					},
					"kycReviewStalled": {
						"type": "boolean"
					},
					"coreAccess": {
						"type": "boolean"
					},
					"numbers": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PhoneNumber"
						}
					},
					"pendingOperations": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/DialerOperation"
						}
					},
					"portoutRequests": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/VoicePortoutRequest"
						}
					},
					"portingOrders": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/VoicePortingOrder"
						}
					},
					"capacitySync": {
						"type": "string",
						"enum": [
							"ready",
							"pending",
							"parked"
						]
					}
				},
				"required": [
					"provider",
					"status",
					"statusError",
					"recordingEnabled",
					"defaultNumberId",
					"kycRequired",
					"country",
					"kycStatus",
					"kycReview",
					"kycReviewStalled",
					"coreAccess",
					"numbers",
					"pendingOperations",
					"portoutRequests",
					"portingOrders",
					"capacitySync"
				],
				"additionalProperties": false
			},
			"PhoneNumber": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"e164": {
						"type": "string"
					},
					"source": {
						"type": "string",
						"enum": [
							"purchased",
							"admin_assigned",
							"ported_in"
						]
					},
					"role": {
						"oneOf": [
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "voice"
									}
								},
								"required": [
									"kind"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "pooled"
									},
									"poolId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"poolName": {
										"type": "string"
									},
									"activationPending": {
										"type": "boolean"
									}
								},
								"required": [
									"kind",
									"poolId",
									"poolName",
									"activationPending"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "static"
									},
									"leadSourceId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"leadSourceName": {
										"type": "string"
									},
									"treatmentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"forwardE164": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"leadSourceId",
									"leadSourceName",
									"treatmentId",
									"locationId",
									"forwardE164"
								],
								"additionalProperties": false
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"requirements_pending",
							"porting",
							"active",
							"parked",
							"port_failed_hold",
							"failed",
							"released",
							"ported_out"
						]
					},
					"statusError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"holdExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"emergencyStatus": {
						"type": "string",
						"enum": [
							"none",
							"pending",
							"validated",
							"rejected",
							"disabled"
						]
					},
					"emergencyLocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"messagingStatus": {
						"type": "string",
						"enum": [
							"none",
							"pending",
							"blocked",
							"enabled"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"e164",
					"source",
					"role",
					"status",
					"statusError",
					"holdExpiresAt",
					"emergencyStatus",
					"emergencyLocationId",
					"messagingStatus",
					"createdAt"
				],
				"additionalProperties": false
			},
			"VoicePortoutRequest": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"authorized",
							"rejected_pending",
							"rejected",
							"completed",
							"withdrawn"
						]
					},
					"pendingAction": {
						"type": "string",
						"enum": [
							"none",
							"authorize",
							"reject"
						]
					},
					"gainingCarrierName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"confirmedFocAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"carrierDeadlineAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewRequired": {
						"type": "boolean"
					},
					"numbers": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"status",
					"pendingAction",
					"gainingCarrierName",
					"confirmedFocAt",
					"carrierDeadlineAt",
					"reviewRequired",
					"numbers",
					"createdAt"
				],
				"additionalProperties": false
			},
			"VoicePortingOrder": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"progressState": {
						"type": "string",
						"enum": [
							"draft",
							"collecting_requirements",
							"submitting",
							"in_carrier_process",
							"remediating",
							"cancel_pending"
						]
					},
					"settlementOutcome": {
						"type": "string",
						"enum": [
							"none",
							"ported",
							"partially_ported",
							"cancelled",
							"failed",
							"mixed"
						]
					},
					"carrierName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"requestedFocAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewRequired": {
						"type": "boolean"
					},
					"reviewReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelRequestedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"children": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"state": {
									"type": "string",
									"enum": [
										"draft",
										"in_process",
										"submitted",
										"exception",
										"foc_confirmed",
										"cancel_pending",
										"cancelled",
										"ported",
										"deleted"
									]
								},
								"confirmedFocAt": {
									"anyOf": [
										{
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										{
											"type": "null"
										}
									]
								},
								"exceptionEpoch": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"amendRevision": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"exceptionCodes": {
									"type": "array",
									"items": {
										"type": "string"
									}
								},
								"exceptionDescription": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"numbers": {
									"type": "array",
									"items": {
										"type": "string"
									}
								},
								"requirements": {
									"type": "array",
									"items": {
										"type": "object",
										"properties": {
											"id": {
												"type": "string"
											},
											"requirementTypeId": {
												"type": "string"
											},
											"fieldType": {
												"type": "string"
											},
											"label": {
												"type": "string"
											},
											"status": {
												"type": "string"
											}
										},
										"required": [
											"id",
											"requirementTypeId",
											"fieldType",
											"label",
											"status"
										],
										"additionalProperties": false
									}
								}
							},
							"required": [
								"id",
								"state",
								"confirmedFocAt",
								"exceptionEpoch",
								"amendRevision",
								"exceptionCodes",
								"exceptionDescription",
								"numbers",
								"requirements"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"id",
					"progressState",
					"settlementOutcome",
					"carrierName",
					"requestedFocAt",
					"reviewRequired",
					"reviewReason",
					"cancelRequestedAt",
					"createdAt",
					"children"
				],
				"additionalProperties": false
			},
			"DialerKycRequirement": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string"
					},
					"label": {
						"type": "string"
					},
					"description": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fieldType": {
						"type": "string",
						"enum": [
							"textual",
							"address",
							"document"
						]
					},
					"example": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"label",
					"description",
					"fieldType",
					"example"
				],
				"additionalProperties": false
			},
			"DialerBootstrap": {
				"type": "object",
				"properties": {
					"configured": {
						"type": "boolean"
					},
					"provider": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"recordingEnabled": {
						"type": "boolean"
					},
					"hasActiveNumber": {
						"type": "boolean"
					},
					"defaultCli": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"backend": {
						"type": "string",
						"enum": [
							"native",
							"assisted",
							"unconfigured"
						]
					}
				},
				"required": [
					"configured",
					"provider",
					"recordingEnabled",
					"hasActiveNumber",
					"defaultCli",
					"backend"
				],
				"additionalProperties": false
			},
			"DialerSessionStart": {
				"type": "object",
				"properties": {
					"sessionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string"
					},
					"backend": {
						"type": "string",
						"enum": [
							"native",
							"assisted"
						]
					},
					"sipUsername": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"loginToken": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"tokenExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"sessionId",
					"provider",
					"backend",
					"sipUsername",
					"loginToken",
					"tokenExpiresAt"
				],
				"additionalProperties": false
			},
			"DialerToken": {
				"type": "object",
				"properties": {
					"loginToken": {
						"type": "string"
					},
					"tokenExpiresAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"loginToken",
					"tokenExpiresAt"
				],
				"additionalProperties": false
			},
			"CallLog": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"sessionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"taskId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"userId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"toNumber": {
						"type": "string"
					},
					"fromNumber": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"dialing",
							"ringing",
							"answered",
							"completed",
							"no_answer",
							"busy",
							"failed",
							"canceled"
						]
					},
					"hangupCause": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"answeredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"endedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"durationSec": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"hasRecording": {
						"type": "boolean"
					},
					"recordingExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"voicemailId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"direction": {
						"type": "string",
						"enum": [
							"inbound",
							"outbound"
						]
					},
					"purpose": {
						"type": "string",
						"enum": [
							"new_lead",
							"follow_up",
							"missed_appointment",
							"plan_acceptance",
							"payment",
							"other",
							"emergency"
						]
					},
					"provider": {
						"type": "string"
					},
					"numberPurpose": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"voice",
									"tracking",
									"sms"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"ringDurationSec": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"voicemail": {
						"type": "boolean"
					},
					"stirShakenAttestation": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"A",
									"B",
									"C"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"stirShakenVerified": {
						"anyOf": [
							{
								"type": "boolean"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"disposition": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"quality": {
						"anyOf": [
							{
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"$ref": "#/components/schemas/CallLegQuality"
								}
							},
							{
								"type": "null"
							}
						]
					},
					"patientName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"aiHandled": {
						"type": "boolean"
					},
					"aiDisposition": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"answered",
									"no_answer",
									"busy",
									"voicemail",
									"failed",
									"transferred"
								]
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"sessionId",
					"taskId",
					"patientId",
					"userId",
					"toNumber",
					"fromNumber",
					"status",
					"hangupCause",
					"startedAt",
					"answeredAt",
					"endedAt",
					"durationSec",
					"hasRecording",
					"recordingExpiresAt",
					"voicemailId",
					"direction",
					"purpose",
					"provider",
					"numberPurpose",
					"ringDurationSec",
					"voicemail",
					"stirShakenAttestation",
					"stirShakenVerified",
					"note",
					"disposition",
					"quality",
					"patientName",
					"aiHandled",
					"aiDisposition"
				],
				"additionalProperties": false
			},
			"DemoDataStatus": {
				"type": "object",
				"properties": {
					"seeded": {
						"type": "boolean"
					},
					"preserved": {
						"type": "boolean"
					},
					"seededAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"preservedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"version": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"counts": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"patients": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"journeys": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"appointments": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"tasks": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"activities": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"tags": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"practitioners": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"operatories": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"appointmentTypes": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"staff": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"conversations": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"messages": {
										"default": 0,
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"patients",
									"journeys",
									"appointments",
									"tasks",
									"activities",
									"tags",
									"practitioners",
									"operatories",
									"appointmentTypes",
									"staff",
									"conversations",
									"messages"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"livePatientCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"clinical": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"step": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"catalogue",
													"identities",
													"charts",
													"plans",
													"diary",
													"money",
													"record",
													"extras",
													"finalize"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"completed": {
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"catalogue",
												"identities",
												"charts",
												"plans",
												"diary",
												"money",
												"record",
												"extras",
												"finalize"
											]
										}
									},
									"skipped": {
										"type": "array",
										"items": {
											"type": "string"
										}
									},
									"counts": {
										"type": "object",
										"properties": {
											"findings": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"procedures": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"treatmentPlans": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"clinicalNotes": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"ledgerEntries": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"invoices": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"recalls": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"perioExams": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"formSubmissions": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"documents": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"diaryAppointments": {
												"default": 0,
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"findings",
											"procedures",
											"treatmentPlans",
											"clinicalNotes",
											"ledgerEntries",
											"invoices",
											"recalls",
											"perioExams",
											"formSubmissions",
											"documents",
											"diaryAppointments"
										],
										"additionalProperties": false
									},
									"completedAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"version",
									"step",
									"completed",
									"skipped",
									"counts",
									"completedAt"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"clinicalAvailable": {
						"type": "boolean"
					}
				},
				"required": [
					"seeded",
					"preserved",
					"seededAt",
					"preservedAt",
					"version",
					"counts",
					"livePatientCount",
					"clinical",
					"clinicalAvailable"
				],
				"additionalProperties": false
			},
			"DemoClinicalStep": {
				"type": "object",
				"properties": {
					"ran": {
						"type": "string",
						"enum": [
							"catalogue",
							"identities",
							"charts",
							"plans",
							"diary",
							"money",
							"record",
							"extras",
							"finalize"
						]
					},
					"nextStep": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"catalogue",
									"identities",
									"charts",
									"plans",
									"diary",
									"money",
									"record",
									"extras",
									"finalize"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"$ref": "#/components/schemas/DemoDataStatus"
					}
				},
				"required": [
					"ran",
					"nextStep",
					"status"
				],
				"additionalProperties": false
			},
			"AuditLogEntry": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"actorUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"actorName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"actorSource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"impersonatedByUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"action": {
						"type": "string",
						"enum": [
							"create",
							"update",
							"delete",
							"merge",
							"export",
							"access",
							"import"
						]
					},
					"entityType": {
						"type": "string"
					},
					"transport": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"purpose": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"entityId": {
						"type": "string"
					},
					"entityLabel": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"changes": {},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"actorUserId",
					"actorName",
					"actorSource",
					"impersonatedByUserId",
					"action",
					"entityType",
					"transport",
					"purpose",
					"practitionerCredentialRevisionId",
					"reauthenticatedAt",
					"entityId",
					"entityLabel",
					"changes",
					"createdAt"
				],
				"additionalProperties": false
			},
			"AuditLogActor": {
				"type": "object",
				"properties": {
					"userId": {
						"type": "string"
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"userId",
					"name"
				],
				"additionalProperties": false
			},
			"ImportMapping": {
				"type": "object",
				"properties": {
					"columns": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"anyOf": [
								{
									"type": "string"
								},
								{
									"type": "null"
								}
							]
						}
					},
					"values": {
						"type": "object",
						"properties": {
							"stages": {
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"type": "string"
								}
							},
							"treatments": {
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"type": "string"
								}
							},
							"leadSources": {
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"type": "string"
								}
							},
							"lostReasons": {
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"type": "string"
								}
							},
							"tags": {
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"type": "string"
								}
							},
							"appointmentTypes": {
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"type": "string"
								}
							},
							"locations": {
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"type": "string"
								}
							}
						},
						"additionalProperties": false
					},
					"options": {
						"type": "object",
						"properties": {
							"country": {
								"type": "string",
								"enum": [
									"AD",
									"AE",
									"AF",
									"AG",
									"AI",
									"AL",
									"AM",
									"AO",
									"AQ",
									"AR",
									"AS",
									"AT",
									"AU",
									"AW",
									"AX",
									"AZ",
									"BA",
									"BB",
									"BD",
									"BE",
									"BF",
									"BG",
									"BH",
									"BI",
									"BJ",
									"BL",
									"BM",
									"BN",
									"BO",
									"BQ",
									"BR",
									"BS",
									"BT",
									"BV",
									"BW",
									"BY",
									"BZ",
									"CA",
									"CC",
									"CD",
									"CF",
									"CG",
									"CH",
									"CI",
									"CK",
									"CL",
									"CM",
									"CN",
									"CO",
									"CR",
									"CU",
									"CV",
									"CW",
									"CX",
									"CY",
									"CZ",
									"DE",
									"DJ",
									"DK",
									"DM",
									"DO",
									"DZ",
									"EC",
									"EE",
									"EG",
									"EH",
									"ER",
									"ES",
									"ET",
									"FI",
									"FJ",
									"FK",
									"FM",
									"FO",
									"FR",
									"GA",
									"GB",
									"GD",
									"GE",
									"GF",
									"GG",
									"GH",
									"GI",
									"GL",
									"GM",
									"GN",
									"GP",
									"GQ",
									"GR",
									"GS",
									"GT",
									"GU",
									"GW",
									"GY",
									"HK",
									"HM",
									"HN",
									"HR",
									"HT",
									"HU",
									"ID",
									"IE",
									"IL",
									"IM",
									"IN",
									"IO",
									"IQ",
									"IR",
									"IS",
									"IT",
									"JE",
									"JM",
									"JO",
									"JP",
									"KE",
									"KG",
									"KH",
									"KI",
									"KM",
									"KN",
									"KP",
									"KR",
									"KW",
									"KY",
									"KZ",
									"LA",
									"LB",
									"LC",
									"LI",
									"LK",
									"LR",
									"LS",
									"LT",
									"LU",
									"LV",
									"LY",
									"MA",
									"MC",
									"MD",
									"ME",
									"MF",
									"MG",
									"MH",
									"MK",
									"ML",
									"MM",
									"MN",
									"MO",
									"MP",
									"MQ",
									"MR",
									"MS",
									"MT",
									"MU",
									"MV",
									"MW",
									"MX",
									"MY",
									"MZ",
									"NA",
									"NC",
									"NE",
									"NF",
									"NG",
									"NI",
									"NL",
									"NO",
									"NP",
									"NR",
									"NU",
									"NZ",
									"OM",
									"PA",
									"PE",
									"PF",
									"PG",
									"PH",
									"PK",
									"PL",
									"PM",
									"PN",
									"PR",
									"PS",
									"PT",
									"PW",
									"PY",
									"QA",
									"RE",
									"RO",
									"RS",
									"RU",
									"RW",
									"SA",
									"SB",
									"SC",
									"SD",
									"SE",
									"SG",
									"SH",
									"SI",
									"SJ",
									"SK",
									"SL",
									"SM",
									"SN",
									"SO",
									"SR",
									"SS",
									"ST",
									"SV",
									"SX",
									"SY",
									"SZ",
									"TC",
									"TD",
									"TF",
									"TG",
									"TH",
									"TJ",
									"TK",
									"TL",
									"TM",
									"TN",
									"TO",
									"TR",
									"TT",
									"TV",
									"TW",
									"TZ",
									"UA",
									"UG",
									"UM",
									"US",
									"UY",
									"UZ",
									"VA",
									"VC",
									"VE",
									"VG",
									"VI",
									"VN",
									"VU",
									"WF",
									"WS",
									"YE",
									"YT",
									"ZA",
									"ZM",
									"ZW"
								]
							},
							"dateFormat": {
								"type": "string",
								"enum": [
									"auto",
									"DMY",
									"MDY",
									"ISO"
								]
							},
							"targetPipelineId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"defaultTreatmentId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"backdate": {
								"type": "boolean"
							}
						},
						"required": [
							"country",
							"dateFormat"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"columns",
					"values",
					"options"
				],
				"additionalProperties": false
			},
			"ImportHeaderSuggestion": {
				"type": "object",
				"properties": {
					"header": {
						"type": "string"
					},
					"target": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"confidence": {
						"type": "string",
						"enum": [
							"preset",
							"synonym",
							"none"
						]
					}
				},
				"required": [
					"header",
					"target",
					"confidence"
				],
				"additionalProperties": false
			},
			"ImportJobCounts": {
				"type": "object",
				"properties": {
					"total": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"created": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"updated": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"skipped": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"held": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"errored": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"total",
					"created",
					"updated",
					"skipped",
					"held",
					"errored"
				],
				"additionalProperties": false
			},
			"ImportJob": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"entity": {
						"type": "string",
						"enum": [
							"patients",
							"composite",
							"journeys",
							"appointments",
							"tasks",
							"treatments",
							"tags",
							"lead_sources",
							"lost_reasons",
							"cancellation_reasons",
							"contact_methods",
							"appointment_types"
						]
					},
					"preset": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"dengro",
									"boxly"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"mapping",
							"scanning",
							"validating",
							"validated",
							"importing",
							"review",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"fileName": {
						"type": "string"
					},
					"fileSize": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"counts": {
						"$ref": "#/components/schemas/ImportJobCounts"
					},
					"error": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"finishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"entity",
					"preset",
					"status",
					"fileName",
					"fileSize",
					"counts",
					"error",
					"createdByName",
					"startedAt",
					"finishedAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ImportJobDetail": {
				"type": "object",
				"properties": {
					"job": {
						"$ref": "#/components/schemas/ImportJob"
					},
					"headers": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"sampleRows": {
						"type": "array",
						"items": {
							"type": "array",
							"items": {
								"type": "string"
							}
						}
					},
					"suggestion": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ImportHeaderSuggestion"
						}
					},
					"mapping": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ImportMapping"
							},
							{
								"type": "null"
							}
						]
					},
					"valueScan": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"type": "array",
							"items": {
								"type": "string"
							}
						}
					},
					"validationReport": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ImportValidationReport"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"job",
					"headers",
					"sampleRows",
					"suggestion",
					"mapping",
					"valueScan",
					"validationReport"
				],
				"additionalProperties": false
			},
			"ImportValidationReport": {
				"type": "object",
				"properties": {
					"total": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"valid": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"wouldCreate": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"wouldUpdate": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"wouldHold": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"skipped": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"errored": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"perCode": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					"sampleErrors": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"rowNumber": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"field": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"code": {
									"type": "string"
								},
								"message": {
									"type": "string"
								}
							},
							"required": [
								"rowNumber",
								"field",
								"code",
								"message"
							],
							"additionalProperties": false
						}
					},
					"unmappedValues": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"type": "array",
							"items": {
								"type": "string"
							}
						}
					}
				},
				"required": [
					"total",
					"valid",
					"wouldCreate",
					"wouldUpdate",
					"wouldHold",
					"skipped",
					"errored",
					"perCode",
					"sampleErrors",
					"unmappedValues"
				],
				"additionalProperties": false
			},
			"ImportRowError": {
				"type": "object",
				"properties": {
					"rowNumber": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"field": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"code": {
						"type": "string"
					},
					"message": {
						"type": "string"
					},
					"rowSnapshot": {}
				},
				"required": [
					"rowNumber",
					"field",
					"code",
					"message",
					"rowSnapshot"
				],
				"additionalProperties": false
			},
			"ImportMatchCandidate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"importJobId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"rowNumber": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"externalRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"score": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"matchedOn": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"state": {
						"type": "string",
						"enum": [
							"suggested",
							"accepted",
							"rejected"
						]
					},
					"rowSnapshot": {},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"patient": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"firstName": {
								"type": "string"
							},
							"lastName": {
								"type": "string"
							},
							"dateOfBirth": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"email": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"phoneMobile": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"status": {
								"type": "string"
							}
						},
						"required": [
							"id",
							"firstName",
							"lastName",
							"dateOfBirth",
							"email",
							"phoneMobile",
							"status"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"id",
					"importJobId",
					"patientId",
					"rowNumber",
					"externalRef",
					"score",
					"matchedOn",
					"state",
					"rowSnapshot",
					"createdAt",
					"patient"
				],
				"additionalProperties": false
			},
			"ExportJob": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"entity": {
						"type": "string",
						"enum": [
							"journeys",
							"appointments",
							"tasks",
							"treatments",
							"tags",
							"lead_sources",
							"lost_reasons",
							"cancellation_reasons",
							"contact_methods",
							"appointment_types"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"expired"
						]
					},
					"counts": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					"fileSize": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"error": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"finishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"entity",
					"status",
					"counts",
					"fileSize",
					"expiresAt",
					"error",
					"createdByName",
					"startedAt",
					"finishedAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"CoreTransferReport": {
				"type": "object",
				"properties": {
					"recoverable": {
						"type": "boolean"
					},
					"warnings": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"unmatchedStaff": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"excluded": {
						"type": "array",
						"items": {
							"type": "string"
						}
					}
				},
				"required": [
					"recoverable",
					"warnings",
					"unmatchedStaff",
					"excluded"
				],
				"additionalProperties": false
			},
			"CoreTransferJob": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"direction": {
						"type": "string",
						"enum": [
							"export",
							"import"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"uploading",
							"queued",
							"exporting",
							"assembling",
							"validating",
							"ready",
							"importing",
							"verifying",
							"cleaning",
							"completed",
							"failed",
							"cancelled",
							"expired"
						]
					},
					"fileName": {
						"type": "string"
					},
					"fileSize": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"partSize": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"counts": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					"report": {
						"$ref": "#/components/schemas/CoreTransferReport"
					},
					"error": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"revision": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"finishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"direction",
					"status",
					"fileName",
					"fileSize",
					"partSize",
					"counts",
					"report",
					"error",
					"revision",
					"expiresAt",
					"createdByName",
					"startedAt",
					"finishedAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"TransferJobs": {
				"type": "object",
				"properties": {
					"imports": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ImportJob"
						}
					},
					"exports": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ExportJob"
						}
					},
					"coreTransfers": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CoreTransferJob"
						}
					},
					"pendingReviewCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"imports",
					"exports",
					"coreTransfers",
					"pendingReviewCount"
				],
				"additionalProperties": false
			},
			"AgreementAcceptance": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
								"description": "Canonical lowercase UUID organization identifier"
							},
							{
								"type": "null"
							}
						]
					},
					"agreementType": {
						"type": "string",
						"enum": [
							"terms",
							"privacy",
							"dpa",
							"baa",
							"eu-addendum",
							"us-comms"
						]
					},
					"version": {
						"type": "string"
					},
					"acceptedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"acceptedByName": {
						"type": "string"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"agreementType",
					"version",
					"acceptedById",
					"acceptedByName",
					"createdAt"
				],
				"additionalProperties": false
			},
			"AgreementStatus": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"enum": [
							"terms",
							"privacy",
							"dpa",
							"baa",
							"eu-addendum",
							"us-comms"
						]
					},
					"title": {
						"type": "string"
					},
					"currentVersion": {
						"type": "string"
					},
					"path": {
						"type": "string"
					},
					"scope": {
						"type": "string",
						"enum": [
							"user",
							"organization"
						]
					},
					"upToDate": {
						"type": "boolean"
					},
					"latest": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/AgreementAcceptance"
							},
							{
								"type": "null"
							}
						]
					},
					"history": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/AgreementAcceptance"
						}
					}
				},
				"required": [
					"type",
					"title",
					"currentVersion",
					"path",
					"scope",
					"upToDate",
					"latest",
					"history"
				],
				"additionalProperties": false
			},
			"AgreementList": {
				"type": "object",
				"properties": {
					"items": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/AgreementStatus"
						}
					}
				},
				"required": [
					"items"
				],
				"additionalProperties": false
			},
			"PendingAgreement": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"enum": [
							"terms",
							"privacy",
							"dpa",
							"baa",
							"eu-addendum",
							"us-comms"
						]
					},
					"currentVersion": {
						"type": "string"
					}
				},
				"required": [
					"type",
					"currentVersion"
				],
				"additionalProperties": false
			},
			"AgreementsPending": {
				"type": "object",
				"properties": {
					"userPending": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PendingAgreement"
						}
					},
					"orgPending": {
						"anyOf": [
							{
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/PendingAgreement"
								}
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"userPending",
					"orgPending"
				],
				"additionalProperties": false
			},
			"AgreementsAccepted": {
				"type": "object",
				"properties": {
					"accepted": {
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"terms",
								"privacy",
								"dpa",
								"baa",
								"eu-addendum",
								"us-comms"
							]
						}
					}
				},
				"required": [
					"accepted"
				],
				"additionalProperties": false
			},
			"MemberSummary": {
				"type": "object",
				"properties": {
					"userId": {
						"type": "string",
						"minLength": 1
					},
					"name": {
						"type": "string"
					},
					"email": {
						"type": "string"
					},
					"role": {
						"type": "string"
					},
					"image": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"userId",
					"name",
					"email",
					"role",
					"image"
				],
				"additionalProperties": false
			},
			"Bootstrap": {
				"type": "object",
				"properties": {
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"members": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/MemberSummary"
						}
					},
					"pipelines": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PipelineWithStages"
						}
					},
					"savedViews": {
						"type": "object",
						"properties": {
							"patients": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SavedView"
								}
							},
							"conversations": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SavedView"
								}
							}
						},
						"required": [
							"patients",
							"conversations"
						],
						"additionalProperties": false
					},
					"treatments": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/TreatmentSummary"
						}
					},
					"contactMethods": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ContactMethod"
						}
					},
					"lostReasons": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LostReason"
						}
					},
					"cancellationReasons": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CancellationReason"
						}
					},
					"leadSources": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadSource"
						}
					},
					"tags": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Tag"
						}
					},
					"appointmentTypes": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/AppointmentType"
						}
					},
					"locations": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Location"
						}
					},
					"operatories": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Operatory"
						}
					},
					"practitioners": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Practitioner"
						}
					},
					"channelConnections": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ChannelConnectionSummary"
						}
					},
					"pmsConnections": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PmsConnectionSummary"
						}
					},
					"messageTemplates": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/MessageTemplateSummary"
						}
					},
					"sequences": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/SequenceSummary"
						}
					},
					"practiceSettings": {
						"$ref": "#/components/schemas/PracticeSettings"
					},
					"entitlements": {
						"$ref": "#/components/schemas/Entitlements"
					},
					"payments": {
						"$ref": "#/components/schemas/PaymentsSummary"
					},
					"dialer": {
						"$ref": "#/components/schemas/DialerBootstrap"
					},
					"voice": {
						"$ref": "#/components/schemas/VoiceBootstrap"
					},
					"notifications": {
						"$ref": "#/components/schemas/NotificationsBootstrap"
					},
					"teamChat": {
						"$ref": "#/components/schemas/TeamChatBootstrap"
					}
				},
				"required": [
					"organizationId",
					"members",
					"pipelines",
					"savedViews",
					"treatments",
					"contactMethods",
					"lostReasons",
					"cancellationReasons",
					"leadSources",
					"tags",
					"appointmentTypes",
					"locations",
					"operatories",
					"practitioners",
					"channelConnections",
					"pmsConnections",
					"messageTemplates",
					"sequences",
					"practiceSettings",
					"entitlements",
					"payments",
					"dialer"
				],
				"additionalProperties": false
			},
			"Entitlements": {
				"type": "object",
				"properties": {
					"aiEnabled": {
						"type": "boolean"
					},
					"dialerEnabled": {
						"type": "boolean"
					},
					"voiceEnabled": {
						"type": "boolean"
					},
					"aiVoiceEnabled": {
						"type": "boolean"
					},
					"seoAdsEnabled": {
						"type": "boolean"
					}
				},
				"required": [
					"aiEnabled",
					"dialerEnabled",
					"voiceEnabled",
					"aiVoiceEnabled",
					"seoAdsEnabled"
				],
				"additionalProperties": false
			},
			"BillingSubscription": {
				"type": "object",
				"properties": {
					"plan": {
						"type": "string"
					},
					"status": {
						"type": "string"
					},
					"periodStart": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"periodEnd": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"trialStart": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"trialEnd": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelAtPeriodEnd": {
						"type": "boolean"
					}
				},
				"required": [
					"plan",
					"status",
					"periodStart",
					"periodEnd",
					"trialStart",
					"trialEnd",
					"cancelAtPeriodEnd"
				],
				"additionalProperties": false
			},
			"Billing": {
				"type": "object",
				"properties": {
					"subscription": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/BillingSubscription"
							},
							{
								"type": "null"
							}
						]
					},
					"entitlements": {
						"$ref": "#/components/schemas/Entitlements"
					},
					"projectionStatus": {
						"type": "string",
						"enum": [
							"ready",
							"pending",
							"manual_review"
						]
					},
					"recoveryAction": {
						"type": "string",
						"enum": [
							"none",
							"checkout",
							"portal",
							"resume",
							"wait",
							"contact_support"
						]
					},
					"trialEligible": {
						"type": "boolean"
					},
					"priceBookVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"voiceCapacity": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/VoiceCapacity"
							},
							{
								"type": "null"
							}
						]
					},
					"callTrackingUsage": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"callMinutes": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"transcriptionMinutes": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"callMinutes",
									"transcriptionMinutes"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"aiVoiceUsage": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"callMinutes": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"awaitingReviewMinutes": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"callMinutes",
									"awaitingReviewMinutes"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"upcomingInvoice": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"amountDue": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"currency": {
										"type": "string"
									},
									"nextPaymentAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"amountDue",
									"currency",
									"nextPaymentAt"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"subscription",
					"entitlements",
					"projectionStatus",
					"recoveryAction",
					"trialEligible",
					"priceBookVersion",
					"voiceCapacity",
					"callTrackingUsage",
					"upcomingInvoice"
				],
				"additionalProperties": false
			},
			"VoiceCapacity": {
				"type": "object",
				"properties": {
					"totalLines": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"includedLines": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"appliedExtraLines": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"heldNumbers": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"billableExtraNumbers": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"trackingNumbers": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"smsNumbers": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"appliedSmsNumbers": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"appliedTrackingNumbers": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"extraLocations": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"appliedExtraLocations": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"syncStatus": {
						"type": "string",
						"enum": [
							"pending",
							"processing",
							"retry",
							"ready",
							"manual_review"
						]
					}
				},
				"required": [
					"totalLines",
					"includedLines",
					"appliedExtraLines",
					"heldNumbers",
					"billableExtraNumbers",
					"trackingNumbers",
					"smsNumbers",
					"appliedSmsNumbers",
					"appliedTrackingNumbers",
					"extraLocations",
					"appliedExtraLocations",
					"syncStatus"
				],
				"additionalProperties": false
			},
			"VoiceLines": {
				"type": "object",
				"properties": {
					"billing": {
						"$ref": "#/components/schemas/Billing"
					},
					"capacity": {
						"$ref": "#/components/schemas/VoiceCapacity"
					}
				},
				"required": [
					"billing",
					"capacity"
				],
				"additionalProperties": false
			},
			"VoiceEndpoint": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"userId": {
						"type": "string"
					},
					"deviceKind": {
						"type": "string",
						"enum": [
							"browser",
							"desktop",
							"mobile",
							"extension"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"provisioning",
							"active",
							"revoked"
						]
					},
					"available": {
						"type": "boolean"
					},
					"emergencyLocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"revocationSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"self",
									"manager",
									"access_lost"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"lastTokenMintedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"userId",
					"deviceKind",
					"status",
					"available",
					"emergencyLocationId",
					"revocationSource",
					"lastTokenMintedAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"VoiceBootstrap": {
				"type": "object",
				"properties": {
					"voiceStatus": {
						"type": "string",
						"enum": [
							"none",
							"active",
							"parked"
						]
					}
				},
				"required": [
					"voiceStatus"
				],
				"additionalProperties": false
			},
			"Voicemail": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"callLogId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"fromNumber": {
						"type": "string"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"durationSec": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"heardAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"audioAvailable": {
						"type": "boolean"
					},
					"numberId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"assignedToUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"callLogId",
					"fromNumber",
					"patientId",
					"patientName",
					"durationSec",
					"heardAt",
					"createdAt",
					"audioAvailable",
					"numberId",
					"assignedToUserId",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"VoiceRingGroup": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"mode": {
						"type": "string",
						"enum": [
							"members",
							"location_staff"
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"memberUserIds": {
						"type": "array",
						"items": {
							"type": "string"
						}
					}
				},
				"required": [
					"id",
					"name",
					"mode",
					"locationId",
					"memberUserIds"
				],
				"additionalProperties": false
			},
			"VoiceRoutingConfig": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"hoursMode": {
						"type": "string",
						"enum": [
							"location",
							"always_open",
							"custom"
						]
					},
					"customHours": {
						"anyOf": [
							{
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {}
							},
							{
								"type": "null"
							}
						]
					},
					"timezoneOverride": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"openAction": {
						"oneOf": [
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "ring"
									},
									"ringGroupId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"onNoAnswer": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ring"
													},
													"ringGroupId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"kind",
													"ringGroupId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "voicemail"
													}
												},
												"required": [
													"kind"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "forward"
													},
													"to": {
														"type": "string",
														"minLength": 3,
														"maxLength": 20
													},
													"presentCallerId": {
														"type": "string",
														"enum": [
															"caller",
															"practice"
														]
													}
												},
												"required": [
													"kind",
													"to",
													"presentCallerId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "announce"
													},
													"text": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"kind",
													"text"
												],
												"additionalProperties": false
											}
										]
									}
								},
								"required": [
									"kind",
									"ringGroupId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "forward"
									},
									"to": {
										"type": "string",
										"minLength": 3,
										"maxLength": 20
									},
									"presentCallerId": {
										"type": "string",
										"enum": [
											"caller",
											"practice"
										]
									}
								},
								"required": [
									"kind",
									"to",
									"presentCallerId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "announce"
									},
									"text": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"kind",
									"text"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "ai_agent"
									},
									"fallback": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ring"
													},
													"ringGroupId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"kind",
													"ringGroupId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "voicemail"
													}
												},
												"required": [
													"kind"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "forward"
													},
													"to": {
														"type": "string",
														"minLength": 3,
														"maxLength": 20
													},
													"presentCallerId": {
														"type": "string",
														"enum": [
															"caller",
															"practice"
														]
													}
												},
												"required": [
													"kind",
													"to",
													"presentCallerId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "announce"
													},
													"text": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"kind",
													"text"
												],
												"additionalProperties": false
											}
										]
									}
								},
								"required": [
									"kind",
									"fallback"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "ivr"
									},
									"prompt": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									"menu": {
										"minItems": 1,
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"digit": {
													"type": "string",
													"pattern": "^[0-9]$"
												},
												"action": {
													"oneOf": [
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "ring"
																},
																"ringGroupId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"required": [
																"kind",
																"ringGroupId"
															],
															"additionalProperties": false
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "voicemail"
																}
															},
															"required": [
																"kind"
															],
															"additionalProperties": false
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "forward"
																},
																"to": {
																	"type": "string",
																	"minLength": 3,
																	"maxLength": 20
																},
																"presentCallerId": {
																	"type": "string",
																	"enum": [
																		"caller",
																		"practice"
																	]
																}
															},
															"required": [
																"kind",
																"to",
																"presentCallerId"
															],
															"additionalProperties": false
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "announce"
																},
																"text": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																}
															},
															"required": [
																"kind",
																"text"
															],
															"additionalProperties": false
														}
													]
												},
												"leadPath": {
													"type": "boolean"
												}
											},
											"required": [
												"digit",
												"action"
											],
											"additionalProperties": false
										}
									}
								},
								"required": [
									"kind",
									"prompt",
									"menu"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "voicemail"
									}
								},
								"required": [
									"kind"
								],
								"additionalProperties": false
							}
						]
					},
					"closedAction": {
						"oneOf": [
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "ring"
									},
									"ringGroupId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"onNoAnswer": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ring"
													},
													"ringGroupId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"kind",
													"ringGroupId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "voicemail"
													}
												},
												"required": [
													"kind"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "forward"
													},
													"to": {
														"type": "string",
														"minLength": 3,
														"maxLength": 20
													},
													"presentCallerId": {
														"type": "string",
														"enum": [
															"caller",
															"practice"
														]
													}
												},
												"required": [
													"kind",
													"to",
													"presentCallerId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "announce"
													},
													"text": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"kind",
													"text"
												],
												"additionalProperties": false
											}
										]
									}
								},
								"required": [
									"kind",
									"ringGroupId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "forward"
									},
									"to": {
										"type": "string",
										"minLength": 3,
										"maxLength": 20
									},
									"presentCallerId": {
										"type": "string",
										"enum": [
											"caller",
											"practice"
										]
									}
								},
								"required": [
									"kind",
									"to",
									"presentCallerId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "announce"
									},
									"text": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"kind",
									"text"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "ai_agent"
									},
									"fallback": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "ring"
													},
													"ringGroupId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													}
												},
												"required": [
													"kind",
													"ringGroupId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "voicemail"
													}
												},
												"required": [
													"kind"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "forward"
													},
													"to": {
														"type": "string",
														"minLength": 3,
														"maxLength": 20
													},
													"presentCallerId": {
														"type": "string",
														"enum": [
															"caller",
															"practice"
														]
													}
												},
												"required": [
													"kind",
													"to",
													"presentCallerId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "announce"
													},
													"text": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												},
												"required": [
													"kind",
													"text"
												],
												"additionalProperties": false
											}
										]
									}
								},
								"required": [
									"kind",
									"fallback"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "ivr"
									},
									"prompt": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									"menu": {
										"minItems": 1,
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"digit": {
													"type": "string",
													"pattern": "^[0-9]$"
												},
												"action": {
													"oneOf": [
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "ring"
																},
																"ringGroupId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																}
															},
															"required": [
																"kind",
																"ringGroupId"
															],
															"additionalProperties": false
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "voicemail"
																}
															},
															"required": [
																"kind"
															],
															"additionalProperties": false
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "forward"
																},
																"to": {
																	"type": "string",
																	"minLength": 3,
																	"maxLength": 20
																},
																"presentCallerId": {
																	"type": "string",
																	"enum": [
																		"caller",
																		"practice"
																	]
																}
															},
															"required": [
																"kind",
																"to",
																"presentCallerId"
															],
															"additionalProperties": false
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "announce"
																},
																"text": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 500
																}
															},
															"required": [
																"kind",
																"text"
															],
															"additionalProperties": false
														}
													]
												},
												"leadPath": {
													"type": "boolean"
												}
											},
											"required": [
												"digit",
												"action"
											],
											"additionalProperties": false
										}
									}
								},
								"required": [
									"kind",
									"prompt",
									"menu"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "voicemail"
									}
								},
								"required": [
									"kind"
								],
								"additionalProperties": false
							}
						]
					},
					"voicemailGreeting": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"closedGreeting": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"ringTimeoutSec": {
						"type": "integer",
						"minimum": 10,
						"maximum": 60
					},
					"callerRules": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"blocklist": {
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 3,
											"maxLength": 20
										}
									},
									"anonymousToVoicemail": {
										"type": "boolean"
									},
									"knownPatientAction": {
										"anyOf": [
											{
												"oneOf": [
													{
														"type": "object",
														"properties": {
															"kind": {
																"type": "string",
																"const": "ring"
															},
															"ringGroupId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															}
														},
														"required": [
															"kind",
															"ringGroupId"
														],
														"additionalProperties": false
													},
													{
														"type": "object",
														"properties": {
															"kind": {
																"type": "string",
																"const": "voicemail"
															}
														},
														"required": [
															"kind"
														],
														"additionalProperties": false
													},
													{
														"type": "object",
														"properties": {
															"kind": {
																"type": "string",
																"const": "forward"
															},
															"to": {
																"type": "string",
																"minLength": 3,
																"maxLength": 20
															},
															"presentCallerId": {
																"type": "string",
																"enum": [
																	"caller",
																	"practice"
																]
															}
														},
														"required": [
															"kind",
															"to",
															"presentCallerId"
														],
														"additionalProperties": false
													},
													{
														"type": "object",
														"properties": {
															"kind": {
																"type": "string",
																"const": "announce"
															},
															"text": {
																"type": "string",
																"minLength": 1,
																"maxLength": 500
															}
														},
														"required": [
															"kind",
															"text"
														],
														"additionalProperties": false
													}
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"blocklist",
									"anonymousToVoicemail",
									"knownPatientAction"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"locationId",
					"hoursMode",
					"customHours",
					"timezoneOverride",
					"openAction",
					"closedAction",
					"voicemailGreeting",
					"closedGreeting",
					"ringTimeoutSec",
					"callerRules"
				],
				"additionalProperties": false
			},
			"VoiceRoutingNumber": {
				"type": "object",
				"properties": {
					"numberId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"e164": {
						"type": "string"
					},
					"label": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"parked",
							"porting"
						]
					},
					"routingConfigId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"backupForwardsTo": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"rawLine": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": [
											"provisioning",
											"active",
											"disabling",
											"disabled",
											"failed"
										]
									},
									"emergencyStatus": {
										"type": "string",
										"enum": [
											"none",
											"pending",
											"validated",
											"rejected",
											"disabled"
										]
									},
									"sipUsername": {
										"anyOf": [
											{
												"type": "string"
											},
											{
												"type": "null"
											}
										]
									},
									"outboundEnabled": {
										"type": "boolean"
									}
								},
								"required": [
									"status",
									"emergencyStatus",
									"sipUsername",
									"outboundEnabled"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"numberId",
					"e164",
					"label",
					"status",
					"routingConfigId",
					"backupForwardsTo",
					"rawLine"
				],
				"additionalProperties": false
			},
			"DialerConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"voicestack",
							"justcall",
							"aircall"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending_vendor_activation",
							"connecting",
							"active",
							"paused",
							"error",
							"disconnected"
						]
					},
					"externalAccountRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"numberCount": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"lastDirectorySyncAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"directorySyncError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastWebhookAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"hasWebhookToken": {
						"type": "boolean"
					},
					"hasLeadApiToken": {
						"type": "boolean"
					},
					"webhookTokenPrevValidUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"leadApiTokenPrevValidUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"agents": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"externalId": {
									"type": "string"
								},
								"name": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"email": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"extension": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"userId": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"mappedBy": {
									"anyOf": [
										{
											"type": "string",
											"enum": [
												"auto_email",
												"manual"
											]
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"id",
								"externalId",
								"name",
								"email",
								"extension",
								"userId",
								"mappedBy"
							],
							"additionalProperties": false
						}
					},
					"locations": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"externalId": {
									"type": "string"
								},
								"externalName": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"locationId": {
									"anyOf": [
										{
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"id",
								"externalId",
								"externalName",
								"locationId"
							],
							"additionalProperties": false
						}
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"provider",
					"status",
					"externalAccountRef",
					"numberCount",
					"lastDirectorySyncAt",
					"directorySyncError",
					"lastWebhookAt",
					"lastError",
					"hasWebhookToken",
					"hasLeadApiToken",
					"webhookTokenPrevValidUntil",
					"leadApiTokenPrevValidUntil",
					"agents",
					"locations",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ChatWidgetConfig": {
				"type": "object",
				"properties": {
					"appearance": {
						"type": "object",
						"properties": {
							"displayName": {
								"type": "string",
								"minLength": 1,
								"maxLength": 80
							},
							"greeting": {
								"type": "string",
								"minLength": 1,
								"maxLength": 500
							},
							"brandColor": {
								"type": "string",
								"pattern": "^#[0-9a-fA-F]{6}$"
							},
							"replyTimeCopy": {
								"type": "string",
								"minLength": 1,
								"maxLength": 120
							},
							"position": {
								"type": "string",
								"enum": [
									"right",
									"left"
								]
							}
						},
						"required": [
							"displayName",
							"greeting",
							"brandColor",
							"replyTimeCopy",
							"position"
						],
						"additionalProperties": false
					},
					"flow": {
						"type": "object",
						"properties": {
							"treatments": {
								"maxItems": 12,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64
										},
										"label": {
											"type": "string",
											"minLength": 1,
											"maxLength": 100
										},
										"treatmentSlug": {
											"type": "string",
											"minLength": 1,
											"maxLength": 100
										},
										"questions": {
											"maxItems": 3,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"minLength": 1,
														"maxLength": 64
													},
													"label": {
														"type": "string",
														"minLength": 1,
														"maxLength": 300
													},
													"options": {
														"minItems": 2,
														"maxItems": 8,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1,
															"maxLength": 100
														}
													}
												},
												"required": [
													"id",
													"label"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"label",
										"questions"
									],
									"additionalProperties": false
								}
							},
							"capture": {
								"type": "object",
								"properties": {
									"consentLabel": {
										"type": "string",
										"minLength": 1,
										"maxLength": 300
									},
									"thanksMessage": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"consentLabel",
									"thanksMessage"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"treatments",
							"capture"
						],
						"additionalProperties": false
					},
					"proactive": {
						"maxItems": 10,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"minLength": 1,
									"maxLength": 64
								},
								"urlPattern": {
									"type": "string",
									"minLength": 1,
									"maxLength": 500
								},
								"message": {
									"type": "string",
									"minLength": 1,
									"maxLength": 500
								},
								"delaySeconds": {
									"type": "integer",
									"minimum": 0,
									"maximum": 120
								}
							},
							"required": [
								"id",
								"urlPattern",
								"message",
								"delaySeconds"
							],
							"additionalProperties": false
						}
					},
					"aiMode": {
						"type": "boolean"
					}
				},
				"required": [
					"appearance",
					"flow",
					"proactive",
					"aiMode"
				],
				"additionalProperties": false
			},
			"ChatWidget": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"enabled": {
						"type": "boolean"
					},
					"embedKey": {
						"type": "string"
					},
					"config": {
						"$ref": "#/components/schemas/ChatWidgetConfig"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"enabled",
					"embedKey",
					"config",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"KbSource": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"type": {
						"type": "string",
						"enum": [
							"website",
							"document",
							"snippet"
						]
					},
					"title": {
						"type": "string"
					},
					"url": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"content": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"processing",
							"ready",
							"error"
						]
					},
					"error": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"pageCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"chunkCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastIngestedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"type",
					"title",
					"url",
					"content",
					"status",
					"error",
					"pageCount",
					"chunkCount",
					"lastIngestedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"WidgetConfig": {
				"type": "object",
				"properties": {
					"appearance": {
						"type": "object",
						"properties": {
							"displayName": {
								"type": "string",
								"minLength": 1,
								"maxLength": 80
							},
							"greeting": {
								"type": "string",
								"minLength": 1,
								"maxLength": 500
							},
							"brandColor": {
								"type": "string",
								"pattern": "^#[0-9a-fA-F]{6}$"
							},
							"replyTimeCopy": {
								"type": "string",
								"minLength": 1,
								"maxLength": 120
							},
							"position": {
								"type": "string",
								"enum": [
									"right",
									"left"
								]
							}
						},
						"required": [
							"displayName",
							"greeting",
							"brandColor",
							"replyTimeCopy",
							"position"
						],
						"additionalProperties": false
					},
					"proactive": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"minLength": 1,
									"maxLength": 64
								},
								"urlPattern": {
									"type": "string",
									"minLength": 1,
									"maxLength": 500
								},
								"message": {
									"type": "string",
									"minLength": 1,
									"maxLength": 500
								},
								"delaySeconds": {
									"type": "integer",
									"minimum": 0,
									"maximum": 120
								}
							},
							"required": [
								"id",
								"urlPattern",
								"message",
								"delaySeconds"
							],
							"additionalProperties": false
						}
					},
					"aiEnabled": {
						"type": "boolean"
					},
					"booking": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"key": {
										"type": "string",
										"minLength": 1
									}
								},
								"required": [
									"key"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"intro": {
						"type": "object",
						"properties": {
							"messages": {
								"type": "array",
								"items": {
									"type": "string"
								}
							},
							"prompt": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"quickReplies": {
												"type": "array",
												"items": {
													"type": "string"
												}
											},
											"expects": {
												"type": "string",
												"enum": [
													"option",
													"text",
													"none"
												]
											},
											"inputHint": {
												"type": "string",
												"enum": [
													"name",
													"phone",
													"email"
												]
											}
										},
										"required": [
											"quickReplies",
											"expects"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"messages",
							"prompt"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"appearance",
					"proactive",
					"aiEnabled",
					"intro"
				],
				"additionalProperties": false
			},
			"WidgetMessage": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"direction": {
						"type": "string",
						"enum": [
							"inbound",
							"outbound"
						]
					},
					"body": {
						"type": "string"
					},
					"attachments": {
						"default": [],
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"mime": {
									"type": "string"
								},
								"size": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"filename": {
									"type": "string"
								},
								"width": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"height": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"pending": {
									"type": "boolean"
								},
								"unavailable": {
									"type": "boolean",
									"const": true
								}
							},
							"required": [
								"mime"
							],
							"additionalProperties": false
						}
					},
					"author": {
						"type": "object",
						"properties": {
							"kind": {
								"type": "string",
								"enum": [
									"visitor",
									"staff",
									"bot",
									"assistant"
								]
							},
							"name": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"kind",
							"name"
						],
						"additionalProperties": false
					},
					"action": {
						"type": "object",
						"properties": {
							"kind": {
								"type": "string",
								"const": "booking"
							},
							"handoffToken": {
								"type": "string",
								"minLength": 1,
								"maxLength": 2048
							}
						},
						"required": [
							"kind",
							"handoffToken"
						],
						"additionalProperties": false
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"direction",
					"body",
					"attachments",
					"author",
					"createdAt"
				],
				"additionalProperties": false
			},
			"WidgetTurn": {
				"type": "object",
				"properties": {
					"conversationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"messages": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/WidgetMessage"
						}
					},
					"mode": {
						"type": "string",
						"enum": [
							"flow",
							"ai",
							"human"
						]
					},
					"prompt": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"quickReplies": {
										"type": "array",
										"items": {
											"type": "string"
										}
									},
									"expects": {
										"type": "string",
										"enum": [
											"option",
											"text",
											"none"
										]
									},
									"inputHint": {
										"type": "string",
										"enum": [
											"name",
											"phone",
											"email"
										]
									}
								},
								"required": [
									"quickReplies",
									"expects"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"conversationId",
					"messages",
					"mode",
					"prompt"
				],
				"additionalProperties": false
			},
			"BookingPageConfig": {
				"type": "object",
				"properties": {
					"welcomeTitle": {
						"type": "string",
						"maxLength": 120
					},
					"welcomeMessage": {
						"type": "string",
						"maxLength": 500
					},
					"showPractitioner": {
						"type": "boolean"
					},
					"locationIds": {
						"maxItems": 1000,
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					}
				},
				"required": [
					"welcomeTitle",
					"welcomeMessage",
					"showPractitioner",
					"locationIds"
				],
				"additionalProperties": false
			},
			"BookingPage": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"enabled": {
						"type": "boolean"
					},
					"token": {
						"type": "string"
					},
					"defaultLeadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"config": {
						"$ref": "#/components/schemas/BookingPageConfig"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"enabled",
					"token",
					"defaultLeadSourceId",
					"config",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"BookingConfig": {
				"type": "object",
				"properties": {
					"practice": {
						"type": "object",
						"properties": {
							"name": {
								"type": "string"
							},
							"brandColor": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"phone": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"name",
							"brandColor",
							"phone"
						],
						"additionalProperties": false
					},
					"locations": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/BookingLocation"
						}
					},
					"appointmentTypes": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/BookingAppointmentType"
						}
					},
					"practitioners": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/BookingPractitioner"
						}
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"depositCheckoutAvailable": {
						"type": "boolean"
					},
					"config": {
						"type": "object",
						"properties": {
							"welcomeTitle": {
								"type": "string"
							},
							"welcomeMessage": {
								"type": "string"
							},
							"showPractitioner": {
								"type": "boolean"
							}
						},
						"required": [
							"welcomeTitle",
							"welcomeMessage",
							"showPractitioner"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"practice",
					"locations",
					"appointmentTypes",
					"practitioners",
					"currency",
					"depositCheckoutAvailable",
					"config"
				],
				"additionalProperties": false
			},
			"BookingLocation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"timezone": {
						"type": "string"
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postcode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"name",
					"timezone",
					"addressLine1",
					"city",
					"postcode"
				],
				"additionalProperties": false
			},
			"BookingAppointmentType": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"durationMin": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"depositAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"requiresConfirmation": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"name",
					"durationMin",
					"depositAmountCents",
					"requiresConfirmation"
				],
				"additionalProperties": false
			},
			"BookingPractitioner": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"displayName": {
						"type": "string"
					},
					"role": {
						"type": "string",
						"enum": [
							"dentist",
							"hygienist",
							"therapist",
							"nurse",
							"other"
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"displayName",
					"role",
					"locationId"
				],
				"additionalProperties": false
			},
			"BookingSlot": {
				"type": "object",
				"properties": {
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					}
				},
				"required": [
					"startsAt",
					"practitionerId"
				],
				"additionalProperties": false
			},
			"BookingHold": {
				"anyOf": [
					{
						"$ref": "#/components/schemas/BookingHoldReservation"
					},
					{
						"$ref": "#/components/schemas/BookingRequestReceived"
					}
				]
			},
			"ManagedBooking": {
				"type": "object",
				"properties": {
					"uid": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"booked",
							"confirmed",
							"arrived",
							"in_chair",
							"fulfilled",
							"cancelled",
							"no_show"
						]
					},
					"held": {
						"type": "boolean"
					},
					"depositPending": {
						"type": "boolean"
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"timezone": {
						"type": "string"
					},
					"appointmentTypeName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"locationName": {
						"type": "string"
					},
					"practitionerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"practiceName": {
						"type": "string"
					},
					"practicePhone": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"canCancel": {
						"type": "boolean"
					},
					"canReschedule": {
						"type": "boolean"
					},
					"minNoticeMin": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"bookingKey": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentTypeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"uid",
					"status",
					"held",
					"depositPending",
					"startsAt",
					"endsAt",
					"timezone",
					"appointmentTypeName",
					"locationName",
					"practitionerName",
					"practiceName",
					"practicePhone",
					"canCancel",
					"canReschedule",
					"minNoticeMin",
					"bookingKey",
					"appointmentTypeId",
					"locationId",
					"practitionerId"
				],
				"additionalProperties": false
			},
			"AvailabilityRule": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"working",
							"break",
							"block"
						]
					},
					"label": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"days": {
						"type": "array",
						"items": {
							"type": "integer",
							"minimum": 0,
							"maximum": 6
						}
					},
					"startTime": {
						"type": "string",
						"pattern": "^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d)?$"
					},
					"endTime": {
						"type": "string",
						"pattern": "^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d)?$"
					},
					"date": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"kind",
					"label",
					"days",
					"startTime",
					"endTime",
					"date"
				],
				"additionalProperties": false
			},
			"PractitionerSchedule": {
				"type": "object",
				"properties": {
					"scheduleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerAssignmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"version": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"timezone": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"rules": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/AvailabilityRule"
						}
					},
					"bookingMode": {
						"type": "string",
						"enum": [
							"own",
							"pms"
						]
					},
					"providerLabel": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"scheduleId",
					"locationId",
					"practitionerAssignmentId",
					"version",
					"timezone",
					"rules",
					"bookingMode",
					"providerLabel"
				],
				"additionalProperties": false
			},
			"ReputationTemplateBinding": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"initial",
							"reminder"
						]
					},
					"channel": {
						"type": "string",
						"enum": [
							"email",
							"sms",
							"whatsapp"
						]
					},
					"locale": {
						"type": "string",
						"enum": [
							"en",
							"it"
						]
					},
					"templateId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"templateName": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"kind",
					"channel",
					"locale",
					"templateId",
					"templateName"
				],
				"additionalProperties": false
			},
			"ReputationLocation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"crmLocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalLocationId": {
						"type": "string"
					},
					"title": {
						"type": "string"
					},
					"storeCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"placeId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"newReviewUrlAvailable": {
						"type": "boolean"
					},
					"isVerified": {
						"type": "boolean"
					},
					"enabled": {
						"type": "boolean"
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"accountId",
					"crmLocationId",
					"externalLocationId",
					"title",
					"storeCode",
					"placeId",
					"newReviewUrlAvailable",
					"isVerified",
					"enabled",
					"lastSyncedAt"
				],
				"additionalProperties": false
			},
			"ReputationAccount": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalAccountId": {
						"type": "string"
					},
					"displayName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"accountType": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"verificationState": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"notificationStatus": {
						"type": "string",
						"enum": [
							"pending",
							"active",
							"conflict",
							"error"
						]
					},
					"notificationErrorCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"authorization_revoked",
									"authorization_unavailable",
									"cleanup_budget_exhausted",
									"cleanup_failed",
									"connection_sync_failed",
									"member_removed",
									"no_locations_discovered",
									"notification_configuration_failed",
									"provider_operation_rejected",
									"provider_unavailable",
									"queue_publication_budget_exhausted",
									"queue_send_failed",
									"reconcile_budget_exhausted",
									"target_publication_budget_exhausted"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"connectionId",
					"externalAccountId",
					"displayName",
					"accountType",
					"verificationState",
					"notificationStatus",
					"notificationErrorCode",
					"lastSyncedAt"
				],
				"additionalProperties": false
			},
			"ReputationConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"google_business_profile"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"connecting",
							"active",
							"error",
							"revoked"
						]
					},
					"externalAccountRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"replyAuthorized": {
						"type": "boolean"
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"errorCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"authorization_revoked",
									"authorization_unavailable",
									"cleanup_budget_exhausted",
									"cleanup_failed",
									"connection_sync_failed",
									"member_removed",
									"no_locations_discovered",
									"notification_configuration_failed",
									"provider_operation_rejected",
									"provider_unavailable",
									"queue_publication_budget_exhausted",
									"queue_send_failed",
									"reconcile_budget_exhausted",
									"target_publication_budget_exhausted"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"provider",
					"status",
					"externalAccountRef",
					"replyAuthorized",
					"lastSyncedAt",
					"errorCode",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ReputationSettings": {
				"type": "object",
				"properties": {
					"enabled": {
						"type": "boolean"
					},
					"initialDelayHours": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"reminderEnabled": {
						"type": "boolean"
					},
					"reminderDelayHours": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"cooldownDays": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"privateFeedbackThreshold": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"enabledChannels": {
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"email",
								"sms",
								"whatsapp"
							]
						}
					},
					"defaultLocale": {
						"type": "string",
						"enum": [
							"en",
							"it"
						]
					},
					"updatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"enabled",
					"initialDelayHours",
					"reminderEnabled",
					"reminderDelayHours",
					"cooldownDays",
					"privateFeedbackThreshold",
					"enabledChannels",
					"defaultLocale",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ReputationRequest": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patient": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string"
									}
								},
								"required": [
									"id",
									"name"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"location": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"title": {
										"type": "string"
									}
								},
								"required": [
									"id",
									"title"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"trigger": {
						"type": "string",
						"enum": [
							"automatic",
							"manual"
						]
					},
					"channel": {
						"type": "string",
						"enum": [
							"email",
							"sms",
							"whatsapp"
						]
					},
					"locale": {
						"type": "string",
						"enum": [
							"en",
							"it"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"scheduled",
							"processing",
							"sent",
							"delivery_unknown",
							"completed",
							"skipped",
							"failed",
							"cancelled"
						]
					},
					"dueAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"expiresAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reminderDueAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reminderSentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstOpenedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"openCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"feedbackAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"publicReviewClickedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"skipReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"patient",
					"appointmentId",
					"location",
					"trigger",
					"channel",
					"locale",
					"status",
					"dueAt",
					"expiresAt",
					"sentAt",
					"reminderDueAt",
					"reminderSentAt",
					"firstOpenedAt",
					"openCount",
					"feedbackAt",
					"publicReviewClickedAt",
					"skipReason",
					"lastError",
					"createdByName",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ReputationFeedback": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"requestId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patient": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"name": {
										"type": "string"
									}
								},
								"required": [
									"id",
									"name"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"score": {
						"type": "integer",
						"minimum": 1,
						"maximum": 5
					},
					"comment": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"anonymousToStaff": {
						"type": "boolean"
					},
					"recoveryTaskId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"recoveryStatus": {
						"type": "string",
						"enum": [
							"not_needed",
							"missing",
							"open",
							"done"
						]
					},
					"submittedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"requestId",
					"patient",
					"score",
					"comment",
					"anonymousToStaff",
					"recoveryTaskId",
					"recoveryStatus",
					"submittedAt"
				],
				"additionalProperties": false
			},
			"ReputationReview": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"location": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"title": {
								"type": "string"
							}
						},
						"required": [
							"id",
							"title"
						],
						"additionalProperties": false
					},
					"externalReviewId": {
						"type": "string"
					},
					"reviewerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewerPhotoUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"rating": {
						"type": "integer",
						"minimum": 1,
						"maximum": 5
					},
					"comment": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"providerUpdatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"replyComment": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"replyUpdatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"replyAuthorized": {
						"type": "boolean"
					},
					"contentExpiresAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"latestReplyJob": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ReputationReplyJob"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"location",
					"externalReviewId",
					"reviewerName",
					"reviewerPhotoUrl",
					"rating",
					"comment",
					"reviewedAt",
					"providerUpdatedAt",
					"replyComment",
					"replyUpdatedAt",
					"replyAuthorized",
					"contentExpiresAt",
					"latestReplyJob"
				],
				"additionalProperties": false
			},
			"ReputationReplyJob": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reviewId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"action": {
						"type": "string",
						"enum": [
							"upsert",
							"delete"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"drafted",
							"queued",
							"publishing",
							"published",
							"failed",
							"cancelled"
						]
					},
					"draftText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"approvedText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"publishedText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"model": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"idempotencyVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"queuedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"authorizedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"publishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"providerStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"policyViolation": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"reviewId",
					"action",
					"status",
					"draftText",
					"approvedText",
					"publishedText",
					"model",
					"attemptCount",
					"idempotencyVersion",
					"queuedAt",
					"authorizedAt",
					"publishedAt",
					"providerStatus",
					"policyViolation",
					"lastError",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ReputationMetrics": {
				"type": "object",
				"properties": {
					"requestsSent": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"privateFeedbackCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"googleReviewCount": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"averageGoogleRating": {
						"anyOf": [
							{
								"type": "number"
							},
							{
								"type": "null"
							}
						]
					},
					"responseRate": {
						"type": "number",
						"minimum": 0,
						"maximum": 1
					},
					"recoveryOpen": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"requestsSent",
					"privateFeedbackCount",
					"googleReviewCount",
					"averageGoogleRating",
					"responseRate",
					"recoveryOpen"
				],
				"additionalProperties": false
			},
			"ReputationPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"type": "object",
						"properties": {
							"enabled": {
								"type": "boolean"
							},
							"readOnly": {
								"type": "boolean"
							}
						},
						"required": [
							"enabled",
							"readOnly"
						],
						"additionalProperties": false
					},
					"permissions": {
						"type": "object",
						"properties": {
							"request": {
								"type": "boolean"
							},
							"recover": {
								"type": "boolean"
							},
							"respond": {
								"type": "boolean"
							},
							"manage": {
								"type": "boolean"
							},
							"aiDraft": {
								"type": "boolean"
							}
						},
						"required": [
							"request",
							"recover",
							"respond",
							"manage",
							"aiDraft"
						],
						"additionalProperties": false
					},
					"metrics": {
						"$ref": "#/components/schemas/ReputationMetrics"
					},
					"settings": {
						"$ref": "#/components/schemas/ReputationSettings"
					},
					"templateBindings": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReputationTemplateBinding"
						}
					},
					"messageTemplates": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/MessageTemplate"
						}
					},
					"connections": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReputationConnection"
						}
					},
					"accounts": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReputationAccount"
						}
					},
					"locations": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ReputationLocation"
						}
					},
					"practiceLocations": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"name": {
									"type": "string"
								},
								"timezone": {
									"type": "string"
								}
							},
							"required": [
								"id",
								"name",
								"timezone"
							],
							"additionalProperties": false
						}
					},
					"channelAvailability": {
						"type": "object",
						"properties": {
							"email": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"sms": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"whatsapp": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"email",
							"sms",
							"whatsapp"
						],
						"additionalProperties": false
					},
					"sendWindow": {
						"type": "object",
						"properties": {
							"days": {
								"type": "array",
								"items": {
									"type": "string",
									"enum": [
										"mon",
										"tue",
										"wed",
										"thu",
										"fri",
										"sat",
										"sun"
									]
								}
							},
							"start": {
								"type": "string"
							},
							"end": {
								"type": "string"
							}
						},
						"required": [
							"days",
							"start",
							"end"
						],
						"additionalProperties": false
					},
					"timezone": {
						"type": "string"
					},
					"requests": {
						"type": "object",
						"properties": {
							"items": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ReputationRequest"
								}
							},
							"total": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"limit": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"offset": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"items",
							"total",
							"limit",
							"offset"
						],
						"additionalProperties": false
					},
					"feedback": {
						"type": "object",
						"properties": {
							"items": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ReputationFeedback"
								}
							},
							"total": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"limit": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"offset": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"items",
							"total",
							"limit",
							"offset"
						],
						"additionalProperties": false
					},
					"reviews": {
						"type": "object",
						"properties": {
							"items": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ReputationReview"
								}
							},
							"total": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"limit": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"offset": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"items",
							"total",
							"limit",
							"offset"
						],
						"additionalProperties": false
					},
					"replyJobs": {
						"type": "object",
						"properties": {
							"items": {
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ReputationReplyJob"
								}
							},
							"total": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"limit": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							"offset": {
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"items",
							"total",
							"limit",
							"offset"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"metrics",
					"settings",
					"templateBindings",
					"messageTemplates",
					"connections",
					"accounts",
					"locations",
					"practiceLocations",
					"channelAvailability",
					"sendWindow",
					"timezone",
					"requests",
					"feedback",
					"reviews",
					"replyJobs"
				],
				"additionalProperties": false
			},
			"SeoEntitlement": {
				"type": "object",
				"properties": {
					"enabled": {
						"type": "boolean"
					},
					"readOnly": {
						"type": "boolean"
					},
					"upgradeRequired": {
						"type": "boolean"
					}
				},
				"required": [
					"enabled",
					"readOnly",
					"upgradeRequired"
				],
				"additionalProperties": false
			},
			"SeoPermissions": {
				"type": "object",
				"properties": {
					"read": {
						"type": "boolean"
					},
					"request": {
						"type": "boolean"
					},
					"recover": {
						"type": "boolean"
					},
					"respond": {
						"type": "boolean"
					},
					"manage": {
						"type": "boolean"
					},
					"approve": {
						"type": "boolean"
					},
					"publish": {
						"type": "boolean"
					},
					"aiDraft": {
						"type": "boolean"
					}
				},
				"required": [
					"read",
					"request",
					"recover",
					"respond",
					"manage",
					"approve",
					"publish",
					"aiDraft"
				],
				"additionalProperties": false
			},
			"SeoAction": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"gbp_fix_field",
							"gbp_post_suggestion",
							"site_fix",
							"content_target",
							"listing_fix",
							"keyword_opportunity",
							"connect_gsc",
							"confirm_coordinates",
							"review_velocity",
							"schema_fix",
							"ai_visibility_gap",
							"bing_sync_setup"
						]
					},
					"surface": {
						"type": "string",
						"enum": [
							"overview",
							"search_visibility",
							"gbp",
							"website",
							"ai_visibility",
							"listings",
							"content"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"approved",
							"running",
							"done",
							"failed",
							"dismissed",
							"expired"
						]
					},
					"priority": {
						"type": "integer",
						"minimum": 0,
						"maximum": 100
					},
					"title": {
						"type": "string",
						"minLength": 1,
						"maxLength": 200
					},
					"summary": {
						"type": "string",
						"minLength": 1,
						"maxLength": 2000
					},
					"payload": {
						"oneOf": [
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "gbp_fix_field"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"field": {
										"type": "string",
										"minLength": 1,
										"maxLength": 100
									},
									"updateMask": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 120
										}
									},
									"intent": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "set"
													},
													"value": {
														"description": "GBP local fix intent; maximum 12000 UTF-8 bytes",
														"anyOf": [
															{
																"type": "string"
															},
															{
																"type": "number"
															},
															{
																"type": "boolean"
															},
															{
																"type": "null"
															},
															{
																"type": "array",
																"items": {
																	"$ref": "#/components/schemas/schema0"
																}
															},
															{
																"type": "object",
																"propertyNames": {
																	"type": "string"
																},
																"additionalProperties": {
																	"$ref": "#/components/schemas/schema0"
																}
															}
														],
														"$ref": "#/components/schemas/schema0"
													}
												},
												"required": [
													"kind",
													"value"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "add_service_labels"
													},
													"labels": {
														"minItems": 1,
														"maxItems": 50,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1,
															"maxLength": 140
														}
													}
												},
												"required": [
													"kind",
													"labels"
												],
												"additionalProperties": false
											}
										]
									}
								},
								"required": [
									"kind",
									"locationId",
									"field",
									"updateMask",
									"intent"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "gbp_post_suggestion"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"promptHint": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"kind",
									"locationId",
									"promptHint"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "site_fix"
									},
									"findingId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"setting": {
										"type": "string",
										"const": "primary_domain"
									},
									"currentDomain": {
										"type": "string",
										"minLength": 1,
										"maxLength": 253
									},
									"proposedDomain": {
										"type": "string",
										"minLength": 1,
										"maxLength": 253
									}
								},
								"required": [
									"kind",
									"findingId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "content_target"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"keywordId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"targetPhrase": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									}
								},
								"required": [
									"kind",
									"locationId",
									"keywordId",
									"targetPhrase"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "listing_fix"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"directoryKey": {
										"type": "string",
										"enum": [
											"yell",
											"thomson_local",
											"one92",
											"scoot",
											"bing_places",
											"apple_maps",
											"facebook",
											"nhs"
										]
									},
									"listingUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"locationId",
									"directoryKey",
									"listingUrl"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "keyword_opportunity"
									},
									"keywordId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"keywordId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "connect_gsc"
									}
								},
								"required": [
									"kind"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "confirm_coordinates"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"locationId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "review_velocity"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"locationId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "schema_fix"
									},
									"findingId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"findingId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "ai_visibility_gap"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"treatmentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"kind",
									"locationId",
									"treatmentId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"const": "bing_sync_setup"
									},
									"locationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"kind",
									"locationId"
								],
								"additionalProperties": false
							}
						]
					},
					"draft": {
						"anyOf": [
							{
								"description": "SEO action draft; maximum 131072 UTF-8 bytes",
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "number"
									},
									{
										"type": "boolean"
									},
									{
										"type": "null"
									},
									{
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/schema1"
										}
									},
									{
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"$ref": "#/components/schemas/schema1"
										}
									}
								],
								"$ref": "#/components/schemas/schema1"
							},
							{
								"type": "null"
							}
						]
					},
					"autoApproved": {
						"type": "boolean"
					},
					"approvedById": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1,
								"maxLength": 255
							},
							{
								"type": "null"
							}
						]
					},
					"idempotencyVersion": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"errorCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"claim_budget_exhausted",
									"gbp_live_state_drifted",
									"google_post_rejected",
									"primary_domain_changed",
									"provider_content_invalid",
									"provider_operation_rejected",
									"provider_outcome_unknown",
									"provider_request_rejected",
									"provider_usage_unavailable",
									"queue_publication_budget_exhausted",
									"queue_send_failed"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"kind",
					"surface",
					"status",
					"priority",
					"title",
					"summary",
					"payload",
					"draft",
					"autoApproved",
					"approvedById",
					"idempotencyVersion",
					"expiresAt",
					"completedAt",
					"errorCode",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"rank_improved",
							"map_pack_entered",
							"action_completed",
							"ai_cited",
							"gsc_record",
							"content_published",
							"budget_blocked"
						]
					},
					"title": {
						"type": "string",
						"minLength": 1,
						"maxLength": 200
					},
					"summary": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"payload": {
						"description": "SEO event payload; maximum 32768 UTF-8 bytes",
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "number"
							},
							{
								"type": "boolean"
							},
							{
								"type": "null"
							},
							{
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/schema2"
								}
							},
							{
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"$ref": "#/components/schemas/schema2"
								}
							}
						],
						"$ref": "#/components/schemas/schema2"
					},
					"occurredAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"kind",
					"title",
					"summary",
					"payload",
					"occurredAt"
				],
				"additionalProperties": false
			},
			"SeoVisibilityScore": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"weekStart": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"score": {
						"type": "number",
						"minimum": 0,
						"maximum": 100
					},
					"algoVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"components": {
						"type": "object",
						"properties": {
							"gridShare": {
								"type": "object",
								"properties": {
									"value": {
										"anyOf": [
											{
												"type": "number",
												"minimum": 0,
												"maximum": 100
											},
											{
												"type": "null"
											}
										]
									},
									"weight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"effectiveWeight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"covered": {
										"type": "boolean"
									}
								},
								"required": [
									"value",
									"weight",
									"effectiveWeight",
									"covered"
								],
								"additionalProperties": false
							},
							"organicShare": {
								"type": "object",
								"properties": {
									"value": {
										"anyOf": [
											{
												"type": "number",
												"minimum": 0,
												"maximum": 100
											},
											{
												"type": "null"
											}
										]
									},
									"weight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"effectiveWeight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"covered": {
										"type": "boolean"
									}
								},
								"required": [
									"value",
									"weight",
									"effectiveWeight",
									"covered"
								],
								"additionalProperties": false
							},
							"gbpCompleteness": {
								"type": "object",
								"properties": {
									"value": {
										"anyOf": [
											{
												"type": "number",
												"minimum": 0,
												"maximum": 100
											},
											{
												"type": "null"
											}
										]
									},
									"weight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"effectiveWeight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"covered": {
										"type": "boolean"
									}
								},
								"required": [
									"value",
									"weight",
									"effectiveWeight",
									"covered"
								],
								"additionalProperties": false
							},
							"reviewVelocity": {
								"type": "object",
								"properties": {
									"value": {
										"anyOf": [
											{
												"type": "number",
												"minimum": 0,
												"maximum": 100
											},
											{
												"type": "null"
											}
										]
									},
									"weight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"effectiveWeight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"covered": {
										"type": "boolean"
									}
								},
								"required": [
									"value",
									"weight",
									"effectiveWeight",
									"covered"
								],
								"additionalProperties": false
							},
							"aiPresence": {
								"type": "object",
								"properties": {
									"value": {
										"anyOf": [
											{
												"type": "number",
												"minimum": 0,
												"maximum": 100
											},
											{
												"type": "null"
											}
										]
									},
									"weight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"effectiveWeight": {
										"type": "number",
										"minimum": 0,
										"maximum": 1
									},
									"covered": {
										"type": "boolean"
									}
								},
								"required": [
									"value",
									"weight",
									"effectiveWeight",
									"covered"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"gridShare",
							"organicShare",
							"gbpCompleteness",
							"reviewVelocity",
							"aiPresence"
						],
						"additionalProperties": false
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"weekStart",
					"score",
					"algoVersion",
					"components",
					"createdAt"
				],
				"additionalProperties": false
			},
			"SeoSettings": {
				"type": "object",
				"properties": {
					"primaryDomain": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1,
								"maxLength": 253
							},
							{
								"type": "null"
							}
						]
					},
					"gridSize": {
						"anyOf": [
							{
								"type": "number",
								"const": 5
							},
							{
								"type": "number",
								"const": 7
							}
						]
					},
					"gridSpacingMeters": {
						"type": "integer",
						"minimum": 100,
						"maximum": 5000
					},
					"scanDayOfWeek": {
						"type": "integer",
						"minimum": 0,
						"maximum": 6
					},
					"trackedKeywordLimit": {
						"type": "integer",
						"minimum": 0,
						"maximum": 50
					},
					"gridKeywordLimit": {
						"type": "integer",
						"minimum": 0,
						"maximum": 20
					},
					"monthlyCostCeilingUsdMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 8000000
					},
					"autoApproveGbpPosts": {
						"type": "boolean"
					},
					"autoApproveGbpFixes": {
						"type": "boolean"
					},
					"contentReviewerPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"aiVisibilityEnabled": {
						"type": "boolean"
					},
					"allowances": {
						"type": "object",
						"properties": {
							"trackedKeywordLimit": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"gridKeywordLimit": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"monthlyCostCeilingUsdMicros": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"trackedKeywordLimit",
							"gridKeywordLimit",
							"monthlyCostCeilingUsdMicros"
						],
						"additionalProperties": false
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"primaryDomain",
					"gridSize",
					"gridSpacingMeters",
					"scanDayOfWeek",
					"trackedKeywordLimit",
					"gridKeywordLimit",
					"monthlyCostCeilingUsdMicros",
					"autoApproveGbpPosts",
					"autoApproveGbpFixes",
					"contentReviewerPractitionerId",
					"aiVisibilityEnabled",
					"allowances",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoKeyword": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"treatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"phrase": {
						"type": "string",
						"minLength": 1,
						"maxLength": 120
					},
					"normalized": {
						"type": "string",
						"minLength": 1,
						"maxLength": 120
					},
					"source": {
						"type": "string",
						"enum": [
							"generated",
							"manual",
							"gsc",
							"competitor"
						]
					},
					"intent": {
						"type": "string",
						"enum": [
							"local",
							"commercial",
							"informational"
						]
					},
					"tracked": {
						"type": "boolean"
					},
					"gridTracked": {
						"type": "boolean"
					},
					"searchVolume": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"cpcMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"difficulty": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 100
							},
							{
								"type": "null"
							}
						]
					},
					"volumeUpdatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"latestPosition": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"positionDelta": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"rankHistory": {
						"maxItems": 30,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"capturedOn": {
									"type": "string",
									"format": "date",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
								},
								"position": {
									"anyOf": [
										{
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										{
											"type": "null"
										}
									]
								},
								"aiOverviewPresent": {
									"type": "boolean"
								}
							},
							"required": [
								"capturedOn",
								"position",
								"aiOverviewPresent"
							],
							"additionalProperties": false
						}
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"treatmentId",
					"phrase",
					"normalized",
					"source",
					"intent",
					"tracked",
					"gridTracked",
					"searchVolume",
					"cpcMicros",
					"difficulty",
					"volumeUpdatedAt",
					"archivedAt",
					"latestPosition",
					"positionDelta",
					"rankHistory",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoGridScan": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"keywordId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"trigger": {
						"type": "string",
						"enum": [
							"scheduled",
							"manual"
						]
					},
					"scheduledFor": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"centerLatitude": {
						"type": "number",
						"minimum": -90,
						"maximum": 90
					},
					"centerLongitude": {
						"type": "number",
						"minimum": -180,
						"maximum": 180
					},
					"zoom": {
						"type": "integer",
						"minimum": 1,
						"maximum": 22
					},
					"gridSize": {
						"anyOf": [
							{
								"type": "number",
								"const": 5
							},
							{
								"type": "number",
								"const": 7
							}
						]
					},
					"pointsTotal": {
						"type": "integer",
						"minimum": 25,
						"maximum": 49
					},
					"pointsCompleted": {
						"type": "integer",
						"minimum": 0,
						"maximum": 49
					},
					"averagePosition": {
						"anyOf": [
							{
								"type": "number",
								"exclusiveMinimum": 0
							},
							{
								"type": "null"
							}
						]
					},
					"bestPosition": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"worstPosition": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"top3Share": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0,
								"maximum": 1
							},
							{
								"type": "null"
							}
						]
					},
					"top10Share": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0,
								"maximum": 1
							},
							{
								"type": "null"
							}
						]
					},
					"costMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"keywordId",
					"status",
					"trigger",
					"scheduledFor",
					"centerLatitude",
					"centerLongitude",
					"zoom",
					"gridSize",
					"pointsTotal",
					"pointsCompleted",
					"averagePosition",
					"bestPosition",
					"worstPosition",
					"top3Share",
					"top10Share",
					"costMicros",
					"lastError",
					"startedAt",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoGridPoint": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"row": {
						"type": "integer",
						"minimum": 0,
						"maximum": 6
					},
					"column": {
						"type": "integer",
						"minimum": 0,
						"maximum": 6
					},
					"latitude": {
						"type": "number",
						"minimum": -90,
						"maximum": 90
					},
					"longitude": {
						"type": "number",
						"minimum": -180,
						"maximum": 180
					},
					"position": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"topResults": {
						"maxItems": 3,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"name": {
									"type": "string",
									"minLength": 1,
									"maxLength": 300
								},
								"placeId": {
									"type": "string",
									"minLength": 1,
									"maxLength": 512
								},
								"rating": {
									"anyOf": [
										{
											"type": "number",
											"minimum": 0,
											"maximum": 5
										},
										{
											"type": "null"
										}
									]
								},
								"reviewCount": {
									"anyOf": [
										{
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"name",
								"placeId",
								"rating",
								"reviewCount"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"id",
					"row",
					"column",
					"latitude",
					"longitude",
					"position",
					"topResults"
				],
				"additionalProperties": false
			},
			"SeoGridScanDetail": {
				"type": "object",
				"properties": {
					"scan": {
						"$ref": "#/components/schemas/SeoGridScan"
					},
					"points": {
						"maxItems": 49,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/SeoGridPoint"
						}
					}
				},
				"required": [
					"scan",
					"points"
				],
				"additionalProperties": false
			},
			"SeoKeywordResearchRun": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"query": {
						"type": "string",
						"minLength": 1,
						"maxLength": 300
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed"
						]
					},
					"result": {
						"anyOf": [
							{
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"phrase": {
											"type": "string",
											"minLength": 1,
											"maxLength": 120
										},
										"searchVolume": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"cpcMicros": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"difficulty": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 100
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"idea",
												"volume",
												"competitor"
											]
										}
									},
									"required": [
										"phrase",
										"searchVolume",
										"cpcMicros",
										"difficulty",
										"source"
									],
									"additionalProperties": false
								}
							},
							{
								"type": "null"
							}
						]
					},
					"costMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"query",
					"status",
					"result",
					"costMicros",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoCompetitor": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"placeId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 512
					},
					"name": {
						"type": "string",
						"minLength": 1,
						"maxLength": 300
					},
					"domain": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 253
							},
							{
								"type": "null"
							}
						]
					},
					"rating": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0,
								"maximum": 5
							},
							{
								"type": "null"
							}
						]
					},
					"reviewCount": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"map_pack",
							"manual"
						]
					},
					"tracked": {
						"type": "boolean"
					},
					"reviewVelocity": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"firstSeenAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastSeenAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"placeId",
					"name",
					"domain",
					"rating",
					"reviewCount",
					"source",
					"tracked",
					"reviewVelocity",
					"firstSeenAt",
					"lastSeenAt"
				],
				"additionalProperties": false
			},
			"SeoGscConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"connecting",
							"connected",
							"expired",
							"revoked",
							"error"
						]
					},
					"externalAccountRef": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 512
							},
							{
								"type": "null"
							}
						]
					},
					"propertyUri": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2048
							},
							{
								"type": "null"
							}
						]
					},
					"credentialVersion": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"status",
					"externalAccountRef",
					"propertyUri",
					"credentialVersion",
					"lastSyncedAt",
					"lastError",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoGbpAuditRun": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reputationLocationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"trigger": {
						"type": "string",
						"enum": [
							"scheduled",
							"manual"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"scheduledFor": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"errorCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"claim_budget_exhausted",
									"gbp_live_state_drifted",
									"google_post_rejected",
									"primary_domain_changed",
									"provider_content_invalid",
									"provider_operation_rejected",
									"provider_outcome_unknown",
									"provider_request_rejected",
									"provider_usage_unavailable",
									"queue_publication_budget_exhausted",
									"queue_send_failed"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"reputationLocationId",
					"trigger",
					"status",
					"scheduledFor",
					"errorCode",
					"startedAt",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoGbpFixLiveReview": {
				"type": "object",
				"properties": {
					"actionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"idempotencyVersion": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"field": {
						"type": "string",
						"minLength": 1,
						"maxLength": 100
					},
					"updateMask": {
						"minItems": 1,
						"maxItems": 20,
						"type": "array",
						"items": {
							"type": "string",
							"minLength": 1,
							"maxLength": 120
						}
					},
					"disposition": {
						"type": "string",
						"enum": [
							"ready",
							"already_applied",
							"drifted"
						]
					},
					"before": {
						"description": "live Google value; maximum 65536 UTF-8 bytes",
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "number"
							},
							{
								"type": "boolean"
							},
							{
								"type": "null"
							},
							{
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/schema3"
								}
							},
							{
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"$ref": "#/components/schemas/schema3"
								}
							}
						],
						"$ref": "#/components/schemas/schema3"
					},
					"after": {
						"anyOf": [
							{
								"description": "effective GBP fix; maximum 65536 UTF-8 bytes",
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "number"
									},
									{
										"type": "boolean"
									},
									{
										"type": "null"
									},
									{
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/schema4"
										}
									},
									{
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"$ref": "#/components/schemas/schema4"
										}
									}
								],
								"$ref": "#/components/schemas/schema4"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"actionId",
					"idempotencyVersion",
					"field",
					"updateMask",
					"disposition",
					"before",
					"after"
				],
				"additionalProperties": false
			},
			"SeoGbpPostSeries": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reputationLocationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"promptHint": {
						"type": "string",
						"minLength": 1,
						"maxLength": 2000
					},
					"topicType": {
						"type": "string",
						"enum": [
							"update",
							"offer",
							"event"
						]
					},
					"intervalWeeks": {
						"type": "integer",
						"minimum": 1,
						"maximum": 4
					},
					"dayOfWeek": {
						"type": "integer",
						"minimum": 0,
						"maximum": 6
					},
					"localTime": {
						"type": "string",
						"pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"
					},
					"timezone": {
						"type": "string",
						"minLength": 1,
						"maxLength": 64
					},
					"nextRunAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"enabled": {
						"type": "boolean"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"reputationLocationId",
					"promptHint",
					"topicType",
					"intervalWeeks",
					"dayOfWeek",
					"localTime",
					"timezone",
					"nextRunAt",
					"enabled",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoGbpPost": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reputationLocationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"seriesId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"scheduled",
							"publishing",
							"published",
							"rejected",
							"failed",
							"deleted"
						]
					},
					"topicType": {
						"type": "string",
						"enum": [
							"update",
							"offer",
							"event"
						]
					},
					"summary": {
						"type": "string",
						"minLength": 1,
						"maxLength": 1500
					},
					"ctaType": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"book",
									"order",
									"shop",
									"learn_more",
									"sign_up",
									"call"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"ctaUrl": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2048,
								"format": "uri"
							},
							{
								"type": "null"
							}
						]
					},
					"eventTitle": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 200
							},
							{
								"type": "null"
							}
						]
					},
					"eventStartsAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"eventEndsAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"offerCouponCode": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 100
							},
							{
								"type": "null"
							}
						]
					},
					"offerTerms": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 5000
							},
							{
								"type": "null"
							}
						]
					},
					"contentFingerprint": {
						"type": "string",
						"pattern": "^[0-9a-f]{64}$"
					},
					"source": {
						"type": "string",
						"enum": [
							"manual",
							"ai_suggested",
							"crm_event",
							"series"
						]
					},
					"scheduledFor": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalPostName": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 1024
							},
							{
								"type": "null"
							}
						]
					},
					"media": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/SeoMediaAsset"
							},
							{
								"type": "null"
							}
						]
					},
					"errorCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"claim_budget_exhausted",
									"gbp_live_state_drifted",
									"google_post_rejected",
									"primary_domain_changed",
									"provider_content_invalid",
									"provider_operation_rejected",
									"provider_outcome_unknown",
									"provider_request_rejected",
									"provider_usage_unavailable",
									"queue_publication_budget_exhausted",
									"queue_send_failed"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"publishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"reputationLocationId",
					"seriesId",
					"status",
					"topicType",
					"summary",
					"ctaType",
					"ctaUrl",
					"eventTitle",
					"eventStartsAt",
					"eventEndsAt",
					"offerCouponCode",
					"offerTerms",
					"contentFingerprint",
					"source",
					"scheduledFor",
					"externalPostName",
					"media",
					"errorCode",
					"publishedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoMediaAsset": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"publicId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"mime": {
						"type": "string",
						"enum": [
							"image/jpeg",
							"image/png"
						]
					},
					"bytes": {
						"type": "integer",
						"minimum": 10240,
						"maximum": 5242880
					},
					"width": {
						"type": "integer",
						"minimum": 250,
						"maximum": 4096
					},
					"height": {
						"type": "integer",
						"minimum": 250,
						"maximum": 4096
					},
					"sha256": {
						"type": "string",
						"pattern": "^[0-9a-f]{64}$"
					},
					"status": {
						"type": "string",
						"enum": [
							"uploading",
							"ready",
							"attached",
							"orphaned"
						]
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"publicId",
					"mime",
					"bytes",
					"width",
					"height",
					"sha256",
					"status",
					"expiresAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoSiteAudit": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"trigger": {
						"type": "string",
						"enum": [
							"scheduled",
							"manual"
						]
					},
					"scheduledFor": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"targetUrl": {
						"type": "string",
						"maxLength": 2048,
						"format": "uri"
					},
					"maxPages": {
						"type": "integer",
						"minimum": 1,
						"maximum": 500
					},
					"pagesCrawled": {
						"type": "integer",
						"minimum": 0,
						"maximum": 500
					},
					"onpageScore": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0,
								"maximum": 100
							},
							{
								"type": "null"
							}
						]
					},
					"lighthouse": {
						"anyOf": [
							{
								"description": "Lighthouse result; maximum 65536 UTF-8 bytes",
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "number"
									},
									{
										"type": "boolean"
									},
									{
										"type": "null"
									},
									{
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/schema5"
										}
									},
									{
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"$ref": "#/components/schemas/schema5"
										}
									}
								],
								"$ref": "#/components/schemas/schema5"
							},
							{
								"type": "null"
							}
						]
					},
					"costMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"status",
					"trigger",
					"scheduledFor",
					"targetUrl",
					"maxPages",
					"pagesCrawled",
					"onpageScore",
					"lighthouse",
					"costMicros",
					"lastError",
					"startedAt",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoSiteFinding": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"checkKey": {
						"type": "string",
						"minLength": 1,
						"maxLength": 120
					},
					"pageUrl": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2048,
								"format": "uri"
							},
							{
								"type": "null"
							}
						]
					},
					"severity": {
						"type": "string",
						"enum": [
							"info",
							"warning",
							"error",
							"critical"
						]
					},
					"pagesAffected": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"details": {
						"description": "SEO finding details; maximum 16384 UTF-8 bytes",
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "number"
							},
							{
								"type": "boolean"
							},
							{
								"type": "null"
							},
							{
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/schema6"
								}
							},
							{
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"$ref": "#/components/schemas/schema6"
								}
							}
						],
						"$ref": "#/components/schemas/schema6"
					},
					"summary": {
						"type": "string",
						"minLength": 1,
						"maxLength": 2000
					},
					"fixBrief": {
						"type": "string",
						"minLength": 1,
						"maxLength": 16000
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"sent",
							"resolved",
							"dismissed",
							"regressed"
						]
					},
					"firstSeenAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastSeenAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"checkKey",
					"pageUrl",
					"severity",
					"pagesAffected",
					"details",
					"summary",
					"fixBrief",
					"status",
					"firstSeenAt",
					"lastSeenAt",
					"resolvedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoSiteFindingObservation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"findingId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"auditId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"severity": {
						"type": "string",
						"enum": [
							"info",
							"warning",
							"error",
							"critical"
						]
					},
					"pagesAffected": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"details": {
						"description": "SEO finding observation details; maximum 16384 UTF-8 bytes",
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "number"
							},
							{
								"type": "boolean"
							},
							{
								"type": "null"
							},
							{
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/schema7"
								}
							},
							{
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"$ref": "#/components/schemas/schema7"
								}
							}
						],
						"$ref": "#/components/schemas/schema7"
					},
					"parserVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"observedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"findingId",
					"auditId",
					"severity",
					"pagesAffected",
					"details",
					"parserVersion",
					"observedAt"
				],
				"additionalProperties": false
			},
			"SeoAiSampleRun": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"weekStart": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"trigger": {
						"type": "string",
						"enum": [
							"scheduled",
							"manual"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"plannedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"completedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"presenceRate": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0,
								"maximum": 1
							},
							{
								"type": "null"
							}
						]
					},
					"citationRate": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0,
								"maximum": 1
							},
							{
								"type": "null"
							}
						]
					},
					"costMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"weekStart",
					"trigger",
					"status",
					"plannedCount",
					"completedCount",
					"presenceRate",
					"citationRate",
					"costMicros",
					"lastError",
					"startedAt",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoAiSample": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"runId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"treatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"sampleKey": {
						"type": "string",
						"minLength": 1,
						"maxLength": 200
					},
					"platform": {
						"type": "string",
						"enum": [
							"chatgpt",
							"gemini",
							"perplexity",
							"google_ai_mode"
						]
					},
					"model": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 200
							},
							{
								"type": "null"
							}
						]
					},
					"deliveryMode": {
						"type": "string",
						"enum": [
							"standard",
							"live"
						]
					},
					"promptVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"prompt": {
						"type": "string",
						"minLength": 1,
						"maxLength": 300
					},
					"observedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"mentioned": {
						"type": "boolean"
					},
					"cited": {
						"type": "boolean"
					},
					"citations": {
						"maxItems": 20,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"title": {
									"anyOf": [
										{
											"type": "string",
											"maxLength": 500
										},
										{
											"type": "null"
										}
									]
								},
								"url": {
									"type": "string",
									"maxLength": 2048,
									"format": "uri"
								}
							},
							"required": [
								"title",
								"url"
							],
							"additionalProperties": false
						}
					},
					"mentionOrder": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"competitorsMentioned": {
						"maxItems": 10,
						"type": "array",
						"items": {
							"type": "string",
							"minLength": 1,
							"maxLength": 300
						}
					},
					"responseExcerpt": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"runId",
					"locationId",
					"treatmentId",
					"sampleKey",
					"platform",
					"model",
					"deliveryMode",
					"promptVersion",
					"prompt",
					"observedAt",
					"mentioned",
					"cited",
					"citations",
					"mentionOrder",
					"competitorsMentioned",
					"responseExcerpt"
				],
				"additionalProperties": false
			},
			"SeoContentBrief": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"keywordId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"targetPhrase": {
						"type": "string",
						"minLength": 1,
						"maxLength": 120
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"terms": {
						"anyOf": [
							{
								"maxItems": 200,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"term": {
											"type": "string",
											"minLength": 1,
											"maxLength": 120
										},
										"weight": {
											"type": "number",
											"exclusiveMinimum": 0
										},
										"targetMin": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"targetMax": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"term",
										"weight",
										"targetMin",
										"targetMax"
									],
									"additionalProperties": false
								}
							},
							{
								"type": "null"
							}
						]
					},
					"headings": {
						"anyOf": [
							{
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "string",
									"minLength": 1,
									"maxLength": 300
								}
							},
							{
								"type": "null"
							}
						]
					},
					"questions": {
						"anyOf": [
							{
								"maxItems": 30,
								"type": "array",
								"items": {
									"type": "string",
									"minLength": 1,
									"maxLength": 500
								}
							},
							{
								"type": "null"
							}
						]
					},
					"targetWordCountMin": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"targetWordCountMax": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"costMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"keywordId",
					"targetPhrase",
					"status",
					"terms",
					"headings",
					"questions",
					"targetWordCountMin",
					"targetWordCountMax",
					"costMicros",
					"lastError",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoContentDocument": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"briefId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"keywordId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"title": {
						"type": "string",
						"minLength": 1,
						"maxLength": 300
					},
					"draftJson": {
						"description": "TipTap document; maximum 524288 UTF-8 bytes",
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "number"
							},
							{
								"type": "boolean"
							},
							{
								"type": "null"
							},
							{
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/schema8"
								}
							},
							{
								"type": "object",
								"propertyNames": {
									"type": "string"
								},
								"additionalProperties": {
									"$ref": "#/components/schemas/schema8"
								}
							}
						],
						"$ref": "#/components/schemas/schema8"
					},
					"editorSchemaVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"in_review",
							"changes_requested",
							"approved",
							"exported"
						]
					},
					"reviewerPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"approvedRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewNote": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 4000
							},
							{
								"type": "null"
							}
						]
					},
					"exportedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"briefId",
					"locationId",
					"keywordId",
					"title",
					"draftJson",
					"editorSchemaVersion",
					"version",
					"status",
					"reviewerPractitionerId",
					"approvedRevisionId",
					"reviewNote",
					"exportedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoContentRevision": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"documentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"revisionNumber": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"editorSchemaVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"contentHash": {
						"type": "string",
						"pattern": "^[0-9a-f]{64}$"
					},
					"wordCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"contentScore": {
						"type": "object",
						"properties": {
							"version": {
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							"total": {
								"type": "integer",
								"minimum": 0,
								"maximum": 100
							},
							"components": {
								"type": "object",
								"properties": {
									"terms": {
										"type": "integer",
										"minimum": 0,
										"maximum": 100
									},
									"headings": {
										"type": "integer",
										"minimum": 0,
										"maximum": 100
									},
									"questions": {
										"type": "integer",
										"minimum": 0,
										"maximum": 100
									},
									"wordCount": {
										"type": "integer",
										"minimum": 0,
										"maximum": 100
									},
									"readability": {
										"type": "integer",
										"minimum": 0,
										"maximum": 100
									}
								},
								"required": [
									"terms",
									"headings",
									"questions",
									"wordCount",
									"readability"
								],
								"additionalProperties": false
							},
							"wordCount": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"version",
							"total",
							"components",
							"wordCount"
						],
						"additionalProperties": false
					},
					"source": {
						"type": "string",
						"enum": [
							"user",
							"ai_draft"
						]
					},
					"approvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"approvedById": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1,
								"maxLength": 255
							},
							{
								"type": "null"
							}
						]
					},
					"reviewerPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewerDisplayName": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 300
							},
							{
								"type": "null"
							}
						]
					},
					"reviewerRegistrationRef": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 200
							},
							{
								"type": "null"
							}
						]
					},
					"reviewNote": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 4000
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"documentId",
					"revisionNumber",
					"editorSchemaVersion",
					"contentHash",
					"wordCount",
					"contentScore",
					"source",
					"approvedAt",
					"approvedById",
					"reviewerPractitionerId",
					"reviewerDisplayName",
					"reviewerRegistrationRef",
					"reviewNote",
					"createdAt"
				],
				"additionalProperties": false
			},
			"SeoContentGenerationRun": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"documentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled",
							"applied",
							"conflict"
						]
					},
					"promptVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"baseDocumentVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"baseContentHash": {
						"type": "string",
						"pattern": "^[0-9a-f]{64}$"
					},
					"candidateContentHash": {
						"anyOf": [
							{
								"type": "string",
								"pattern": "^[0-9a-f]{64}$"
							},
							{
								"type": "null"
							}
						]
					},
					"candidateAvailable": {
						"type": "boolean"
					},
					"costMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"appliedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"documentId",
					"status",
					"promptVersion",
					"baseDocumentVersion",
					"baseContentHash",
					"candidateContentHash",
					"candidateAvailable",
					"costMicros",
					"lastError",
					"completedAt",
					"appliedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoWebmasterContact": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"email": {
						"type": "string",
						"maxLength": 320,
						"format": "email",
						"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
					},
					"status": {
						"type": "string",
						"enum": [
							"confirmed",
							"awaiting_confirmation",
							"confirmation_exhausted",
							"blocked"
						]
					},
					"verifiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"blockedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"confirmationRetryAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"canUnblock": {
						"type": "boolean"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"email",
					"status",
					"verifiedAt",
					"blockedAt",
					"confirmationRetryAt",
					"canUnblock",
					"createdAt"
				],
				"additionalProperties": false
			},
			"SeoWebmasterContacts": {
				"type": "object",
				"properties": {
					"contacts": {
						"maxItems": 50,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/SeoWebmasterContact"
						}
					},
					"capacity": {
						"type": "object",
						"properties": {
							"used": {
								"type": "integer",
								"minimum": 0,
								"maximum": 50
							},
							"limit": {
								"type": "number",
								"const": 50
							}
						},
						"required": [
							"used",
							"limit"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"contacts",
					"capacity"
				],
				"additionalProperties": false
			},
			"SeoWebmasterDelivery": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"artifactKind": {
						"type": "string",
						"enum": [
							"content",
							"finding_brief"
						]
					},
					"contactId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"recipientEmail": {
						"type": "string",
						"maxLength": 320,
						"format": "email",
						"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
					},
					"documentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"revisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"findingId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"format": {
						"type": "string",
						"enum": [
							"html",
							"markdown",
							"developer_brief"
						]
					},
					"rendererVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"renderedHash": {
						"type": "string",
						"pattern": "^[0-9a-f]{64}$"
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"sending",
							"sent",
							"failed"
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"providerMessageId": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 512
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"artifactKind",
					"contactId",
					"recipientEmail",
					"documentId",
					"revisionId",
					"findingId",
					"format",
					"rendererVersion",
					"renderedHash",
					"status",
					"attemptCount",
					"providerMessageId",
					"lastError",
					"sentAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoContentExport": {
				"type": "object",
				"properties": {
					"documentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"revisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"format": {
						"type": "string",
						"enum": [
							"html",
							"markdown"
						]
					},
					"filename": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255
					},
					"mime": {
						"type": "string",
						"enum": [
							"text/html",
							"text/markdown"
						]
					},
					"content": {
						"type": "string",
						"minLength": 1,
						"maxLength": 1048576
					},
					"contentHash": {
						"type": "string",
						"pattern": "^[0-9a-f]{64}$"
					}
				},
				"required": [
					"documentId",
					"revisionId",
					"format",
					"filename",
					"mime",
					"content",
					"contentHash"
				],
				"additionalProperties": false
			},
			"SeoListingCheckRun": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"trigger": {
						"type": "string",
						"enum": [
							"scheduled",
							"manual"
						]
					},
					"scheduledFor": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"plannedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"completedCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"status",
					"trigger",
					"scheduledFor",
					"plannedCount",
					"completedCount",
					"lastError",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoListingCheck": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"runId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"directoryKey": {
						"type": "string",
						"enum": [
							"yell",
							"thomson_local",
							"one92",
							"scoot",
							"bing_places",
							"apple_maps",
							"facebook",
							"nhs"
						]
					},
					"day": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"status": {
						"type": "string",
						"enum": [
							"found",
							"not_found",
							"fetch_failed",
							"blocked"
						]
					},
					"listingUrl": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2048,
								"format": "uri"
							},
							{
								"type": "null"
							}
						]
					},
					"extracted": {
						"anyOf": [
							{
								"description": "Extracted listing NAP; maximum 16384 UTF-8 bytes",
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "number"
									},
									{
										"type": "boolean"
									},
									{
										"type": "null"
									},
									{
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/schema9"
										}
									},
									{
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"$ref": "#/components/schemas/schema9"
										}
									}
								],
								"$ref": "#/components/schemas/schema9"
							},
							{
								"type": "null"
							}
						]
					},
					"diff": {
						"anyOf": [
							{
								"description": "Listing NAP diff; maximum 16384 UTF-8 bytes",
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "number"
									},
									{
										"type": "boolean"
									},
									{
										"type": "null"
									},
									{
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/schema10"
										}
									},
									{
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {
											"$ref": "#/components/schemas/schema10"
										}
									}
								],
								"$ref": "#/components/schemas/schema10"
							},
							{
								"type": "null"
							}
						]
					},
					"matchScore": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0,
								"maximum": 1
							},
							{
								"type": "null"
							}
						]
					},
					"parserVersion": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"runId",
					"locationId",
					"directoryKey",
					"day",
					"status",
					"listingUrl",
					"extracted",
					"diff",
					"matchScore",
					"parserVersion",
					"createdAt"
				],
				"additionalProperties": false
			},
			"SeoListingOverride": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"directoryKey": {
						"type": "string",
						"enum": [
							"yell",
							"thomson_local",
							"one92",
							"scoot",
							"bing_places",
							"apple_maps",
							"facebook",
							"nhs"
						]
					},
					"confirmedUrl": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2048,
								"format": "uri"
							},
							{
								"type": "null"
							}
						]
					},
					"ignoredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"locationId",
					"directoryKey",
					"confirmedUrl",
					"ignoredAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SeoOverviewPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"settings": {
								"$ref": "#/components/schemas/SeoSettings"
							},
							"reviewers": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoContentReviewer"
								}
							},
							"visibility": {
								"type": "object",
								"properties": {
									"current": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/SeoVisibilityScore"
											},
											{
												"type": "null"
											}
										]
									},
									"trend": {
										"maxItems": 53,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoVisibilityScore"
										}
									}
								},
								"required": [
									"current",
									"trend"
								],
								"additionalProperties": false
							},
							"attribution": {
								"type": "object",
								"properties": {
									"series": {
										"maxItems": 53,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"periodStart": {
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												"trackedLeads": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"confirmedValueCents": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"organicSearchLeads": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"gbpLeads": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"aiLeads": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"periodStart",
												"trackedLeads",
												"confirmedValueCents",
												"organicSearchLeads",
												"gbpLeads",
												"aiLeads"
											],
											"additionalProperties": false
										}
									},
									"trackedLeads": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"confirmedValueCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"priorTrackedLeads": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"priorConfirmedValueCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"series",
									"trackedLeads",
									"confirmedValueCents",
									"priorTrackedLeads",
									"priorConfirmedValueCents"
								],
								"additionalProperties": false
							},
							"actions": {
								"maxItems": 3,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoAction"
								}
							},
							"events": {
								"maxItems": 20,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoEvent"
								}
							},
							"budget": {
								"type": "object",
								"properties": {
									"month": {
										"type": "string",
										"pattern": "^\\d{4}-\\d{2}$"
									},
									"spentMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ceilingMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ratio": {
										"type": "number",
										"minimum": 0
									},
									"state": {
										"type": "string",
										"enum": [
											"ok",
											"warning",
											"exhausted"
										]
									}
								},
								"required": [
									"month",
									"spentMicros",
									"ceilingMicros",
									"ratio",
									"state"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"settings",
							"reviewers",
							"visibility",
							"attribution",
							"actions",
							"events",
							"budget"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"SeoSearchVisibilityPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"settings": {
								"$ref": "#/components/schemas/SeoSettings"
							},
							"locations": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string",
											"minLength": 1,
											"maxLength": 300
										},
										"city": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 200
												},
												{
													"type": "null"
												}
											]
										},
										"timezone": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64
										},
										"latitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -90,
													"maximum": 90
												},
												{
													"type": "null"
												}
											]
										},
										"longitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -180,
													"maximum": 180
												},
												{
													"type": "null"
												}
											]
										},
										"coordinatesConfirmedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"name",
										"city",
										"timezone",
										"latitude",
										"longitude",
										"coordinatesConfirmedAt"
									],
									"additionalProperties": false
								}
							},
							"selectedLocationId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"keywords": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoKeyword"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"recentGridScans": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoGridScan"
								}
							},
							"competitors": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoCompetitor"
								}
							},
							"gsc": {
								"type": "object",
								"properties": {
									"connection": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/SeoGscConnection"
											},
											{
												"type": "null"
											}
										]
									},
									"properties": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"propertyUri": {
													"type": "string",
													"minLength": 1,
													"maxLength": 2048
												},
												"permissionLevel": {
													"type": "string",
													"minLength": 1,
													"maxLength": 100
												}
											},
											"required": [
												"propertyUri",
												"permissionLevel"
											],
											"additionalProperties": false
										}
									},
									"dailyTotals": {
										"maxItems": 90,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"date": {
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												"clicks": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"impressions": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"averagePosition": {
													"type": "number",
													"minimum": 0
												}
											},
											"required": [
												"date",
												"clicks",
												"impressions",
												"averagePosition"
											],
											"additionalProperties": false
										}
									},
									"queryStats": {
										"maxItems": 250,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"weekStart": {
													"type": "string",
													"format": "date",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
												},
												"query": {
													"type": "string",
													"minLength": 1,
													"maxLength": 1000
												},
												"clicks": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"impressions": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"averagePosition": {
													"type": "number",
													"minimum": 0
												}
											},
											"required": [
												"weekStart",
												"query",
												"clicks",
												"impressions",
												"averagePosition"
											],
											"additionalProperties": false
										}
									}
								},
								"required": [
									"connection",
									"properties",
									"dailyTotals",
									"queryStats"
								],
								"additionalProperties": false
							},
							"keywordResearch": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoKeywordResearchRun"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"budget": {
								"type": "object",
								"properties": {
									"month": {
										"type": "string",
										"pattern": "^\\d{4}-\\d{2}$"
									},
									"spentMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ceilingMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ratio": {
										"type": "number",
										"minimum": 0
									},
									"state": {
										"type": "string",
										"enum": [
											"ok",
											"warning",
											"exhausted"
										]
									}
								},
								"required": [
									"month",
									"spentMicros",
									"ceilingMicros",
									"ratio",
									"state"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"settings",
							"locations",
							"selectedLocationId",
							"keywords",
							"recentGridScans",
							"competitors",
							"gsc",
							"keywordResearch",
							"budget"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"SeoGbpPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"settings": {
								"$ref": "#/components/schemas/SeoSettings"
							},
							"locations": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string",
											"minLength": 1,
											"maxLength": 300
										},
										"city": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 200
												},
												{
													"type": "null"
												}
											]
										},
										"timezone": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64
										},
										"latitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -90,
													"maximum": 90
												},
												{
													"type": "null"
												}
											]
										},
										"longitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -180,
													"maximum": 180
												},
												{
													"type": "null"
												}
											]
										},
										"coordinatesConfirmedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"name",
										"city",
										"timezone",
										"latitude",
										"longitude",
										"coordinatesConfirmedAt"
									],
									"additionalProperties": false
								}
							},
							"selectedLocationId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"gbpLocations": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ReputationLocation"
								}
							},
							"connections": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ReputationConnection"
								}
							},
							"accounts": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/ReputationAccount"
								}
							},
							"latestAuditRuns": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoGbpAuditRun"
								}
							},
							"actions": {
								"maxItems": 50,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoAction"
								}
							},
							"openActionCount": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"posts": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoGbpPost"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"series": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoGbpPostSeries"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"media": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoMediaAsset"
								}
							}
						},
						"required": [
							"settings",
							"locations",
							"selectedLocationId",
							"gbpLocations",
							"connections",
							"accounts",
							"latestAuditRuns",
							"actions",
							"openActionCount",
							"posts",
							"series",
							"media"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"SeoWebsitePage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"settings": {
								"$ref": "#/components/schemas/SeoSettings"
							},
							"audits": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoSiteAudit"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"findingSummary": {
								"type": "object",
								"properties": {
									"openCount": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"criticalCount": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"openCount",
									"criticalCount"
								],
								"additionalProperties": false
							},
							"findings": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoSiteFinding"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"observations": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoSiteFindingObservation"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"deliveries": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoWebmasterDelivery"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"budget": {
								"type": "object",
								"properties": {
									"month": {
										"type": "string",
										"pattern": "^\\d{4}-\\d{2}$"
									},
									"spentMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ceilingMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ratio": {
										"type": "number",
										"minimum": 0
									},
									"state": {
										"type": "string",
										"enum": [
											"ok",
											"warning",
											"exhausted"
										]
									}
								},
								"required": [
									"month",
									"spentMicros",
									"ceilingMicros",
									"ratio",
									"state"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"settings",
							"audits",
							"findingSummary",
							"findings",
							"observations",
							"deliveries",
							"budget"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"SeoAiVisibilityPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"settings": {
								"$ref": "#/components/schemas/SeoSettings"
							},
							"locations": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string",
											"minLength": 1,
											"maxLength": 300
										},
										"city": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 200
												},
												{
													"type": "null"
												}
											]
										},
										"timezone": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64
										},
										"latitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -90,
													"maximum": 90
												},
												{
													"type": "null"
												}
											]
										},
										"longitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -180,
													"maximum": 180
												},
												{
													"type": "null"
												}
											]
										},
										"coordinatesConfirmedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"name",
										"city",
										"timezone",
										"latitude",
										"longitude",
										"coordinatesConfirmedAt"
									],
									"additionalProperties": false
								}
							},
							"selectedLocationId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"latestRun": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"run": {
												"$ref": "#/components/schemas/SeoAiSampleRun"
											},
											"completedCount": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											"presenceRate": {
												"anyOf": [
													{
														"type": "number",
														"minimum": 0,
														"maximum": 1
													},
													{
														"type": "null"
													}
												]
											},
											"citationRate": {
												"anyOf": [
													{
														"type": "number",
														"minimum": 0,
														"maximum": 1
													},
													{
														"type": "null"
													}
												]
											},
											"platforms": {
												"maxItems": 4,
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"platform": {
															"type": "string",
															"enum": [
																"chatgpt",
																"gemini",
																"perplexity",
																"google_ai_mode"
															]
														},
														"completedCount": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"mentionedCount": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"citedCount": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"platform",
														"completedCount",
														"mentionedCount",
														"citedCount"
													],
													"additionalProperties": false
												}
											}
										},
										"required": [
											"run",
											"completedCount",
											"presenceRate",
											"citationRate",
											"platforms"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							},
							"runs": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoAiSampleRun"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"samples": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoAiSample"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"budget": {
								"type": "object",
								"properties": {
									"month": {
										"type": "string",
										"pattern": "^\\d{4}-\\d{2}$"
									},
									"spentMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ceilingMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ratio": {
										"type": "number",
										"minimum": 0
									},
									"state": {
										"type": "string",
										"enum": [
											"ok",
											"warning",
											"exhausted"
										]
									}
								},
								"required": [
									"month",
									"spentMicros",
									"ceilingMicros",
									"ratio",
									"state"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"settings",
							"locations",
							"selectedLocationId",
							"latestRun",
							"runs",
							"samples",
							"budget"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"SeoContentPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"settings": {
								"$ref": "#/components/schemas/SeoSettings"
							},
							"locations": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string",
											"minLength": 1,
											"maxLength": 300
										},
										"city": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 200
												},
												{
													"type": "null"
												}
											]
										},
										"timezone": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64
										},
										"latitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -90,
													"maximum": 90
												},
												{
													"type": "null"
												}
											]
										},
										"longitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -180,
													"maximum": 180
												},
												{
													"type": "null"
												}
											]
										},
										"coordinatesConfirmedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"name",
										"city",
										"timezone",
										"latitude",
										"longitude",
										"coordinatesConfirmedAt"
									],
									"additionalProperties": false
								}
							},
							"selectedLocationId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"reviewers": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoContentReviewer"
								}
							},
							"targetSuggestions": {
								"maxItems": 20,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoContentTargetSuggestion"
								}
							},
							"briefs": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoContentBrief"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"documents": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoContentDocument"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"budget": {
								"type": "object",
								"properties": {
									"month": {
										"type": "string",
										"pattern": "^\\d{4}-\\d{2}$"
									},
									"spentMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ceilingMicros": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"ratio": {
										"type": "number",
										"minimum": 0
									},
									"state": {
										"type": "string",
										"enum": [
											"ok",
											"warning",
											"exhausted"
										]
									}
								},
								"required": [
									"month",
									"spentMicros",
									"ceilingMicros",
									"ratio",
									"state"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"settings",
							"locations",
							"selectedLocationId",
							"reviewers",
							"targetSuggestions",
							"briefs",
							"documents",
							"budget"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"SeoContentDocumentPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"document": {
								"$ref": "#/components/schemas/SeoContentDocument"
							},
							"brief": {
								"$ref": "#/components/schemas/SeoContentBrief"
							},
							"reviewers": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoContentReviewer"
								}
							},
							"revisions": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoContentRevision"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"generationRuns": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoContentGenerationRun"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"deliveries": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoWebmasterDelivery"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							},
							"media": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoMediaAsset"
								}
							}
						},
						"required": [
							"document",
							"brief",
							"reviewers",
							"revisions",
							"generationRuns",
							"deliveries",
							"media"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"SeoListingsPage": {
				"type": "object",
				"properties": {
					"entitlement": {
						"$ref": "#/components/schemas/SeoEntitlement"
					},
					"permissions": {
						"$ref": "#/components/schemas/SeoPermissions"
					},
					"data": {
						"type": "object",
						"properties": {
							"locations": {
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"name": {
											"type": "string",
											"minLength": 1,
											"maxLength": 300
										},
										"city": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 200
												},
												{
													"type": "null"
												}
											]
										},
										"timezone": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64
										},
										"latitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -90,
													"maximum": 90
												},
												{
													"type": "null"
												}
											]
										},
										"longitude": {
											"anyOf": [
												{
													"type": "number",
													"minimum": -180,
													"maximum": 180
												},
												{
													"type": "null"
												}
											]
										},
										"coordinatesConfirmedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"name",
										"city",
										"timezone",
										"latitude",
										"longitude",
										"coordinatesConfirmedAt"
									],
									"additionalProperties": false
								}
							},
							"selectedLocationId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"directories": {
								"maxItems": 8,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"key": {
											"type": "string",
											"enum": [
												"yell",
												"thomson_local",
												"one92",
												"scoot",
												"bing_places",
												"apple_maps",
												"facebook",
												"nhs"
											]
										},
										"label": {
											"type": "string",
											"minLength": 1,
											"maxLength": 100
										},
										"guidedFixUrl": {
											"type": "string",
											"maxLength": 2048,
											"format": "uri"
										},
										"parserVersion": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"key",
										"label",
										"guidedFixUrl",
										"parserVersion"
									],
									"additionalProperties": false
								}
							},
							"latestChecks": {
								"maxItems": 800,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoListingCheck"
								}
							},
							"overrides": {
								"maxItems": 800,
								"type": "array",
								"items": {
									"$ref": "#/components/schemas/SeoListingOverride"
								}
							},
							"runs": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SeoListingCheckRun"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"locations",
							"selectedLocationId",
							"directories",
							"latestChecks",
							"overrides",
							"runs"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"data"
				],
				"additionalProperties": false
			},
			"AdsEntitlement": {
				"type": "object",
				"properties": {
					"enabled": {
						"type": "boolean"
					},
					"readOnly": {
						"type": "boolean"
					},
					"upgradeRequired": {
						"type": "boolean"
					}
				},
				"required": [
					"enabled",
					"readOnly",
					"upgradeRequired"
				],
				"additionalProperties": false
			},
			"AdsPermissions": {
				"type": "object",
				"properties": {
					"read": {
						"type": "boolean"
					},
					"manage": {
						"type": "boolean"
					},
					"publish": {
						"type": "boolean"
					},
					"creative": {
						"type": "boolean"
					}
				},
				"required": [
					"read",
					"manage",
					"publish",
					"creative"
				],
				"additionalProperties": false
			},
			"AdsTargeting": {
				"type": "object",
				"properties": {
					"locations": {
						"maxItems": 50,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"locationId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"radiusKm": {
									"type": "number",
									"minimum": 1,
									"maximum": 100
								}
							},
							"required": [
								"locationId",
								"radiusKm"
							],
							"additionalProperties": false
						}
					},
					"ageMin": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 18,
								"maximum": 65
							},
							{
								"type": "null"
							}
						]
					},
					"ageMax": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 18,
								"maximum": 65
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"locations",
					"ageMin",
					"ageMax"
				],
				"additionalProperties": false,
				"description": "ageMax must be at least ageMin"
			},
			"AdsCampaign": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalAccountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"platformKind": {
						"type": "string",
						"enum": [
							"google_search",
							"google_pmax",
							"google_demand_gen",
							"meta_leads",
							"meta_website",
							"tiktok_smartplus_leadgen",
							"chatgpt_chat_card",
							"external"
						]
					},
					"name": {
						"type": "string"
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"managementState": {
						"type": "string",
						"enum": [
							"draft",
							"creating",
							"managed",
							"external",
							"adopting",
							"detached"
						]
					},
					"lifecycleStatus": {
						"type": "string",
						"enum": [
							"draft",
							"paused",
							"active",
							"ended",
							"archived",
							"create_failed"
						]
					},
					"externalStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalEffectiveStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adoptedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"currencyCode": {
						"type": "string"
					},
					"dailyBudgetMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"startAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"endAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"targeting": {
						"$ref": "#/components/schemas/AdsTargeting"
					},
					"servicesAdvertised": {
						"maxItems": 20,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"serviceKey": {
									"type": "string",
									"minLength": 1,
									"maxLength": 120
								},
								"label": {
									"type": "string",
									"minLength": 1,
									"maxLength": 200
								}
							},
							"required": [
								"serviceKey",
								"label"
							],
							"additionalProperties": false
						}
					},
					"targetCplMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"optimizationGoal": {
						"type": "string",
						"enum": [
							"booking",
							"lead"
						]
					},
					"optimizationFallbackAppliedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"destinationUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"leadFormExternalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"learningStatus": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"learning",
									"learned",
									"limited"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"learningStartedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"publishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"policyIssueCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"driftDetectedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"adsManagerUrl": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"organizationId",
					"connectionId",
					"externalAccountId",
					"locationId",
					"provider",
					"platformKind",
					"name",
					"externalId",
					"managementState",
					"lifecycleStatus",
					"externalStatus",
					"externalEffectiveStatus",
					"adoptedAt",
					"currencyCode",
					"dailyBudgetMicros",
					"startAt",
					"endAt",
					"targeting",
					"servicesAdvertised",
					"targetCplMicros",
					"optimizationGoal",
					"optimizationFallbackAppliedAt",
					"destinationUrl",
					"leadFormExternalId",
					"learningStatus",
					"learningStartedAt",
					"publishedAt",
					"policyIssueCount",
					"driftDetectedAt",
					"version",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"adsManagerUrl"
				],
				"additionalProperties": false
			},
			"AdsAdGroup": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"campaignId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"ad_group",
							"asset_group",
							"ad_set",
							"tiktok_ad_group"
						]
					},
					"serviceKey": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"campaignId",
					"kind",
					"serviceKey",
					"externalId",
					"name",
					"externalStatus",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AdsAd": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"adGroupId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"content": {},
					"creativeVariantId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"policyReview": {},
					"fatigueFlaggedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"adGroupId",
					"externalId",
					"name",
					"content",
					"creativeVariantId",
					"externalStatus",
					"policyReview",
					"fatigueFlaggedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AdsMutationSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"create_campaign",
							"adopt_campaign",
							"publish",
							"pause",
							"resume",
							"update_budget",
							"update_schedule",
							"update_destination",
							"update_targeting",
							"apply_creative_batch",
							"set_optimization_goal",
							"create_lead_form"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"claimed",
							"submitted",
							"ambiguous",
							"confirmed",
							"failed",
							"superseded"
						]
					},
					"providerResourceId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"submittedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"confirmedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"failedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersededAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"kind",
					"status",
					"providerResourceId",
					"lastError",
					"submittedAt",
					"confirmedAt",
					"failedAt",
					"supersededAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"AdsAlert": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"kind": {
						"type": "string",
						"enum": [
							"cpl_spike",
							"delivery_stopped",
							"budget_exhausted",
							"disapproval",
							"account_health",
							"learning_stuck",
							"fatigue"
						]
					},
					"severity": {
						"type": "string",
						"enum": [
							"info",
							"warning",
							"critical"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"acknowledged",
							"resolved",
							"expired"
						]
					},
					"campaignId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"title": {
						"type": "string"
					},
					"body": {
						"type": "string"
					},
					"context": {},
					"actionKind": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"optimize_on_leads",
									"open_creative_studio"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"acknowledgedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"acknowledgedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"kind",
					"severity",
					"status",
					"campaignId",
					"title",
					"body",
					"context",
					"actionKind",
					"acknowledgedAt",
					"acknowledgedById",
					"resolvedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AdsSettings": {
				"type": "object",
				"properties": {
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"monthlySpendCapMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"generationBudgetMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"spendCapCurrency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"organizationId",
					"monthlySpendCapMicros",
					"generationBudgetMicros",
					"spendCapCurrency",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AdsSpendResultRow": {
				"type": "object",
				"properties": {
					"campaignId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 512
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string",
						"maxLength": 300
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"platformKind": {
						"type": "string",
						"enum": [
							"google_search",
							"google_pmax",
							"google_demand_gen",
							"meta_leads",
							"meta_website",
							"tiktok_smartplus_leadgen",
							"chatgpt_chat_card",
							"external"
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"platform": {
						"type": "object",
						"properties": {
							"spendMicros": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"impressions": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"clicks": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"conversions": {
								"type": "number",
								"minimum": 0
							},
							"platformLeads": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"spendMicros",
							"impressions",
							"clicks",
							"conversions",
							"platformLeads"
						],
						"additionalProperties": false
					},
					"crm": {
						"type": "object",
						"properties": {
							"leads": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"booked": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"won": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"wonValueCents": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"leads",
							"booked",
							"won",
							"wonValueCents"
						],
						"additionalProperties": false
					},
					"costPerLeadMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"campaignId",
					"externalId",
					"name",
					"provider",
					"platformKind",
					"locationId",
					"platform",
					"crm",
					"costPerLeadMicros"
				],
				"additionalProperties": false
			},
			"AdsCreativeAsset": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"publicId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"mime": {
						"type": "string"
					},
					"bytes": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"width": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"height": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"sha256": {
						"type": "string"
					},
					"source": {
						"type": "string",
						"enum": [
							"generated",
							"uploaded",
							"reference"
						]
					},
					"aiGenerated": {
						"type": "boolean"
					},
					"status": {
						"type": "string",
						"enum": [
							"uploading",
							"ready",
							"attached",
							"orphaned"
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"publicId",
					"mime",
					"bytes",
					"width",
					"height",
					"sha256",
					"source",
					"aiGenerated",
					"status",
					"createdById",
					"expiresAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AdsCreativeSession": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"templateKey": {
						"type": "string"
					},
					"inputs": {},
					"referenceAssetId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"generating",
							"ready",
							"failed"
						]
					},
					"queuedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"costMicros": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"requestedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"templateKey",
					"inputs",
					"referenceAssetId",
					"status",
					"queuedAt",
					"attemptCount",
					"costMicros",
					"requestedById",
					"lastError",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AdsCreativeVariant": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"sessionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"aspectRatio": {
						"type": "string",
						"enum": [
							"1:1",
							"4:5",
							"9:16"
						]
					},
					"assetId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"headline": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"primaryText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"description": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"policyPreflight": {},
					"selectedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"approvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"sessionId",
					"aspectRatio",
					"assetId",
					"headline",
					"primaryText",
					"description",
					"policyPreflight",
					"selectedAt",
					"approvedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadAdFormQuestion": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"minLength": 1,
						"maxLength": 256
					},
					"label": {
						"type": "string",
						"minLength": 1,
						"maxLength": 500
					},
					"type": {
						"type": "string",
						"minLength": 1,
						"maxLength": 100
					},
					"options": {
						"maxItems": 100,
						"type": "array",
						"items": {
							"type": "string",
							"minLength": 1,
							"maxLength": 500
						}
					}
				},
				"required": [
					"id",
					"label",
					"type",
					"options"
				],
				"additionalProperties": false
			},
			"LeadAdFormMapping": {
				"type": "object",
				"properties": {
					"contactFields": {
						"type": "object",
						"properties": {
							"fullName": {
								"anyOf": [
									{
										"type": "string",
										"minLength": 1,
										"maxLength": 256
									},
									{
										"type": "null"
									}
								]
							},
							"firstName": {
								"anyOf": [
									{
										"type": "string",
										"minLength": 1,
										"maxLength": 256
									},
									{
										"type": "null"
									}
								]
							},
							"lastName": {
								"anyOf": [
									{
										"type": "string",
										"minLength": 1,
										"maxLength": 256
									},
									{
										"type": "null"
									}
								]
							},
							"email": {
								"anyOf": [
									{
										"type": "string",
										"minLength": 1,
										"maxLength": 256
									},
									{
										"type": "null"
									}
								]
							},
							"phoneMobile": {
								"anyOf": [
									{
										"type": "string",
										"minLength": 1,
										"maxLength": 256
									},
									{
										"type": "null"
									}
								]
							},
							"message": {
								"anyOf": [
									{
										"type": "string",
										"minLength": 1,
										"maxLength": 256
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"fullName",
							"firstName",
							"lastName",
							"email",
							"phoneMobile",
							"message"
						],
						"additionalProperties": false
					},
					"fixedLocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"fixedLeadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"fixedOwnerId": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1,
								"maxLength": 255
							},
							{
								"type": "null"
							}
						]
					},
					"treatment": {
						"oneOf": [
							{
								"type": "object",
								"properties": {
									"mode": {
										"type": "string",
										"const": "enquiry"
									}
								},
								"required": [
									"mode"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"mode": {
										"type": "string",
										"const": "fixed"
									},
									"treatmentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									}
								},
								"required": [
									"mode",
									"treatmentId"
								],
								"additionalProperties": false
							},
							{
								"type": "object",
								"properties": {
									"mode": {
										"type": "string",
										"const": "answer_map"
									},
									"questionId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 256
									},
									"answerMap": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"answer": {
													"type": "string",
													"minLength": 1,
													"maxLength": 500
												},
												"treatmentId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												}
											},
											"required": [
												"answer",
												"treatmentId"
											],
											"additionalProperties": false
										}
									},
									"unmatched": {
										"type": "string",
										"enum": [
											"enquiry",
											"invalid"
										]
									}
								},
								"required": [
									"mode",
									"questionId",
									"answerMap",
									"unmatched"
								],
								"additionalProperties": false
							}
						]
					},
					"selectedAnswerIds": {
						"maxItems": 100,
						"type": "array",
						"items": {
							"type": "string",
							"minLength": 1,
							"maxLength": 256
						}
					},
					"consentEvidence": {
						"type": "object",
						"properties": {
							"email": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"questionId": {
												"type": "string",
												"minLength": 1,
												"maxLength": 256
											},
											"acceptedAnswers": {
												"minItems": 1,
												"maxItems": 20,
												"type": "array",
												"items": {
													"type": "string",
													"minLength": 1,
													"maxLength": 500
												}
											},
											"evidenceText": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2000
											}
										},
										"required": [
											"questionId",
											"acceptedAnswers",
											"evidenceText"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							},
							"sms": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"questionId": {
												"type": "string",
												"minLength": 1,
												"maxLength": 256
											},
											"acceptedAnswers": {
												"minItems": 1,
												"maxItems": 20,
												"type": "array",
												"items": {
													"type": "string",
													"minLength": 1,
													"maxLength": 500
												}
											},
											"evidenceText": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2000
											}
										},
										"required": [
											"questionId",
											"acceptedAnswers",
											"evidenceText"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							},
							"whatsapp": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"questionId": {
												"type": "string",
												"minLength": 1,
												"maxLength": 256
											},
											"acceptedAnswers": {
												"minItems": 1,
												"maxItems": 20,
												"type": "array",
												"items": {
													"type": "string",
													"minLength": 1,
													"maxLength": 500
												}
											},
											"evidenceText": {
												"type": "string",
												"minLength": 1,
												"maxLength": 2000
											}
										},
										"required": [
											"questionId",
											"acceptedAnswers",
											"evidenceText"
										],
										"additionalProperties": false
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"email",
							"sms",
							"whatsapp"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"contactFields",
					"fixedLocationId",
					"fixedLeadSourceId",
					"fixedOwnerId",
					"treatment",
					"selectedAnswerIds",
					"consentEvidence"
				],
				"additionalProperties": false
			},
			"LeadAdConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"connecting",
							"active",
							"action_required",
							"error",
							"disconnecting",
							"disconnected"
						]
					},
					"grantSubject": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"credentialType": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"scopes": {
						"maxItems": 8193,
						"type": "array",
						"items": {
							"type": "string",
							"maxLength": 8192
						}
					},
					"credentialVersion": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"credentialExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"dataAccessExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"webhookCredentialConfigured": {
						"type": "boolean"
					},
					"webhookCredentialVersion": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"managementCapability": {
						"type": "boolean"
					},
					"adsManagementEnabledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"disconnectRequestedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastWebhookAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastHealthCheckedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"provider",
					"status",
					"grantSubject",
					"credentialType",
					"scopes",
					"credentialVersion",
					"credentialExpiresAt",
					"dataAccessExpiresAt",
					"webhookCredentialConfigured",
					"webhookCredentialVersion",
					"managementCapability",
					"adsManagementEnabledAt",
					"disconnectRequestedAt",
					"lastWebhookAt",
					"lastHealthCheckedAt",
					"lastSyncedAt",
					"lastError",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadAdAccount": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"externalAccountId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 1024
					},
					"displayName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"accountType": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"dataRegion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"active": {
						"type": "boolean"
					},
					"defaultLocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultTreatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultLeadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultOwnerId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"partial": {
						"type": "boolean"
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"connectionId",
					"provider",
					"externalAccountId",
					"displayName",
					"accountType",
					"dataRegion",
					"active",
					"defaultLocationId",
					"defaultTreatmentId",
					"defaultLeadSourceId",
					"defaultOwnerId",
					"partial",
					"lastSyncedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadAdAsset": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"externalAssetId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 1024
					},
					"assetType": {
						"type": "string"
					},
					"displayName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"active": {
						"type": "boolean"
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"accountId",
					"provider",
					"externalAssetId",
					"assetType",
					"displayName",
					"active",
					"lastSyncedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadAdForm": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"assetId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"externalFormId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 1024
					},
					"name": {
						"type": "string"
					},
					"externalStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"enabled": {
						"type": "boolean"
					},
					"questions": {
						"maxItems": 200,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadAdFormQuestion"
						}
					},
					"mapping": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/LeadAdFormMapping"
							},
							{
								"type": "null"
							}
						]
					},
					"mappingVersion": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"mappingValidatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastTestAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastTestStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastSyncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"accountId",
					"assetId",
					"provider",
					"externalFormId",
					"name",
					"externalStatus",
					"enabled",
					"questions",
					"mapping",
					"mappingVersion",
					"mappingValidatedAt",
					"lastTestAt",
					"lastTestStatus",
					"lastSyncedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadAdSubmission": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"assetId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"formId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalSubmissionId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 1024
					},
					"externalAssetId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalFormId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 1024
					},
					"externalCampaignId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalAdGroupId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalAdId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"answers": {
						"maxItems": 100,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"questionId": {
									"type": "string",
									"minLength": 1,
									"maxLength": 256
								},
								"label": {
									"anyOf": [
										{
											"type": "string",
											"maxLength": 500
										},
										{
											"type": "null"
										}
									]
								},
								"values": {
									"maxItems": 20,
									"type": "array",
									"items": {
										"type": "string",
										"maxLength": 2000
									}
								}
							},
							"required": [
								"questionId",
								"label",
								"values"
							],
							"additionalProperties": false
						}
					},
					"providerCreatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"receivedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"historical": {
						"type": "boolean"
					},
					"test": {
						"type": "boolean"
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"processing",
							"captured",
							"needs_mapping",
							"needs_identity",
							"invalid",
							"retrying",
							"failed",
							"ignored",
							"test"
						]
					},
					"resolution": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"create",
									"attach",
									"ignore"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"nextAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"queuePublishParkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastErrorCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"leadTouchId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"taskId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"processedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"provider",
					"connectionId",
					"accountId",
					"assetId",
					"formId",
					"externalSubmissionId",
					"externalAssetId",
					"externalFormId",
					"externalCampaignId",
					"externalAdGroupId",
					"externalAdId",
					"answers",
					"providerCreatedAt",
					"receivedAt",
					"historical",
					"test",
					"status",
					"resolution",
					"resolvedPatientId",
					"resolvedById",
					"resolvedAt",
					"attemptCount",
					"nextAttemptAt",
					"queuePublishParkedAt",
					"lastErrorCode",
					"lastError",
					"patientId",
					"journeyId",
					"leadTouchId",
					"taskId",
					"processedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadAdBackfill": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"accountId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"formId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"running",
							"completed",
							"failed",
							"cancelled"
						]
					},
					"fromAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"toAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"counts": {
						"type": "object",
						"properties": {
							"discovered": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"staged": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"needsAttention": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"ignored": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"discovered",
							"staged",
							"needsAttention",
							"ignored"
						],
						"additionalProperties": false
					},
					"attemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"nextAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"startedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"connectionId",
					"provider",
					"accountId",
					"formId",
					"status",
					"fromAt",
					"toAt",
					"counts",
					"attemptCount",
					"nextAttemptAt",
					"lastError",
					"createdByName",
					"startedAt",
					"completedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LeadAdsOverview": {
				"type": "object",
				"properties": {
					"entitlement": {
						"type": "object",
						"properties": {
							"enabled": {
								"type": "boolean"
							},
							"readOnly": {
								"type": "boolean"
							}
						},
						"required": [
							"enabled",
							"readOnly"
						],
						"additionalProperties": false
					},
					"permissions": {
						"type": "object",
						"properties": {
							"read": {
								"type": "boolean"
							},
							"manage": {
								"type": "boolean"
							}
						},
						"required": [
							"read",
							"manage"
						],
						"additionalProperties": false
					},
					"connections": {
						"maxItems": 4,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadAdConnection"
						}
					},
					"accounts": {
						"maxItems": 200,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadAdAccount"
						}
					},
					"assets": {
						"maxItems": 500,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadAdAsset"
						}
					},
					"forms": {
						"maxItems": 500,
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadAdForm"
						}
					},
					"defaults": {
						"type": "object",
						"properties": {
							"locations": {
								"maxItems": 500,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string"
										},
										"name": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"name"
									],
									"additionalProperties": false
								}
							},
							"treatments": {
								"maxItems": 1000,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string"
										},
										"name": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"name"
									],
									"additionalProperties": false
								}
							},
							"leadSources": {
								"maxItems": 1000,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string"
										},
										"name": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"name"
									],
									"additionalProperties": false
								}
							},
							"owners": {
								"maxItems": 500,
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string"
										},
										"name": {
											"type": "string"
										}
									},
									"required": [
										"id",
										"name"
									],
									"additionalProperties": false
								}
							}
						},
						"required": [
							"locations",
							"treatments",
							"leadSources",
							"owners"
						],
						"additionalProperties": false
					},
					"resourceTruncation": {
						"type": "object",
						"properties": {
							"accounts": {
								"type": "boolean"
							},
							"assets": {
								"type": "boolean"
							},
							"forms": {
								"type": "boolean"
							},
							"locations": {
								"type": "boolean"
							},
							"treatments": {
								"type": "boolean"
							},
							"leadSources": {
								"type": "boolean"
							},
							"owners": {
								"type": "boolean"
							}
						},
						"required": [
							"accounts",
							"assets",
							"forms",
							"locations",
							"treatments",
							"leadSources",
							"owners"
						],
						"additionalProperties": false
					},
					"attentionCounts": {
						"type": "object",
						"properties": {
							"needsMapping": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"needsIdentity": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"invalid": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"failed": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"queueParked": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"needsMapping",
							"needsIdentity",
							"invalid",
							"failed",
							"queueParked"
						],
						"additionalProperties": false
					},
					"conversions": {
						"type": "object",
						"properties": {
							"meta": {
								"$ref": "#/components/schemas/ConversionFeedback"
							},
							"google_ads": {
								"$ref": "#/components/schemas/ConversionFeedback"
							},
							"tiktok": {
								"$ref": "#/components/schemas/ConversionFeedback"
							},
							"chatgpt": {
								"$ref": "#/components/schemas/ConversionFeedback"
							}
						},
						"required": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						],
						"additionalProperties": false
					},
					"openAlerts": {
						"type": "object",
						"properties": {
							"entitlement": {
								"$ref": "#/components/schemas/AdsEntitlement"
							},
							"permissions": {
								"$ref": "#/components/schemas/AdsPermissions"
							},
							"data": {
								"type": "object",
								"properties": {
									"items": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/AdsAlert"
										}
									},
									"nextCursor": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 1024
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"items",
									"nextCursor"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"entitlement",
							"permissions",
							"data"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"entitlement",
					"permissions",
					"connections",
					"accounts",
					"assets",
					"forms",
					"defaults",
					"resourceTruncation",
					"attentionCounts",
					"conversions"
				],
				"additionalProperties": false
			},
			"ConversionFeedbackChecklist": {
				"type": "object",
				"properties": {
					"connected": {
						"type": "boolean"
					},
					"scopesOk": {
						"type": "boolean"
					},
					"tiktokScopes": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"website": {
										"type": "boolean"
									},
									"crm": {
										"type": "boolean"
									}
								},
								"required": [
									"website",
									"crm"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"reauthRequired": {
						"type": "boolean"
					},
					"provisioned": {
						"type": "string",
						"enum": [
							"unprovisioned",
							"provisioning",
							"testing",
							"ready",
							"failed"
						]
					},
					"resources": {
						"type": "object",
						"properties": {
							"googleConversionCustomerId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"googleLeadActionResource": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"googleBookedActionResource": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"googleWonActionResource": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"metaDatasetId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"tiktokPixelCode": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"tiktokCrmEventSetId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"openaiAccountId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"openaiConversionSourceId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"openaiPixelId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"openaiLeadEventSettingId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"openaiBookedEventSettingId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"openaiWonEventSettingId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"googleConversionCustomerId",
							"googleLeadActionResource",
							"googleBookedActionResource",
							"googleWonActionResource",
							"metaDatasetId",
							"tiktokPixelCode",
							"tiktokCrmEventSetId",
							"openaiAccountId",
							"openaiConversionSourceId",
							"openaiPixelId",
							"openaiLeadEventSettingId",
							"openaiBookedEventSettingId",
							"openaiWonEventSettingId"
						],
						"additionalProperties": false
					},
					"provisionSteps": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"pixel": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"planned",
													"submitted",
													"confirmed"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"lead": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"planned",
													"submitted",
													"confirmed"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"booked": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"planned",
													"submitted",
													"confirmed"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"won": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"planned",
													"submitted",
													"confirmed"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"capiKey": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"planned",
													"submitted",
													"confirmed"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"pixel",
									"lead",
									"booked",
									"won",
									"capiKey"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					},
					"verification": {
						"type": "string",
						"enum": [
							"pending",
							"confirmed",
							"awaiting_first_event"
						]
					},
					"firstLiveEventAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"health": {
						"type": "object",
						"properties": {
							"state": {
								"type": "string",
								"enum": [
									"ok",
									"warning",
									"restricted"
								]
							},
							"detail": {
								"anyOf": [
									{
										"type": "string",
										"maxLength": 512
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"state",
							"detail"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"connected",
					"scopesOk",
					"tiktokScopes",
					"reauthRequired",
					"provisioned",
					"resources",
					"provisionSteps",
					"verification",
					"firstLiveEventAt",
					"health"
				],
				"additionalProperties": false
			},
			"ConversionFeedback": {
				"type": "object",
				"properties": {
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"enabled": {
						"type": "boolean"
					},
					"sendValues": {
						"type": "boolean"
					},
					"testEventCode": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 64
							},
							{
								"type": "null"
							}
						]
					},
					"enabledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"checklist": {
						"$ref": "#/components/schemas/ConversionFeedbackChecklist"
					},
					"counts": {
						"type": "object",
						"properties": {
							"accepted": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"skipped": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"parked": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"accepted",
							"skipped",
							"parked"
						],
						"additionalProperties": false
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 2000
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"provider",
					"enabled",
					"sendValues",
					"testEventCode",
					"enabledAt",
					"checklist",
					"counts",
					"lastError"
				],
				"additionalProperties": false
			},
			"TikTokCrmEventSets": {
				"type": "object",
				"properties": {
					"advertiserAccountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"advertiserId": {
						"type": "string",
						"pattern": "^[0-9]{1,64}$"
					},
					"advertisers": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"accountId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"advertiserId": {
									"type": "string",
									"pattern": "^[0-9]{1,64}$"
								},
								"displayName": {
									"anyOf": [
										{
											"type": "string",
											"maxLength": 1024
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"accountId",
								"advertiserId",
								"displayName"
							],
							"additionalProperties": false
						}
					},
					"selectedEventSetId": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1,
								"maxLength": 128
							},
							{
								"type": "null"
							}
						]
					},
					"eventSets": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"minLength": 1,
									"maxLength": 128
								},
								"name": {
									"type": "string",
									"minLength": 1,
									"maxLength": 40
								},
								"createdAt": {
									"anyOf": [
										{
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"id",
								"name",
								"createdAt"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"advertiserAccountId",
					"advertiserId",
					"advertisers",
					"selectedEventSetId",
					"eventSets"
				],
				"additionalProperties": false
			},
			"MetaCrmDatasets": {
				"type": "object",
				"properties": {
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"adAccountId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 512
					},
					"selectedDatasetId": {
						"anyOf": [
							{
								"type": "string",
								"minLength": 1,
								"maxLength": 512
							},
							{
								"type": "null"
							}
						]
					},
					"accounts": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"externalAccountId": {
									"type": "string",
									"minLength": 1,
									"maxLength": 512
								},
								"displayName": {
									"anyOf": [
										{
											"type": "string",
											"maxLength": 512
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"id",
								"externalAccountId",
								"displayName"
							],
							"additionalProperties": false
						}
					},
					"datasets": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"minLength": 1,
									"maxLength": 512
								},
								"name": {
									"type": "string",
									"minLength": 1,
									"maxLength": 512
								},
								"ownerBusinessId": {
									"type": "string",
									"minLength": 1,
									"maxLength": 512
								}
							},
							"required": [
								"id",
								"name",
								"ownerBusinessId"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"accountId",
					"adAccountId",
					"selectedDatasetId",
					"accounts",
					"datasets"
				],
				"additionalProperties": false
			},
			"TodayDayCount": {
				"type": "object",
				"properties": {
					"date": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"count": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"date",
					"count"
				],
				"additionalProperties": false
			},
			"TreatmentSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"slug": {
						"type": "string"
					},
					"name": {
						"type": "string"
					},
					"patientFacingName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"category": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultPriceCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"depositAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"defaultDurationMin": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"consultationPractitionerIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"defaultPipelineId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"color": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"slug",
					"name",
					"patientFacingName",
					"category",
					"defaultPriceCents",
					"depositAmountCents",
					"currency",
					"defaultDurationMin",
					"consultationPractitionerIds",
					"defaultPipelineId",
					"color",
					"position",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"TodaySelectedLead": {
				"type": "object",
				"properties": {
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"bundle": {
						"$ref": "#/components/schemas/PatientDetail"
					},
					"conversation": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ConversationListItem"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"patientId",
					"bundle",
					"conversation"
				],
				"additionalProperties": false
			},
			"JourneyWithEnrollment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"treatmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"pipelineId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"stageId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"stageCategory": {
						"type": "string",
						"enum": [
							"open",
							"won"
						]
					},
					"lastOpenStageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"won",
							"lost"
						]
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"lostReasonId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lostNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"junkMarkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"ownerId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"potentialValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"confirmedValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"snoozedUntil": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstContactAttemptedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstContactMadeAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"aiHandledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"aiHandledSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"rule",
									"user"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"aiReleasedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"enteredStageAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"closedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"firstTouchId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastTouchId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"paid_search",
									"paid_social",
									"organic_search",
									"social",
									"referral_website",
									"referral_friend",
									"referral_practice",
									"existing_patient",
									"email",
									"chat",
									"direct",
									"phone",
									"walk_in",
									"print",
									"other",
									"unknown",
									"ai",
									"paid_ai"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"customFields": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"activeEnrollment": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ActiveEnrollmentSummary"
							},
							{
								"type": "null"
							}
						]
					},
					"contactAttempts": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"patientId",
					"treatmentId",
					"pipelineId",
					"stageId",
					"stageCategory",
					"lastOpenStageId",
					"status",
					"version",
					"lostReasonId",
					"lostNote",
					"junkMarkedAt",
					"ownerId",
					"practitionerId",
					"potentialValueCents",
					"confirmedValueCents",
					"currency",
					"snoozedUntil",
					"firstContactAttemptedAt",
					"firstContactMadeAt",
					"aiHandledAt",
					"aiHandledSource",
					"aiReleasedAt",
					"enteredStageAt",
					"position",
					"closedAt",
					"firstTouchId",
					"lastTouchId",
					"channel",
					"customFields",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"activeEnrollment",
					"contactAttempts"
				],
				"additionalProperties": false
			},
			"LeadTouchSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"capturedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"intakeMethod": {
						"type": "string",
						"enum": [
							"form",
							"website_form",
							"webhook",
							"zapier",
							"lead_ad",
							"whatsapp",
							"sms",
							"call",
							"chat",
							"manual",
							"import",
							"booking",
							"referral"
						]
					},
					"channel": {
						"type": "string",
						"enum": [
							"paid_search",
							"paid_social",
							"organic_search",
							"social",
							"referral_website",
							"referral_friend",
							"referral_practice",
							"existing_patient",
							"email",
							"chat",
							"direct",
							"phone",
							"walk_in",
							"print",
							"other",
							"unknown",
							"ai",
							"paid_ai"
						]
					},
					"sourceName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"referrerDomain": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"landingUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmSource": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmMedium": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmCampaign": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmTerm": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmContent": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmSourcePlatform": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmCreativeFormat": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmMarketingTactic": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmAdName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"clickIds": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"type": "string"
						}
					},
					"adCampaignId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adGroupId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adPlacement": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adNetwork": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adKeyword": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adMatchType": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adDevice": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"gaClientId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"gaSessionId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"captureHookId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"captureHookName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"affiliate": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"submission": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"label": {
									"type": "string"
								},
								"value": {
									"type": "string"
								}
							},
							"required": [
								"label",
								"value"
							],
							"additionalProperties": false
						}
					},
					"submissionTruncated": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"journeyId",
					"capturedAt",
					"intakeMethod",
					"channel",
					"sourceName",
					"referrerDomain",
					"landingUrl",
					"utmSource",
					"utmMedium",
					"utmCampaign",
					"utmTerm",
					"utmContent",
					"utmId",
					"utmSourcePlatform",
					"utmCreativeFormat",
					"utmMarketingTactic",
					"utmAdName",
					"clickIds",
					"adCampaignId",
					"adGroupId",
					"adId",
					"adPlacement",
					"adNetwork",
					"adKeyword",
					"adMatchType",
					"adDevice",
					"gaClientId",
					"gaSessionId",
					"captureHookId",
					"captureHookName",
					"affiliate",
					"submission",
					"submissionTruncated"
				],
				"additionalProperties": false
			},
			"PmsTreatmentPlanSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"externalReference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"presented",
							"accepted",
							"in_progress",
							"completed",
							"declined",
							"cancelled"
						]
					},
					"importedStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalTotalCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"externalReference",
					"name",
					"status",
					"importedStatus",
					"externalTotalCents",
					"currency",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ReferralRewardFulfillmentEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"eventType": {
						"type": "string",
						"enum": [
							"issued",
							"adjustment_required",
							"adjusted"
						]
					},
					"adjustmentType": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"amount_delta",
									"fulfillment_correction"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"amountDeltaCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"description": {
						"type": "string"
					},
					"fulfillmentRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"reason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"correctionOfEventId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"actor": {
						"type": "object",
						"properties": {
							"userId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"name": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"userId",
							"name"
						],
						"additionalProperties": false
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"eventType",
					"adjustmentType",
					"amountDeltaCents",
					"currency",
					"description",
					"fulfillmentRef",
					"reason",
					"correctionOfEventId",
					"actor",
					"createdAt"
				],
				"additionalProperties": false
			},
			"DayListInterval": {
				"type": "object",
				"properties": {
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"practitionerId",
					"startsAt",
					"endsAt"
				],
				"additionalProperties": false
			},
			"DayListClosure": {
				"type": "object",
				"properties": {
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"startsOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"endsOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					}
				},
				"required": [
					"locationId",
					"startsOn",
					"endsOn"
				],
				"additionalProperties": false
			},
			"PushDevice": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"platform": {
						"type": "string",
						"enum": [
							"web",
							"ios",
							"android"
						]
					},
					"label": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"disabled"
						]
					},
					"disabledReason": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"not_registered",
									"unreachable",
									"stale",
									"superseded_by_other_user",
									"revoked"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"endpointHash": {
						"type": "string",
						"minLength": 64,
						"maxLength": 64
					},
					"lastRegisteredAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastSuccessAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"platform",
					"label",
					"status",
					"disabledReason",
					"endpointHash",
					"lastRegisteredAt",
					"lastSuccessAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"OrganizationLifecycle": {
				"type": "object",
				"properties": {
					"state": {
						"type": "string",
						"enum": [
							"active",
							"closing",
							"purging",
							"custodian"
						]
					},
					"generation": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"reason": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"owner_requested",
									"provider_terminal"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"openedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deadlineAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"recoveredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"purgingAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"custodyEnteredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"purgeBlockedByLegalHold": {
						"type": "boolean"
					},
					"purgeBillingStatus": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"pending",
									"stopped",
									"manual_review"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"recoveryAction": {
						"type": "string",
						"enum": [
							"none",
							"restore",
							"checkout",
							"resume_subscription"
						]
					}
				},
				"required": [
					"state",
					"generation",
					"reason",
					"openedAt",
					"deadlineAt",
					"recoveredAt",
					"purgingAt",
					"custodyEnteredAt",
					"purgeBlockedByLegalHold",
					"purgeBillingStatus",
					"recoveryAction"
				],
				"additionalProperties": false
			},
			"CaptureDeliverySummary": {
				"type": "object",
				"properties": {
					"kind": {
						"type": "string",
						"enum": [
							"accepted",
							"rejected"
						]
					},
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"receivedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"outcomeCode": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"invalid_json",
									"not_an_object",
									"invalid_multipart",
									"body_not_utf8",
									"signature_invalid",
									"signing_unavailable",
									"query_string_forbidden",
									"content_type_forbidden",
									"event_id_mismatch",
									"payload_bounds",
									"contact_required",
									"idempotency_key_reused",
									"delivery_in_progress",
									"honeypot",
									"turnstile_failed",
									"unpinned_domain"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"errorMessage": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"occurrenceCount": {
						"anyOf": [
							{
								"type": "integer",
								"exclusiveMinimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"lastSeenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"kind",
					"id",
					"receivedAt",
					"outcomeCode",
					"errorMessage",
					"occurrenceCount",
					"lastSeenAt",
					"patientId",
					"journeyId",
					"patientName"
				],
				"additionalProperties": false
			},
			"CaptureDeliveryAttribution": {
				"type": "object",
				"properties": {
					"channel": {
						"type": "string",
						"enum": [
							"paid_search",
							"paid_social",
							"organic_search",
							"social",
							"referral_website",
							"referral_friend",
							"referral_practice",
							"existing_patient",
							"email",
							"chat",
							"direct",
							"phone",
							"walk_in",
							"print",
							"other",
							"unknown",
							"ai",
							"paid_ai"
						]
					},
					"sourceName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"leadSourceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"landingUrl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"referrerDomain": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmSource": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmMedium": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmCampaign": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmTerm": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmContent": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"utmId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"clickIds": {
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"type": "string"
						}
					}
				},
				"required": [
					"channel",
					"sourceName",
					"leadSourceId",
					"landingUrl",
					"referrerDomain",
					"utmSource",
					"utmMedium",
					"utmCampaign",
					"utmTerm",
					"utmContent",
					"utmId",
					"clickIds"
				],
				"additionalProperties": false
			},
			"TrackingPool": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"country": {
						"type": "string"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"forwardMode": {
						"type": "string",
						"enum": [
							"location_phone",
							"custom",
							"voice_number"
						]
					},
					"forwardE164": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"defaultTreatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"swapTargets": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"swapAllNumbers": {
						"type": "boolean"
					},
					"ivrMode": {
						"type": "string",
						"enum": [
							"none",
							"menu"
						]
					},
					"ivrPromptText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"ivrLeadDigits": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"ivrTimeoutOutcome": {
						"type": "string",
						"enum": [
							"lead",
							"log_only"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"archived"
						]
					},
					"numberCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"liveAssignmentCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"unservedToday": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"unservedWeek": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"ringTimeoutSec": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"name",
					"country",
					"locationId",
					"forwardMode",
					"forwardE164",
					"defaultTreatmentId",
					"swapTargets",
					"swapAllNumbers",
					"ivrMode",
					"ivrPromptText",
					"ivrLeadDigits",
					"ivrTimeoutOutcome",
					"status",
					"numberCount",
					"liveAssignmentCount",
					"unservedToday",
					"unservedWeek",
					"ringTimeoutSec",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"DialerKycReview": {
				"type": "object",
				"properties": {
					"groupId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"unsubmitted",
									"pending",
									"approved",
									"declined",
									"expired"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"submittedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"syncedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"fields": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"requirementId": {
									"type": "string"
								},
								"label": {
									"type": "string"
								},
								"fieldType": {
									"type": "string",
									"enum": [
										"textual",
										"address",
										"document"
									]
								},
								"displayValue": {
									"type": "string"
								},
								"status": {
									"anyOf": [
										{
											"type": "string",
											"enum": [
												"unsubmitted",
												"pending",
												"approved",
												"declined",
												"expired"
											]
										},
										{
											"type": "null"
										}
									]
								},
								"expiresAt": {
									"anyOf": [
										{
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"requirementId",
								"label",
								"fieldType",
								"displayValue",
								"status",
								"expiresAt"
							],
							"additionalProperties": false
						}
					},
					"comments": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string"
								},
								"body": {
									"type": "string"
								},
								"fromProvider": {
									"type": "boolean"
								},
								"createdAt": {
									"anyOf": [
										{
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										{
											"type": "null"
										}
									]
								}
							},
							"required": [
								"id",
								"body",
								"fromProvider",
								"createdAt"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"groupId",
					"status",
					"submittedAt",
					"syncedAt",
					"fields",
					"comments"
				],
				"additionalProperties": false
			},
			"Ga4SettingsInput": {
				"type": "object",
				"properties": {
					"measurementId": {
						"type": "string",
						"pattern": "^G-[A-Z0-9]{4,20}$"
					},
					"apiSecret": {
						"type": "string",
						"minLength": 1,
						"maxLength": 256
					}
				},
				"required": [
					"measurementId"
				]
			},
			"AiVoiceAgent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"enabled": {
						"type": "boolean"
					},
					"maxConcurrentCalls": {
						"type": "integer",
						"minimum": 1,
						"maximum": 30
					},
					"dailyMinutesBudget": {
						"type": "integer",
						"minimum": 1,
						"maximum": 9007199254740991
					},
					"textBackEnabled": {
						"type": "boolean"
					},
					"voicemailDropEnabled": {
						"type": "boolean"
					},
					"voicemailDropMessage": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"config": {
						"$ref": "#/components/schemas/AiVoiceAgentConfig"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"enabled",
					"maxConcurrentCalls",
					"dailyMinutesBudget",
					"textBackEnabled",
					"voicemailDropEnabled",
					"voicemailDropMessage",
					"config",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AiVoiceAgentConfig": {
				"type": "object",
				"properties": {
					"identity": {
						"type": "object",
						"properties": {
							"displayName": {
								"type": "string",
								"minLength": 1,
								"maxLength": 80
							},
							"voiceId": {
								"type": "string",
								"minLength": 1,
								"maxLength": 120
							},
							"language": {
								"type": "string",
								"enum": [
									"en",
									"it",
									"es"
								]
							}
						},
						"required": [
							"displayName",
							"voiceId",
							"language"
						],
						"additionalProperties": false
					},
					"greeting": {
						"type": "object",
						"properties": {
							"inbound": {
								"type": "string",
								"minLength": 1,
								"maxLength": 500
							},
							"inboundClosed": {
								"anyOf": [
									{
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									{
										"type": "null"
									}
								]
							},
							"outbound": {
								"type": "string",
								"minLength": 1,
								"maxLength": 500
							}
						},
						"required": [
							"inbound",
							"inboundClosed",
							"outbound"
						],
						"additionalProperties": false
					},
					"persona": {
						"type": "object",
						"properties": {
							"instructions": {
								"type": "string",
								"maxLength": 4000
							},
							"inboundNotes": {
								"anyOf": [
									{
										"type": "string",
										"maxLength": 2000
									},
									{
										"type": "null"
									}
								]
							},
							"outboundNotes": {
								"anyOf": [
									{
										"type": "string",
										"maxLength": 2000
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"instructions",
							"inboundNotes",
							"outboundNotes"
						],
						"additionalProperties": false
					},
					"tools": {
						"type": "object",
						"properties": {
							"booking": {
								"type": "boolean"
							},
							"leadCapture": {
								"type": "boolean"
							},
							"defaultTreatmentId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"transfer": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"ringGroupId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"enabled",
									"ringGroupId"
								],
								"additionalProperties": false
							}
						},
						"required": [
							"booking",
							"leadCapture",
							"defaultTreatmentId",
							"transfer"
						],
						"additionalProperties": false
					},
					"knowledge": {
						"type": "object",
						"properties": {
							"enabled": {
								"type": "boolean"
							}
						},
						"required": [
							"enabled"
						],
						"additionalProperties": false
					},
					"guardrails": {
						"type": "object",
						"properties": {
							"maxCallMinutes": {
								"type": "integer",
								"minimum": 1,
								"maximum": 240
							}
						},
						"required": [
							"maxCallMinutes"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"identity",
					"greeting",
					"persona",
					"tools",
					"knowledge",
					"guardrails"
				],
				"additionalProperties": false
			},
			"AiCallRule": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"enabled": {
						"type": "boolean"
					},
					"trigger": {
						"type": "string",
						"enum": [
							"journey_created",
							"stage_entered",
							"call_missed"
						]
					},
					"stageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"conditions": {
						"$ref": "#/components/schemas/AiCallRuleConditions"
					},
					"scope": {
						"type": "string",
						"enum": [
							"always",
							"practice_closed"
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"aiCallbackEnabled": {
						"type": "boolean"
					},
					"textBackBody": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"name",
					"enabled",
					"trigger",
					"stageId",
					"conditions",
					"scope",
					"locationId",
					"position",
					"aiCallbackEnabled",
					"textBackBody",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AiCallRuleConditions": {
				"type": "object",
				"properties": {
					"treatmentId": {
						"type": "object",
						"properties": {
							"in": {
								"minItems": 1,
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								}
							},
							"present": {
								"type": "boolean"
							}
						},
						"additionalProperties": false
					},
					"leadSourceId": {
						"type": "object",
						"properties": {
							"in": {
								"minItems": 1,
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								}
							},
							"present": {
								"type": "boolean"
							}
						},
						"additionalProperties": false
					},
					"locationId": {
						"type": "object",
						"properties": {
							"in": {
								"minItems": 1,
								"maxItems": 100,
								"type": "array",
								"items": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								}
							},
							"present": {
								"type": "boolean"
							}
						},
						"additionalProperties": false
					},
					"channel": {
						"type": "object",
						"properties": {
							"in": {
								"minItems": 1,
								"type": "array",
								"items": {
									"type": "string",
									"enum": [
										"paid_search",
										"paid_social",
										"organic_search",
										"social",
										"referral_website",
										"referral_friend",
										"referral_practice",
										"existing_patient",
										"email",
										"chat",
										"direct",
										"phone",
										"walk_in",
										"print",
										"other",
										"unknown",
										"ai",
										"paid_ai"
									]
								}
							}
						},
						"required": [
							"in"
						],
						"additionalProperties": false
					},
					"createdOutsideOpeningHours": {
						"type": "object",
						"properties": {
							"eq": {
								"type": "boolean"
							}
						},
						"required": [
							"eq"
						],
						"additionalProperties": false
					}
				},
				"additionalProperties": false
			},
			"AiCallQueueRow": {
				"type": "object",
				"properties": {
					"journeyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientName": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"calling",
							"completed",
							"exhausted",
							"released",
							"parked"
						]
					},
					"lifetimeAttemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"failedAttemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"attemptsToday": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"nextAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastOutcome": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"matchedRuleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"waitingReason": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"addon_off",
									"agent_paused",
									"outside_calling_window",
									"practice_open_scope",
									"snoozed",
									"daily_attempts_exhausted",
									"human_lock_active",
									"no_line_capacity",
									"concurrency_cap",
									"daily_minutes_exhausted",
									"outside_called_party_hours",
									"screening_pending",
									"voice_no_caller_id",
									"agent_unavailable",
									"dispatch_failed",
									"patient_deceased",
									"patient_merged",
									"patient_missing",
									"window_never_opens",
									"patient_archived",
									"phone_missing",
									"phone_invalid",
									"phone_not_domestic",
									"hours_unresolvable",
									"consent_missing",
									"screening_parked",
									"publication_attempts_exhausted",
									"publication_lost",
									"attempt_row_missing"
								]
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"journeyId",
					"patientId",
					"patientName",
					"status",
					"lifetimeAttemptCount",
					"failedAttemptCount",
					"attemptsToday",
					"nextAttemptAt",
					"lastAttemptAt",
					"lastOutcome",
					"matchedRuleId",
					"waitingReason"
				],
				"additionalProperties": false
			},
			"PmsAdoption": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"external_to_native",
							"native_to_external"
						]
					},
					"capabilityProfileVersion": {
						"type": "string"
					},
					"fromSystem": {
						"type": "string",
						"enum": [
							"native",
							"external"
						]
					},
					"toSystem": {
						"type": "string",
						"enum": [
							"native",
							"external"
						]
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"generation": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"started",
							"frozen",
							"drained",
							"reconciled",
							"completed",
							"aborted"
						]
					},
					"startedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"frozenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"drainedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reconciledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"abortedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"actorUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"approvedByUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"ownerReauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"report": {
						"anyOf": [
							{},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"kind",
					"capabilityProfileVersion",
					"fromSystem",
					"toSystem",
					"connectionId",
					"generation",
					"status",
					"startedAt",
					"frozenAt",
					"drainedAt",
					"reconciledAt",
					"completedAt",
					"abortedAt",
					"actorUserId",
					"approvedByUserId",
					"ownerReauthenticatedAt",
					"report"
				],
				"additionalProperties": false
			},
			"SystemOfRecord": {
				"type": "object",
				"properties": {
					"systemOfRecord": {
						"type": "string",
						"enum": [
							"native",
							"external"
						]
					},
					"connectionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"authorityGeneration": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"openAdoption": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/PmsAdoption"
							},
							{
								"type": "null"
							}
						]
					},
					"capabilityProfileVersion": {
						"type": "string",
						"enum": [
							"uk_private_v1",
							"us_private_v1"
						]
					}
				},
				"required": [
					"systemOfRecord",
					"connectionId",
					"authorityGeneration",
					"openAdoption",
					"capabilityProfileVersion"
				],
				"additionalProperties": false
			},
			"PmsWebhookReceipt": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"bodyDigest": {
						"type": "string"
					},
					"state": {
						"type": "string",
						"enum": [
							"pending",
							"completed",
							"parked",
							"rejected"
						]
					},
					"ingressAttemptCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"ingressTerminalReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"stagedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"queuedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"connectionId",
					"bodyDigest",
					"state",
					"ingressAttemptCount",
					"ingressTerminalReason",
					"stagedAt",
					"queuedAt",
					"parkedAt",
					"lastError",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ReferralStatusCorrectionEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"originalStatus": {
						"type": "string",
						"enum": [
							"submitted",
							"qualified",
							"disqualified",
							"expired"
						]
					},
					"correctedStatus": {
						"type": "string",
						"enum": [
							"submitted",
							"qualified",
							"disqualified",
							"expired"
						]
					},
					"reason": {
						"type": "string"
					},
					"actor": {
						"type": "object",
						"properties": {
							"userId": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"name": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"userId",
							"name"
						],
						"additionalProperties": false
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"originalStatus",
					"correctedStatus",
					"reason",
					"actor",
					"createdAt"
				],
				"additionalProperties": false
			},
			"CallLegQuality": {
				"type": "object",
				"properties": {
					"mos": {
						"type": "number",
						"minimum": 1,
						"maximum": 5
					},
					"jitterMs": {
						"type": "number",
						"minimum": 0,
						"maximum": 10000
					},
					"packetLossPct": {
						"type": "number",
						"minimum": 0,
						"maximum": 100
					},
					"rttMs": {
						"type": "number",
						"minimum": 0,
						"maximum": 60000
					}
				},
				"required": [
					"mos",
					"jitterMs",
					"packetLossPct",
					"rttMs"
				],
				"additionalProperties": false
			},
			"VoiceColleague": {
				"type": "object",
				"properties": {
					"userId": {
						"type": "string",
						"minLength": 1
					},
					"name": {
						"type": "string"
					},
					"available": {
						"type": "boolean"
					}
				},
				"required": [
					"userId",
					"name",
					"available"
				],
				"additionalProperties": false
			},
			"VoiceCallerId": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"e164": {
						"type": "string"
					},
					"label": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"locationName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"isDefault": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"e164",
					"label",
					"locationName",
					"isDefault"
				],
				"additionalProperties": false
			},
			"VoicemailNumber": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"e164": {
						"type": "string"
					},
					"label": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"e164",
					"label",
					"locationId"
				],
				"additionalProperties": false
			},
			"VoiceClosure": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"startsOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"endsOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"spokenText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"locationId",
					"startsOn",
					"endsOn",
					"spokenText"
				],
				"additionalProperties": false
			},
			"SeoDomainMetric": {
				"type": "object",
				"properties": {
					"domain": {
						"type": "string",
						"minLength": 4,
						"maxLength": 253,
						"pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+$"
					},
					"rank": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 1000
							},
							{
								"type": "null"
							}
						]
					},
					"backlinks": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"referringDomains": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"fetchedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"domain",
					"rank",
					"backlinks",
					"referringDomains",
					"fetchedAt"
				],
				"additionalProperties": false
			},
			"__schema0": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/__schema0"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/__schema0"
						}
					}
				]
			},
			"AdsSyncHealthEntry": {
				"type": "object",
				"properties": {
					"externalAccountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"structureDueAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"metricsDueAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"externalAccountId",
					"accountName",
					"provider",
					"parkedAt",
					"lastError",
					"structureDueAt",
					"metricsDueAt"
				],
				"additionalProperties": false
			},
			"AdsProviderCampaignRow": {
				"type": "object",
				"properties": {
					"campaignId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 512
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string",
						"maxLength": 300
					},
					"provider": {
						"type": "string",
						"enum": [
							"meta",
							"google_ads",
							"tiktok",
							"chatgpt"
						]
					},
					"platformKind": {
						"type": "string",
						"enum": [
							"google_search",
							"google_pmax",
							"google_demand_gen",
							"meta_leads",
							"meta_website",
							"tiktok_smartplus_leadgen",
							"chatgpt_chat_card",
							"external"
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"platform": {
						"type": "object",
						"properties": {
							"spendMicros": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"impressions": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"clicks": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"conversions": {
								"type": "number",
								"minimum": 0
							},
							"platformLeads": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"spendMicros",
							"impressions",
							"clicks",
							"conversions",
							"platformLeads"
						],
						"additionalProperties": false
					},
					"crm": {
						"type": "object",
						"properties": {
							"leads": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"booked": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"won": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"wonValueCents": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"leads",
							"booked",
							"won",
							"wonValueCents"
						],
						"additionalProperties": false
					},
					"costPerLeadMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"campaign": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/AdsCampaign"
							},
							{
								"type": "null"
							}
						]
					},
					"costPerBookingMicros": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"returnMultiple": {
						"anyOf": [
							{
								"type": "number",
								"minimum": 0
							},
							{
								"type": "null"
							}
						]
					},
					"adCount": {
						"type": "integer",
						"minimum": 0,
						"maximum": 9007199254740991
					},
					"pendingKinds": {
						"maxItems": 12,
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"create_campaign",
								"adopt_campaign",
								"publish",
								"pause",
								"resume",
								"update_budget",
								"update_schedule",
								"update_destination",
								"update_targeting",
								"apply_creative_batch",
								"set_optimization_goal",
								"create_lead_form"
							]
						}
					}
				},
				"required": [
					"campaignId",
					"externalId",
					"name",
					"provider",
					"platformKind",
					"locationId",
					"platform",
					"crm",
					"costPerLeadMicros",
					"campaign",
					"costPerBookingMicros",
					"returnMultiple",
					"adCount",
					"pendingKinds"
				],
				"additionalProperties": false
			},
			"AdsProviderAdRow": {
				"type": "object",
				"properties": {
					"adId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"campaignId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"adGroupName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fatigueFlaggedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"platform": {
						"type": "object",
						"properties": {
							"spendMicros": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"impressions": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"clicks": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							"conversions": {
								"type": "number",
								"minimum": 0
							},
							"platformLeads": {
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							}
						},
						"required": [
							"spendMicros",
							"impressions",
							"clicks",
							"conversions",
							"platformLeads"
						],
						"additionalProperties": false
					}
				},
				"required": [
					"adId",
					"campaignId",
					"adGroupName",
					"name",
					"externalStatus",
					"fatigueFlaggedAt",
					"platform"
				],
				"additionalProperties": false
			},
			"DayListItem": {
				"type": "object",
				"properties": {
					"appointmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"firstName": {
						"type": "string"
					},
					"lastName": {
						"type": "string"
					},
					"preferredName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentTypeName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"booked",
							"confirmed",
							"arrived",
							"in_chair",
							"fulfilled",
							"cancelled",
							"no_show"
						]
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"practitionerIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"operatoryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentTypeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"isFirstVisit": {
						"type": "boolean"
					},
					"bookedVia": {
						"type": "string"
					},
					"phoneMobile": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"labPending": {
						"type": "boolean"
					},
					"pmsManaged": {
						"type": "boolean"
					}
				},
				"required": [
					"appointmentId",
					"patientId",
					"firstName",
					"lastName",
					"preferredName",
					"appointmentTypeName",
					"treatmentName",
					"status",
					"startsAt",
					"endsAt",
					"version",
					"practitionerIds",
					"operatoryId",
					"locationId",
					"appointmentTypeId",
					"note",
					"isFirstVisit",
					"bookedVia",
					"phoneMobile",
					"labPending",
					"pmsManaged"
				],
				"additionalProperties": false
			},
			"ProcedureCategory": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"position",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"RecallType": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"intervalMonths": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"intervalMonths",
					"position",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ClinicalNoteTemplate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"userId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string"
					},
					"category": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"body": {},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"userId",
					"name",
					"category",
					"body",
					"position",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ProcedureCode": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"code": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"cdt",
							"practice",
							"nhs_band_item",
							"retail",
							"finding"
						]
					},
					"isAct": {
						"type": "boolean"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"standardSystem": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"cdt",
									"snomed"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string"
					},
					"patientName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"categoryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentArea": {
						"type": "string",
						"enum": [
							"none",
							"surface",
							"tooth",
							"root",
							"quadrant",
							"arch",
							"mouth",
							"area"
						]
					},
					"defaultDurationMin": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"recallTypeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"requiresNote": {
						"type": "boolean"
					},
					"nhsBand": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"1",
									"3",
									"2a",
									"2b",
									"2c",
									"urgent",
									"reg11",
									"fluoride_varnish",
									"ortho_assess",
									"ortho_treat",
									"free_repair"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"taxTreatment": {
						"type": "string",
						"enum": [
							"exempt",
							"standard",
							"zero",
							"none"
						]
					},
					"billToInsurance": {
						"type": "boolean"
					},
					"chartShape": {
						"type": "string",
						"enum": [
							"none",
							"surface",
							"large_circle",
							"small_circle",
							"bar",
							"post",
							"implant",
							"absent",
							"cross",
							"square",
							"triangle",
							"text"
						]
					},
					"chartColour": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"chartText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"seed",
							"practice"
						]
					},
					"active": {
						"type": "boolean"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"code",
					"kind",
					"isAct",
					"standardId",
					"standardSystem",
					"name",
					"patientName",
					"categoryId",
					"treatmentArea",
					"defaultDurationMin",
					"recallTypeId",
					"requiresNote",
					"nhsBand",
					"taxTreatment",
					"billToInsurance",
					"chartShape",
					"chartColour",
					"chartText",
					"source",
					"active",
					"position",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"FeeSchedule": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"active": {
						"type": "boolean"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"locationId",
					"active",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"FeeScheduleItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"feeScheduleId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"procedureCodeId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"codeIsAct": {
						"type": "boolean"
					},
					"unitCountFrom": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"effectiveFrom": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"feeCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"retiredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"feeScheduleId",
					"procedureCodeId",
					"codeIsAct",
					"unitCountFrom",
					"effectiveFrom",
					"feeCents",
					"currency",
					"retiredAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"PriceList": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"patientName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"private",
							"nhs",
							"membership"
						]
					},
					"feeScheduleId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"membershipProvider": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"membershipBand": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"active": {
						"type": "boolean"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"patientName",
					"kind",
					"feeScheduleId",
					"membershipProvider",
					"membershipBand",
					"position",
					"active",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PaymentMethod": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"cash",
							"card",
							"terminal",
							"bank_transfer",
							"cheque",
							"online",
							"finance",
							"other"
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"active": {
						"type": "boolean"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"kind",
					"position",
					"active",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AdjustmentType": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"direction": {
						"type": "string",
						"enum": [
							"debit",
							"credit"
						]
					},
					"isWriteOff": {
						"type": "boolean"
					},
					"isInsurance": {
						"type": "boolean"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"active": {
						"type": "boolean"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"direction",
					"isWriteOff",
					"isInsurance",
					"position",
					"active",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PriceListItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"priceListId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"procedureCodeId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"codeIsAct": {
						"type": "boolean"
					},
					"taxTreatment": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"exempt",
									"standard",
									"zero",
									"none"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"feeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"priceListId",
					"procedureCodeId",
					"codeIsAct",
					"taxTreatment",
					"feeCents",
					"currency",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PatientFormTemplate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"key": {
						"type": "string"
					},
					"version": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"kind": {
						"type": "string",
						"enum": [
							"medical_history",
							"consent",
							"questionnaire",
							"custom"
						]
					},
					"name": {
						"type": "string"
					},
					"schema": {},
					"attestationText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAfterDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"requiresSignature": {
						"type": "boolean"
					},
					"requiresReview": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"key",
					"version",
					"kind",
					"name",
					"schema",
					"attestationText",
					"expiresAfterDays",
					"requiresSignature",
					"requiresReview",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"PatientFormDefinition": {
				"type": "object",
				"properties": {
					"fields": {
						"minItems": 1,
						"maxItems": 400,
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"minLength": 1,
									"maxLength": 64,
									"pattern": "^[a-z0-9_]+$"
								},
								"label": {
									"type": "string",
									"minLength": 1,
									"maxLength": 500
								},
								"type": {
									"type": "string",
									"enum": [
										"text",
										"textarea",
										"boolean",
										"choice",
										"multi_choice",
										"date",
										"number",
										"heading"
									]
								},
								"help": {
									"type": "string",
									"maxLength": 2000
								},
								"required": {
									"default": false,
									"type": "boolean"
								},
								"options": {
									"maxItems": 200,
									"type": "array",
									"items": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"alert": {
									"type": "object",
									"properties": {
										"kind": {
											"type": "string",
											"enum": [
												"medical",
												"allergy",
												"medication",
												"infectious",
												"warning"
											]
										},
										"severity": {
											"type": "string",
											"enum": [
												"info",
												"warning",
												"critical"
											]
										},
										"title": {
											"type": "string",
											"minLength": 1,
											"maxLength": 200
										}
									},
									"required": [
										"kind",
										"severity",
										"title"
									]
								},
								"fact": {
									"type": "string",
									"enum": [
										"medication",
										"allergy",
										"condition"
									]
								}
							},
							"required": [
								"id",
								"label",
								"type"
							]
						}
					}
				},
				"required": [
					"fields"
				]
			},
			"CodeStandard": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"system": {
						"type": "string",
						"enum": [
							"cdt",
							"snomed"
						]
					},
					"edition": {
						"type": "string"
					},
					"code": {
						"type": "string"
					},
					"name": {
						"type": "string"
					},
					"descriptor": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"category": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentArea": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"none",
									"surface",
									"tooth",
									"root",
									"quadrant",
									"arch",
									"mouth",
									"area"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"effectiveFrom": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"effectiveTo": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"system",
					"edition",
					"code",
					"name",
					"descriptor",
					"category",
					"treatmentArea",
					"effectiveFrom",
					"effectiveTo"
				],
				"additionalProperties": false
			},
			"CodeStandardEntitlement": {
				"type": "object",
				"properties": {
					"system": {
						"type": "string",
						"enum": [
							"cdt",
							"snomed"
						]
					},
					"edition": {
						"type": "string"
					},
					"grantedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"revokedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"licenceRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"system",
					"edition",
					"grantedAt",
					"revokedAt",
					"licenceRef"
				],
				"additionalProperties": false
			},
			"ClinicalFinding": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"credentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"supervisingPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supervisingCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedByPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"condition",
							"diagnosis",
							"existing_restoration",
							"existing_other"
						]
					},
					"findingCodeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"codeIsAct": {
						"type": "boolean"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"standardSystem": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"description": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"siteKind": {
						"type": "string",
						"enum": [
							"none",
							"tooth",
							"root",
							"implant",
							"supernumerary",
							"area"
						]
					},
					"tooth": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"root": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"single",
									"mesial",
									"distal",
									"buccal",
									"lingual",
									"palatal",
									"mesiobuccal",
									"distobuccal",
									"mesiolingual",
									"distolingual"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"surfaces": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"area": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"upper_arch",
									"lower_arch",
									"upper_right",
									"upper_left",
									"lower_right",
									"lower_left",
									"anterior",
									"posterior",
									"full_mouth",
									"soft_tissue"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"active",
							"treated",
							"resolved",
							"invalidated",
							"superseded"
						]
					},
					"observedOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"observedByPractitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"observedCredentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatedByProcedureId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"recordedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersedesId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersededById": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"invalidatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"invalidatedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"invalidatedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"authoringSource": {
						"type": "string",
						"enum": [
							"staff",
							"ai_draft",
							"import",
							"pms_sync",
							"migration"
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"practitionerId",
					"credentialRevisionId",
					"supervisingPractitionerId",
					"supervisingCredentialRevisionId",
					"resolvedAt",
					"resolvedByPractitionerId",
					"resolvedCredentialRevisionId",
					"kind",
					"findingCodeId",
					"codeIsAct",
					"standardId",
					"standardSystem",
					"description",
					"siteKind",
					"tooth",
					"root",
					"surfaces",
					"area",
					"status",
					"observedOn",
					"observedByPractitionerId",
					"observedCredentialRevisionId",
					"appointmentId",
					"treatedByProcedureId",
					"treatedAt",
					"resolvedOn",
					"resolvedReason",
					"recordedAt",
					"supersedesId",
					"supersededById",
					"invalidatedAt",
					"invalidatedReason",
					"invalidatedById",
					"authoringSource",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"Procedure": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"procedureCodeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"codeIsAct": {
						"type": "boolean"
					},
					"description": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"codeSystem": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"codeEdition": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"code": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"nameSnapshot": {
						"type": "string"
					},
					"patientNameSnapshot": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"categorySnapshot": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"nhsBandSnapshot": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"1",
									"3",
									"2a",
									"2b",
									"2c",
									"urgent",
									"reg11",
									"fluoride_varnish",
									"ortho_assess",
									"ortho_treat",
									"free_repair"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"taxTreatmentSnapshot": {
						"type": "string",
						"enum": [
							"exempt",
							"standard",
							"zero",
							"none"
						]
					},
					"chartShapeSnapshot": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"none",
									"surface",
									"large_circle",
									"small_circle",
									"bar",
									"post",
									"implant",
									"absent",
									"cross",
									"square",
									"triangle",
									"text"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"chartColourSnapshot": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"chartTextSnapshot": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"planned",
							"in_progress",
							"completed",
							"referred_out"
						]
					},
					"siteKind": {
						"type": "string",
						"enum": [
							"none",
							"tooth",
							"root",
							"implant",
							"supernumerary",
							"area"
						]
					},
					"tooth": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"root": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"single",
									"mesial",
									"distal",
									"buccal",
									"lingual",
									"palatal",
									"mesiobuccal",
									"distobuccal",
									"mesiolingual",
									"distolingual"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"supernumeraryPosition": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"surfaces": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"area": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"upper_arch",
									"lower_arch",
									"upper_right",
									"upper_left",
									"lower_right",
									"lower_left",
									"anterior",
									"posterior",
									"full_mouth",
									"soft_tissue"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"quantity": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"serviceDate": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"recordedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"priceListId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"feeScheduleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"priceListItemId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"feeScheduleItemId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"unitCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"feeCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"feeUnknown": {
						"type": "boolean"
					},
					"benefitRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"insuranceEstimateCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"supersedesId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersededById": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedByPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidReauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedByUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"reauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"recordedByPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"recordedCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supervisingPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supervisingCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedByPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"authoringSource": {
						"type": "string",
						"enum": [
							"staff",
							"ai_draft",
							"import",
							"pms_sync",
							"migration"
						]
					},
					"aiModel": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"aiPromptVersion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"procedureCodeId",
					"codeIsAct",
					"description",
					"standardId",
					"codeSystem",
					"codeEdition",
					"code",
					"nameSnapshot",
					"patientNameSnapshot",
					"categorySnapshot",
					"nhsBandSnapshot",
					"taxTreatmentSnapshot",
					"chartShapeSnapshot",
					"chartColourSnapshot",
					"chartTextSnapshot",
					"status",
					"siteKind",
					"tooth",
					"root",
					"supernumeraryPosition",
					"surfaces",
					"area",
					"quantity",
					"practitionerId",
					"locationId",
					"appointmentId",
					"serviceDate",
					"completedAt",
					"recordedAt",
					"note",
					"priceListId",
					"feeScheduleId",
					"priceListItemId",
					"feeScheduleItemId",
					"unitCount",
					"feeCents",
					"feeUnknown",
					"benefitRevisionId",
					"insuranceEstimateCents",
					"currency",
					"supersedesId",
					"supersededById",
					"voidedAt",
					"voidReason",
					"voidedByPractitionerId",
					"voidCredentialRevisionId",
					"voidReauthenticatedAt",
					"voidedByUserId",
					"reauthenticatedAt",
					"recordedByPractitionerId",
					"recordedCredentialRevisionId",
					"supervisingPractitionerId",
					"supervisingCredentialRevisionId",
					"completedByPractitionerId",
					"completedCredentialRevisionId",
					"authoringSource",
					"aiModel",
					"aiPromptVersion",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ClinicalStorageWork": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"documentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"keyVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deadlineAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseToken": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"state": {
						"type": "string",
						"enum": [
							"awaiting_primary_verification",
							"open",
							"reserved",
							"completed",
							"parked"
						]
					},
					"reservedKeyVersion": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"mime": {
						"type": "string"
					},
					"bytes": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"documentId",
					"keyVersion",
					"attemptCount",
					"lastAttemptAt",
					"deadlineAt",
					"parkedAt",
					"leaseToken",
					"leaseExpiresAt",
					"state",
					"reservedKeyVersion",
					"lastError",
					"completedAt",
					"createdAt",
					"updatedAt",
					"mime",
					"bytes",
					"patientId"
				],
				"additionalProperties": false
			},
			"ClinicalStorageDeletion": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"documentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"retention_expiry",
							"erasure",
							"rotation_retire"
						]
					},
					"keyVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"generation": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"requestedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"requestedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"preconditionProof": {},
					"primaryDeletedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"backupDeletedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deadlineAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseToken": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"mime": {
						"type": "string"
					},
					"bytes": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"holdActive": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"organizationId",
					"documentId",
					"kind",
					"keyVersion",
					"generation",
					"requestedAt",
					"requestedById",
					"preconditionProof",
					"primaryDeletedAt",
					"backupDeletedAt",
					"attemptCount",
					"lastAttemptAt",
					"deadlineAt",
					"parkedAt",
					"leaseToken",
					"leaseExpiresAt",
					"lastError",
					"createdAt",
					"updatedAt",
					"mime",
					"bytes",
					"patientId",
					"holdActive"
				],
				"additionalProperties": false
			},
			"ClinicalKeyVersion": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"cell": {
						"type": "string",
						"enum": [
							"eu",
							"us",
							"stage"
						]
					},
					"version": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"state": {
						"type": "string",
						"enum": [
							"minting",
							"active",
							"retiring",
							"retired"
						]
					},
					"activatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"retiringAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"retiredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"cell",
					"version",
					"state",
					"activatedAt",
					"retiringAt",
					"retiredAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ClinicalStorageRotation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"documentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"fromKeyVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"toKeyVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"state": {
						"type": "string",
						"enum": [
							"pending",
							"rewriting",
							"rewritten",
							"copied",
							"retired"
						]
					},
					"rewritingAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"rewrittenAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"copiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"retiredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deadlineAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseToken": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"mime": {
						"type": "string"
					},
					"bytes": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"documentId",
					"fromKeyVersion",
					"toKeyVersion",
					"state",
					"rewritingAt",
					"rewrittenAt",
					"copiedAt",
					"retiredAt",
					"attemptCount",
					"lastAttemptAt",
					"deadlineAt",
					"parkedAt",
					"leaseToken",
					"leaseExpiresAt",
					"lastError",
					"createdAt",
					"updatedAt",
					"mime",
					"bytes",
					"patientId"
				],
				"additionalProperties": false
			},
			"ClinicalRestoreItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"objectKey": {
						"type": "string"
					},
					"documentId": {
						"type": "string"
					},
					"keyVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"sha256": {
						"type": "string"
					},
					"state": {
						"type": "string",
						"enum": [
							"pending",
							"needs_review",
							"resolved",
							"discarded"
						]
					},
					"receivedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"failureSummary": {
						"type": "string"
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolutionNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"objectKey",
					"documentId",
					"keyVersion",
					"sha256",
					"state",
					"receivedAt",
					"failureSummary",
					"resolvedAt",
					"resolutionNote"
				],
				"additionalProperties": false
			},
			"PatientDocument": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"clinicalDocumentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"xray",
							"photo",
							"letter",
							"correspondence",
							"consent",
							"referral",
							"lab",
							"insurance",
							"invoice",
							"statement",
							"signature",
							"prescription",
							"export",
							"other"
						]
					},
					"title": {
						"type": "string"
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"takenOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"upload",
							"form",
							"generated",
							"message",
							"import",
							"pms_sync"
						]
					},
					"messageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"tags": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"mime": {
						"type": "string"
					},
					"bytes": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"clinicalDocumentId",
					"kind",
					"title",
					"appointmentId",
					"takenOn",
					"source",
					"messageId",
					"tags",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"mime",
					"bytes"
				],
				"additionalProperties": false
			},
			"TreatmentPlan": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"number": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"externalReference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"importedStatus": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"presented",
							"accepted",
							"in_progress",
							"completed",
							"declined",
							"cancelled"
						]
					},
					"version": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"priceListId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"journeyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"presentedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"acceptedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"declinedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalTotalCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"authoringSource": {
						"type": "string",
						"enum": [
							"staff",
							"ai_draft",
							"import",
							"pms_sync",
							"migration"
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"procedures": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/TreatmentPlanProcedure"
						}
					},
					"visits": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/TreatmentPlanVisit"
						}
					},
					"snapshots": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/TreatmentPlanSnapshot"
						}
					},
					"totalCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"locationId",
					"practitionerId",
					"number",
					"externalReference",
					"importedStatus",
					"name",
					"status",
					"version",
					"priceListId",
					"journeyId",
					"presentedAt",
					"acceptedAt",
					"declinedAt",
					"completedAt",
					"cancelledAt",
					"expiresAt",
					"externalTotalCents",
					"currency",
					"note",
					"authoringSource",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"procedures",
					"visits",
					"snapshots",
					"totalCents"
				],
				"additionalProperties": false
			},
			"TreatmentPlanProcedure": {
				"type": "object",
				"properties": {
					"treatmentPlanId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"procedureId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"visitId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"procedure": {
						"$ref": "#/components/schemas/Procedure"
					}
				},
				"required": [
					"treatmentPlanId",
					"procedureId",
					"organizationId",
					"patientId",
					"visitId",
					"position",
					"createdAt",
					"updatedAt",
					"procedure"
				],
				"additionalProperties": false
			},
			"TreatmentPlanVisit": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"treatmentPlanId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"durationMin": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"minIntervalDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"bookable": {
						"type": "boolean"
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointment": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/TreatmentPlanVisitAppointment"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {},
					"noteText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"treatmentPlanId",
					"patientId",
					"position",
					"name",
					"durationMin",
					"minIntervalDays",
					"bookable",
					"appointmentId",
					"appointment",
					"note",
					"noteText",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"TreatmentPlanVisitAppointment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"booked",
							"confirmed",
							"arrived",
							"in_chair",
							"fulfilled",
							"cancelled",
							"no_show"
						]
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"startsAt",
					"endsAt",
					"status",
					"practitionerId"
				],
				"additionalProperties": false
			},
			"TreatmentPlanSnapshot": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"treatmentPlanId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"presented",
							"accepted"
						]
					},
					"planVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"digest": {
						"type": "string"
					},
					"presentedByPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"presentedByUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"presentedByName": {
						"type": "string"
					},
					"presentedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"reauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"signerRole": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"self",
									"parent",
									"guardian",
									"attorney"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"signerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"signerRelationshipId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"signatureDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"signedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"signerIp": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"signerUserAgent": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"attestationVersion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"recordedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"invalidatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"invalidatedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"invalidatedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"treatmentPlanId",
					"patientId",
					"kind",
					"planVersion",
					"digest",
					"presentedByPractitionerId",
					"practitionerCredentialRevisionId",
					"presentedByUserId",
					"presentedByName",
					"presentedAt",
					"reauthenticatedAt",
					"signerRole",
					"signerName",
					"signerRelationshipId",
					"signatureDocumentId",
					"signedAt",
					"signerIp",
					"signerUserAgent",
					"attestationVersion",
					"recordedById",
					"invalidatedAt",
					"invalidatedReason",
					"invalidatedById",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"TreatmentPlanSigner": {
				"type": "object",
				"properties": {
					"relationshipId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"parent",
							"guardian",
							"guarantor",
							"spouse",
							"family",
							"attorney",
							"carer",
							"other"
						]
					},
					"name": {
						"type": "string"
					}
				},
				"required": [
					"relationshipId",
					"kind",
					"name"
				],
				"additionalProperties": false
			},
			"ClinicalNote": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"authorCredentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"procedureId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"clinical",
							"procedure",
							"progress"
						]
					},
					"templateId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"body": {},
					"bodyText": {
						"type": "string"
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"signedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"signedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"signedPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"signedCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"supervisingPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supervisingCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"addendumOfId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"authoringSource": {
						"type": "string",
						"enum": [
							"staff",
							"ai_draft",
							"import",
							"pms_sync",
							"migration"
						]
					},
					"aiModel": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"aiPromptVersion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"practitionerId",
					"authorCredentialRevisionId",
					"appointmentId",
					"procedureId",
					"kind",
					"templateId",
					"body",
					"bodyText",
					"completedAt",
					"signedAt",
					"signedById",
					"signedPractitionerId",
					"signedCredentialRevisionId",
					"reauthenticatedAt",
					"supervisingPractitionerId",
					"supervisingCredentialRevisionId",
					"addendumOfId",
					"authoringSource",
					"aiModel",
					"aiPromptVersion",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PatientMedicalCondition": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"standardSystem": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"review",
							"staff",
							"import",
							"pms_sync"
						]
					},
					"reviewId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersedesId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"name": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"resolved",
							"historical"
						]
					},
					"onsetOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"resolvedOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"severity": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"standardId",
					"standardSystem",
					"source",
					"reviewId",
					"supersedesId",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"name",
					"status",
					"onsetOn",
					"resolvedOn",
					"severity"
				],
				"additionalProperties": false
			},
			"PatientMedication": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"standardSystem": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"review",
							"staff",
							"import",
							"pms_sync"
						]
					},
					"reviewId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersedesId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"name": {
						"type": "string"
					},
					"dose": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"frequency": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"route": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"startedOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"stoppedOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"stopped",
							"historical"
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"standardId",
					"standardSystem",
					"source",
					"reviewId",
					"supersedesId",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"name",
					"dose",
					"frequency",
					"route",
					"startedOn",
					"stoppedOn",
					"status"
				],
				"additionalProperties": false
			},
			"PatientAllergy": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"standardSystem": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"review",
							"staff",
							"import",
							"pms_sync"
						]
					},
					"reviewId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersedesId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"substance": {
						"type": "string"
					},
					"reaction": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"severity": {
						"type": "string",
						"enum": [
							"info",
							"warning",
							"critical"
						]
					},
					"onsetOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"resolved",
							"refuted"
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"standardId",
					"standardSystem",
					"source",
					"reviewId",
					"supersedesId",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"substance",
					"reaction",
					"severity",
					"onsetOn",
					"status"
				],
				"additionalProperties": false
			},
			"PatientAlert": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"medical",
							"allergy",
							"medication",
							"infectious",
							"warning"
						]
					},
					"title": {
						"type": "string"
					},
					"detail": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"severity": {
						"type": "string",
						"enum": [
							"info",
							"warning",
							"critical"
						]
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"standardSystem": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"popup": {
						"type": "boolean"
					},
					"provisional": {
						"type": "boolean"
					},
					"startsOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"endsOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"formSubmissionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"medicationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"allergyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"conditionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"authoringSource": {
						"type": "string",
						"enum": [
							"staff",
							"ai_draft",
							"import",
							"pms_sync",
							"migration"
						]
					},
					"legacyMedicalAlert": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"kind",
					"title",
					"detail",
					"severity",
					"standardId",
					"standardSystem",
					"popup",
					"provisional",
					"startsOn",
					"endsOn",
					"formSubmissionId",
					"medicationId",
					"allergyId",
					"conditionId",
					"authoringSource",
					"legacyMedicalAlert",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PatientFormSubmission": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"templateId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"templateVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"answers": {},
					"answersDigest": {
						"type": "string"
					},
					"source": {
						"type": "string",
						"enum": [
							"patient",
							"staff",
							"import",
							"pms_sync"
						]
					},
					"ingressReceiptId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"importJobId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"submittedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"submittedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"submittedVia": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"kiosk",
									"portal_link",
									"staff",
									"mobile"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"signerRole": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"self",
									"parent",
									"guardian",
									"attorney"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"signerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"signerRelationshipId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"signatureDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"signedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"signerIp": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"signerUserAgent": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"attestationVersion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"supersedesId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"reviews": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PatientFormReview"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"templateId",
					"templateVersion",
					"appointmentId",
					"answers",
					"answersDigest",
					"source",
					"ingressReceiptId",
					"importJobId",
					"submittedAt",
					"submittedById",
					"submittedVia",
					"signerRole",
					"signerName",
					"signerRelationshipId",
					"signatureDocumentId",
					"signedAt",
					"signerIp",
					"signerUserAgent",
					"attestationVersion",
					"expiresAt",
					"supersedesId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"reviews"
				],
				"additionalProperties": false
			},
			"PatientFormReview": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"submissionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reviewerPractitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reviewerCredentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"reviewedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"outcome": {
						"type": "string",
						"enum": [
							"accepted",
							"accepted_with_changes",
							"rejected"
						]
					},
					"proposedChanges": {},
					"appliedChanges": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"submissionId",
					"patientId",
					"reviewerPractitionerId",
					"reviewerCredentialRevisionId",
					"reviewedAt",
					"outcome",
					"proposedChanges",
					"appliedChanges",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"Recall": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"recallTypeId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"dueOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"intervalMonths": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"bookedAppointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastCompletedOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"paused"
						]
					},
					"pausedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastEventId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"events": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/RecallEvent"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"recallTypeId",
					"practitionerId",
					"dueOn",
					"intervalMonths",
					"bookedAppointmentId",
					"lastCompletedOn",
					"status",
					"pausedReason",
					"lastEventId",
					"createdAt",
					"updatedAt",
					"events"
				],
				"additionalProperties": false
			},
			"RecallEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"recallId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"created",
							"rescheduled",
							"booked",
							"completed",
							"skipped",
							"missed",
							"paused",
							"resumed",
							"contacted"
						]
					},
					"occurredAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"dueOnBefore": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"dueOnAfter": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"actorUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"actorSource": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"recallId",
					"patientId",
					"kind",
					"occurredAt",
					"dueOnBefore",
					"dueOnAfter",
					"appointmentId",
					"actorUserId",
					"actorSource",
					"note",
					"createdAt"
				],
				"additionalProperties": false
			},
			"LedgerEntry": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountMemberId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"charge",
							"payment",
							"adjustment",
							"refund",
							"insurance_payment",
							"write_off",
							"transfer"
						]
					},
					"amountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"entryDate": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"postedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"chargeSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"procedure",
									"external_line",
									"retail",
									"manual",
									"membership",
									"stamp_duty"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"procedureId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalLineRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"retailProcedureCodeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"retailCodeIsAct": {
						"type": "boolean"
					},
					"description": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"taxTreatment": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"exempt",
									"standard",
									"zero",
									"none"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"taxCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"paymentMethodId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"adjustmentTypeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"depositRequestId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"insuranceClaimId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"statementId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"membershipSubscriptionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"providerRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"refundOfEntryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reversesEntryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reversedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"transferCounterpartId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalAccountRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalConnectionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"staff",
							"deposit",
							"online_payment",
							"terminal",
							"import",
							"pms_sync",
							"insurance"
						]
					},
					"reference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"accountId",
					"accountMemberId",
					"locationId",
					"practitionerId",
					"kind",
					"amountCents",
					"currency",
					"entryDate",
					"postedAt",
					"chargeSource",
					"procedureId",
					"externalLineRef",
					"retailProcedureCodeId",
					"retailCodeIsAct",
					"description",
					"taxTreatment",
					"taxCents",
					"paymentMethodId",
					"adjustmentTypeId",
					"depositRequestId",
					"insuranceClaimId",
					"statementId",
					"membershipSubscriptionId",
					"providerRef",
					"refundOfEntryId",
					"reversesEntryId",
					"reversedAt",
					"transferCounterpartId",
					"externalAccountRef",
					"externalConnectionId",
					"source",
					"reference",
					"note",
					"postedById",
					"createdAt"
				],
				"additionalProperties": false
			},
			"LedgerAllocation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"fromEntryId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"toEntryId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"amountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"allocatedOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"reversesAllocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reversedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalAllocationRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalTransferFromRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalTransferFromType": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalTransferToRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalTransferToType": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"itemChoice": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalConnectionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"materializationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"fromEntryId",
					"toEntryId",
					"amountCents",
					"currency",
					"allocatedOn",
					"reversesAllocationId",
					"reversedAt",
					"externalAllocationRef",
					"externalTransferFromRef",
					"externalTransferFromType",
					"externalTransferToRef",
					"externalTransferToType",
					"itemChoice",
					"externalConnectionId",
					"materializationId",
					"createdAt"
				],
				"additionalProperties": false
			},
			"Invoice": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"invoice",
							"credit_note"
						]
					},
					"number": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"numberPeriod": {
						"type": "string"
					},
					"externalReference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"native",
							"pms_sync"
						]
					},
					"externalRevision": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalPractitionerRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalNumber": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalConnectionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"issued",
							"void"
						]
					},
					"issuedOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"dueOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"priceListId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"creditNoteForInvoiceId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"totalCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"taxCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"documentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"sentMessageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidReason": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"credit_note",
									"provider_deleted",
									"provider_revised",
									"issued_in_error"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"voidCreditNoteId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lines": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/InvoiceLine"
						}
					},
					"paidCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"accountId",
					"locationId",
					"kind",
					"number",
					"numberPeriod",
					"externalReference",
					"source",
					"externalRevision",
					"externalPractitionerRef",
					"externalNumber",
					"externalConnectionId",
					"status",
					"issuedOn",
					"dueOn",
					"priceListId",
					"creditNoteForInvoiceId",
					"totalCents",
					"taxCents",
					"currency",
					"documentId",
					"sentMessageId",
					"voidedAt",
					"voidReason",
					"voidCreditNoteId",
					"note",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"lines",
					"paidCents"
				],
				"additionalProperties": false
			},
			"InvoiceLine": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"invoiceId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"invoiceKind": {
						"type": "string",
						"enum": [
							"invoice",
							"credit_note"
						]
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"entryId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"unitAmountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"nhsChargeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"externalLineRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalPlanRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalPlanItemRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalSundryRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"description": {
						"type": "string"
					},
					"quantity": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"amountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"taxCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"taxTreatment": {
						"type": "string",
						"enum": [
							"exempt",
							"standard",
							"zero",
							"none"
						]
					},
					"taxRateBp": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"taxRuleVersion": {
						"type": "string"
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"invoiceId",
					"invoiceKind",
					"patientId",
					"accountId",
					"locationId",
					"entryId",
					"unitAmountCents",
					"nhsChargeCents",
					"externalLineRef",
					"externalPlanRef",
					"externalPlanItemRef",
					"externalSundryRef",
					"position",
					"description",
					"quantity",
					"amountCents",
					"taxCents",
					"taxTreatment",
					"taxRateBp",
					"taxRuleVersion",
					"currency",
					"createdAt"
				],
				"additionalProperties": false
			},
			"TerminalReader": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string"
					},
					"label": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"online",
									"offline"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"deviceType": {
						"type": "string"
					},
					"serialNumber": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"label",
					"status",
					"deviceType",
					"serialNumber",
					"locationId"
				],
				"additionalProperties": false
			},
			"TerminalPayment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"paymentMethodId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"amountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"stripeAccountId": {
						"type": "string"
					},
					"readerId": {
						"type": "string"
					},
					"clientRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"paymentIntentId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"created",
							"processing",
							"succeeded",
							"failed",
							"canceled",
							"uncertain"
						]
					},
					"failureCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"failureMessage": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"ledgerEntryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"locationId",
					"paymentMethodId",
					"amountCents",
					"currency",
					"stripeAccountId",
					"readerId",
					"clientRef",
					"paymentIntentId",
					"status",
					"failureCode",
					"failureMessage",
					"ledgerEntryId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PerioExam": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"jurisdiction": {
						"type": "string",
						"enum": [
							"unsupported",
							"gb_england",
							"gb_wales",
							"gb_scotland",
							"gb_northern_ireland",
							"us_al",
							"us_ak",
							"us_az",
							"us_ar",
							"us_ca",
							"us_co",
							"us_ct",
							"us_de",
							"us_dc",
							"us_fl",
							"us_ga",
							"us_hi",
							"us_id",
							"us_il",
							"us_in",
							"us_ia",
							"us_ks",
							"us_ky",
							"us_la",
							"us_me",
							"us_md",
							"us_ma",
							"us_mi",
							"us_mn",
							"us_ms",
							"us_mo",
							"us_mt",
							"us_ne",
							"us_nv",
							"us_nh",
							"us_nj",
							"us_nm",
							"us_ny",
							"us_nc",
							"us_nd",
							"us_oh",
							"us_ok",
							"us_or",
							"us_pa",
							"us_ri",
							"us_sc",
							"us_sd",
							"us_tn",
							"us_tx",
							"us_ut",
							"us_vt",
							"us_va",
							"us_wa",
							"us_wv",
							"us_wi",
							"us_wy",
							"it"
						]
					},
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"credentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"probing",
							"bpe",
							"psr",
							"bewe",
							"soft_tissue"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"completed",
							"amended"
						]
					},
					"examDate": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"examinedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"revision": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"amendedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"amendedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"bopPercent": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"plaquePercent": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"aapStage": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"I",
									"II",
									"III",
									"IV"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"aapGrade": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"A",
									"B",
									"C"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"aapExtent": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"localised",
									"generalised",
									"molar_incisor"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"notes": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedByPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidReauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"authoringSource": {
						"type": "string",
						"enum": [
							"staff",
							"ai_draft",
							"import",
							"pms_sync",
							"migration"
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"probingSites": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PerioProbingSite"
						}
					},
					"bpeScores": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PerioBpeScore"
						}
					},
					"beweScores": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PerioBeweScore"
						}
					},
					"softTissueFindings": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PerioSoftTissueFinding"
						}
					},
					"revisionCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"locationId",
					"jurisdiction",
					"practitionerId",
					"credentialRevisionId",
					"appointmentId",
					"kind",
					"status",
					"examDate",
					"examinedAt",
					"revision",
					"completedAt",
					"amendedAt",
					"amendedById",
					"bopPercent",
					"plaquePercent",
					"aapStage",
					"aapGrade",
					"aapExtent",
					"notes",
					"voidedAt",
					"voidReason",
					"voidedByPractitionerId",
					"voidCredentialRevisionId",
					"voidReauthenticatedAt",
					"authoringSource",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"probingSites",
					"bpeScores",
					"beweScores",
					"softTissueFindings",
					"revisionCount"
				],
				"additionalProperties": false
			},
			"PerioProbingSite": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"examId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"examKind": {
						"type": "string"
					},
					"tooth": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"site": {
						"type": "string",
						"enum": [
							"mb",
							"b",
							"db",
							"ml",
							"l",
							"dl"
						]
					},
					"state": {
						"type": "string",
						"enum": [
							"measured",
							"not_measured",
							"absent",
							"not_applicable"
						]
					},
					"pocketDepthMm": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"recessionMm": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"bleeding": {
						"type": "boolean"
					},
					"suppuration": {
						"type": "boolean"
					},
					"plaque": {
						"type": "boolean"
					},
					"furcation": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"mobility": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"examId",
					"patientId",
					"createdAt",
					"updatedAt",
					"examKind",
					"tooth",
					"site",
					"state",
					"pocketDepthMm",
					"recessionMm",
					"bleeding",
					"suppuration",
					"plaque",
					"furcation",
					"mobility"
				],
				"additionalProperties": false
			},
			"PerioBpeScore": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"examId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"examKind": {
						"type": "string"
					},
					"sextant": {
						"type": "string",
						"enum": [
							"ur",
							"ua",
							"ul",
							"lr",
							"la",
							"ll"
						]
					},
					"code": {
						"type": "string",
						"enum": [
							"0",
							"1",
							"2",
							"3",
							"4",
							"X"
						]
					},
					"furcation": {
						"type": "boolean"
					},
					"bleeding": {
						"anyOf": [
							{
								"type": "boolean"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"examId",
					"patientId",
					"createdAt",
					"updatedAt",
					"examKind",
					"sextant",
					"code",
					"furcation",
					"bleeding"
				],
				"additionalProperties": false
			},
			"PerioBeweScore": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"examId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"examKind": {
						"type": "string"
					},
					"sextant": {
						"type": "string",
						"enum": [
							"ur",
							"ua",
							"ul",
							"lr",
							"la",
							"ll"
						]
					},
					"score": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					}
				},
				"required": [
					"id",
					"organizationId",
					"examId",
					"patientId",
					"createdAt",
					"updatedAt",
					"examKind",
					"sextant",
					"score"
				],
				"additionalProperties": false
			},
			"PerioSoftTissueFinding": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"examId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"examKind": {
						"type": "string"
					},
					"site": {
						"type": "string",
						"enum": [
							"lips",
							"buccal_mucosa",
							"tongue",
							"floor_of_mouth",
							"palate",
							"gingiva",
							"oropharynx",
							"other"
						]
					},
					"description": {
						"type": "string"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"referralRecommended": {
						"type": "boolean"
					},
					"clinicalFindingId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"examId",
					"patientId",
					"createdAt",
					"updatedAt",
					"examKind",
					"site",
					"description",
					"standardId",
					"referralRecommended",
					"clinicalFindingId"
				],
				"additionalProperties": false
			},
			"PerioExamRevision": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"examId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"revision": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"header": {},
					"rows": {},
					"replacedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"replacedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"examId",
					"patientId",
					"revision",
					"header",
					"rows",
					"replacedAt",
					"replacedById",
					"createdAt"
				],
				"additionalProperties": false
			},
			"InsuranceCarrier": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"payerId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"neaPayerId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine2": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"region": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phone": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"adaFormVersion": {
						"type": "string",
						"enum": [
							"2012",
							"2019",
							"2024"
						]
					},
					"acceptsElectronicAttachments": {
						"type": "boolean"
					},
					"acceptsEligibility": {
						"type": "boolean"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"payerId",
					"neaPayerId",
					"addressLine1",
					"addressLine2",
					"city",
					"region",
					"postalCode",
					"phone",
					"adaFormVersion",
					"acceptsElectronicAttachments",
					"acceptsEligibility",
					"position",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"InsurancePlan": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"carrierId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"name": {
						"type": "string"
					},
					"employerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"groupName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"groupNumber": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"planType": {
						"type": "string",
						"enum": [
							"ppo",
							"indemnity",
							"hmo_capitation",
							"discount",
							"medicaid",
							"other"
						]
					},
					"renewalMonth": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"feeScheduleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"notes": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"carrierId",
					"name",
					"employerName",
					"groupName",
					"groupNumber",
					"planType",
					"renewalMonth",
					"feeScheduleId",
					"notes",
					"position",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"InsuranceBenefitRevisionView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"planId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"cdtEdition": {
						"type": "string"
					},
					"effectiveFrom": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"effectiveTo": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"coverageKind": {
						"type": "string",
						"enum": [
							"percentage",
							"copay"
						]
					},
					"noDuplicationOfBenefits": {
						"type": "boolean"
					},
					"missingToothClause": {
						"type": "boolean"
					},
					"basicIndividualAnnualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"basicIndividualLifetimeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"basicFamilyAnnualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"preventiveIndividualAnnualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"preventiveIndividualLifetimeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"preventiveFamilyAnnualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"majorIndividualAnnualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"majorIndividualLifetimeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"majorFamilyAnnualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"orthoIndividualAnnualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"orthoIndividualLifetimeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"annualMaximumIndividualCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"annualMaximumFamilyCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"orthoLifetimeMaximumCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"manual",
							"eligibility",
							"carrier_import"
						]
					},
					"retiredAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"ranges": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/InsuranceBenefitRange"
						}
					},
					"exceptions": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/InsuranceBenefitException"
						}
					},
					"copays": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/InsuranceBenefitCopay"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"planId",
					"cdtEdition",
					"effectiveFrom",
					"effectiveTo",
					"coverageKind",
					"noDuplicationOfBenefits",
					"missingToothClause",
					"basicIndividualAnnualCents",
					"basicIndividualLifetimeCents",
					"basicFamilyAnnualCents",
					"preventiveIndividualAnnualCents",
					"preventiveIndividualLifetimeCents",
					"preventiveFamilyAnnualCents",
					"majorIndividualAnnualCents",
					"majorIndividualLifetimeCents",
					"majorFamilyAnnualCents",
					"orthoIndividualAnnualCents",
					"orthoIndividualLifetimeCents",
					"annualMaximumIndividualCents",
					"annualMaximumFamilyCents",
					"orthoLifetimeMaximumCents",
					"currency",
					"source",
					"retiredAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"ranges",
					"exceptions",
					"copays"
				],
				"additionalProperties": false
			},
			"InsuranceBenefitRange": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"revisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"edition": {
						"type": "string"
					},
					"network": {
						"type": "string",
						"enum": [
							"in",
							"out"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"codeFrom": {
						"type": "string"
					},
					"codeTo": {
						"type": "string"
					},
					"category": {
						"type": "string",
						"enum": [
							"diagnostic",
							"preventive",
							"basic",
							"major",
							"ortho",
							"other"
						]
					},
					"coveragePercent": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"deductibleType": {
						"type": "string",
						"enum": [
							"none",
							"basic",
							"preventive",
							"major",
							"ortho"
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"revisionId",
					"edition",
					"network",
					"createdAt",
					"codeFrom",
					"codeTo",
					"category",
					"coveragePercent",
					"deductibleType"
				],
				"additionalProperties": false
			},
			"InsuranceBenefitException": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"revisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"edition": {
						"type": "string"
					},
					"network": {
						"type": "string",
						"enum": [
							"in",
							"out"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"standardSystem": {
						"type": "string"
					},
					"standardId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"downgradeStandardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"exceptionType": {
						"type": "string",
						"enum": [
							"excluded",
							"downgrade",
							"age_limit",
							"frequency",
							"waiting_period",
							"coverage_override"
						]
					},
					"coveragePercent": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"deductibleType": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"none",
									"basic",
									"preventive",
									"major",
									"ortho"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"minAge": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"maxAge": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"frequencyCount": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"frequencyMonths": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"waitingPeriodMonths": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"reason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"revisionId",
					"edition",
					"network",
					"createdAt",
					"standardSystem",
					"standardId",
					"downgradeStandardId",
					"exceptionType",
					"coveragePercent",
					"deductibleType",
					"minAge",
					"maxAge",
					"frequencyCount",
					"frequencyMonths",
					"waitingPeriodMonths",
					"reason"
				],
				"additionalProperties": false
			},
			"InsuranceBenefitCopay": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"revisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"edition": {
						"type": "string"
					},
					"network": {
						"type": "string",
						"enum": [
							"in",
							"out"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"standardSystem": {
						"type": "string"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"category": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"diagnostic",
									"preventive",
									"basic",
									"major",
									"ortho",
									"other"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"copayCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"revisionId",
					"edition",
					"network",
					"createdAt",
					"standardSystem",
					"standardId",
					"category",
					"copayCents",
					"currency"
				],
				"additionalProperties": false
			},
			"PatientInsuranceCoverageView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"subscriptionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"planId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"relationship": {
						"type": "string",
						"enum": [
							"self",
							"spouse",
							"child",
							"other"
						]
					},
					"priority": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"from": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"to": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"plan": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"name": {
								"type": "string"
							},
							"planType": {
								"type": "string",
								"enum": [
									"ppo",
									"indemnity",
									"hmo_capitation",
									"discount",
									"medicaid",
									"other"
								]
							},
							"carrierId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"carrierName": {
								"type": "string"
							},
							"renewalMonth": {
								"anyOf": [
									{
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"id",
							"name",
							"planType",
							"carrierId",
							"carrierName",
							"renewalMonth"
						],
						"additionalProperties": false
					},
					"subscription": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"organizationId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
								"description": "Canonical lowercase UUID organization identifier"
							},
							"planId": {
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							"subscriberPatientId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"subscriberContactPartyId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"subscriberRelationshipId": {
								"anyOf": [
									{
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									{
										"type": "null"
									}
								]
							},
							"memberNumber": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"effectiveFrom": {
								"anyOf": [
									{
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									{
										"type": "null"
									}
								]
							},
							"effectiveTo": {
								"anyOf": [
									{
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									{
										"type": "null"
									}
								]
							},
							"releaseOfInformation": {
								"type": "boolean"
							},
							"assignmentOfBenefits": {
								"type": "boolean"
							},
							"archivedAt": {
								"anyOf": [
									{
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									{
										"type": "null"
									}
								]
							},
							"createdById": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"createdByName": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							},
							"createdBySource": {
								"type": "string",
								"enum": [
									"user",
									"patient",
									"automation",
									"campaign",
									"ai",
									"api",
									"import",
									"system"
								]
							},
							"createdAt": {
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							"updatedAt": {
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							"subscriberName": {
								"anyOf": [
									{
										"type": "string"
									},
									{
										"type": "null"
									}
								]
							}
						},
						"required": [
							"id",
							"organizationId",
							"planId",
							"subscriberPatientId",
							"subscriberContactPartyId",
							"subscriberRelationshipId",
							"memberNumber",
							"effectiveFrom",
							"effectiveTo",
							"releaseOfInformation",
							"assignmentOfBenefits",
							"archivedAt",
							"createdById",
							"createdByName",
							"createdBySource",
							"createdAt",
							"updatedAt",
							"subscriberName"
						],
						"additionalProperties": false
					},
					"revisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"usage": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/InsuranceBenefitUsage"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"subscriptionId",
					"planId",
					"relationship",
					"priority",
					"from",
					"to",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"plan",
					"subscription",
					"revisionId",
					"usage"
				],
				"additionalProperties": false
			},
			"InsuranceBenefitUsage": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"subscriptionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"benefitYear": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"category": {
						"type": "string",
						"enum": [
							"none",
							"basic",
							"preventive",
							"major",
							"ortho"
						]
					},
					"deductibleMetCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"maximumUsedCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"source": {
						"type": "string",
						"enum": [
							"manual",
							"eligibility",
							"carrier_import"
						]
					},
					"verifiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"subscriptionId",
					"patientId",
					"benefitYear",
					"category",
					"deductibleMetCents",
					"maximumUsedCents",
					"currency",
					"source",
					"verifiedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"InsuranceSubscriptionSearchRow": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"planId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"subscriberPatientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"subscriberContactPartyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"subscriberRelationshipId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"memberNumber": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"effectiveFrom": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"effectiveTo": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"releaseOfInformation": {
						"type": "boolean"
					},
					"assignmentOfBenefits": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"planName": {
						"type": "string"
					},
					"carrierName": {
						"type": "string"
					},
					"subscriberName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"planId",
					"subscriberPatientId",
					"subscriberContactPartyId",
					"subscriberRelationshipId",
					"memberNumber",
					"effectiveFrom",
					"effectiveTo",
					"releaseOfInformation",
					"assignmentOfBenefits",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"planName",
					"carrierName",
					"subscriberName"
				],
				"additionalProperties": false
			},
			"InsuranceEstimateLine": {
				"type": "object",
				"properties": {
					"procedureId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"code": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"description": {
						"type": "string"
					},
					"billedCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"allowedCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"coveragePercent": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"deductibleAppliedCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"copayCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"payerCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"patientCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"notes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					}
				},
				"required": [
					"procedureId",
					"code",
					"description",
					"billedCents",
					"allowedCents",
					"coveragePercent",
					"deductibleAppliedCents",
					"copayCents",
					"payerCents",
					"patientCents",
					"notes"
				],
				"additionalProperties": false
			},
			"InsuranceClaim": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountMemberId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"coverageId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"planId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"benefitRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"jurisdiction": {
						"type": "string",
						"enum": [
							"unsupported",
							"gb_england",
							"gb_wales",
							"gb_scotland",
							"gb_northern_ireland",
							"us_al",
							"us_ak",
							"us_az",
							"us_ar",
							"us_ca",
							"us_co",
							"us_ct",
							"us_de",
							"us_dc",
							"us_fl",
							"us_ga",
							"us_hi",
							"us_id",
							"us_il",
							"us_in",
							"us_ia",
							"us_ks",
							"us_ky",
							"us_la",
							"us_me",
							"us_md",
							"us_ma",
							"us_mi",
							"us_mn",
							"us_ms",
							"us_mo",
							"us_mt",
							"us_ne",
							"us_nv",
							"us_nh",
							"us_nj",
							"us_nm",
							"us_ny",
							"us_nc",
							"us_nd",
							"us_oh",
							"us_ok",
							"us_or",
							"us_pa",
							"us_ri",
							"us_sc",
							"us_sd",
							"us_tn",
							"us_tx",
							"us_ut",
							"us_vt",
							"us_va",
							"us_wa",
							"us_wv",
							"us_wi",
							"us_wy",
							"it"
						]
					},
					"ruleVersion": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"claim",
							"predetermination"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"queued",
							"sent",
							"accepted",
							"rejected",
							"pending_info",
							"received",
							"paid",
							"partially_paid",
							"denied",
							"void",
							"resubmitted",
							"settled"
						]
					},
					"responsibility": {
						"type": "string",
						"enum": [
							"P",
							"S",
							"T"
						]
					},
					"secondaryOfClaimId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"priorSource": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"claim",
									"manual"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"placeOfTreatment": {
						"type": "string"
					},
					"billingPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"renderingPractitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"renderingCredentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"diagnosisCodes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"totalBilledCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"totalAllowedCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"totalPaidCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"totalWriteOffCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"patientPortionCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"payerClaimNumber": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"clearinghouse": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"stedi",
									"claim_md",
									"manual"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"clearinghouseRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"submittedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"receivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"paidAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"denialCodes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"attachmentsRequired": {
						"type": "boolean"
					},
					"orthoMonthsRemaining": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"lastEventId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"accountId",
					"accountMemberId",
					"coverageId",
					"planId",
					"benefitRevisionId",
					"locationId",
					"jurisdiction",
					"ruleVersion",
					"kind",
					"status",
					"responsibility",
					"secondaryOfClaimId",
					"priorSource",
					"placeOfTreatment",
					"billingPractitionerId",
					"renderingPractitionerId",
					"renderingCredentialRevisionId",
					"diagnosisCodes",
					"totalBilledCents",
					"totalAllowedCents",
					"totalPaidCents",
					"totalWriteOffCents",
					"patientPortionCents",
					"currency",
					"payerClaimNumber",
					"clearinghouse",
					"clearinghouseRef",
					"submittedAt",
					"receivedAt",
					"paidAt",
					"denialCodes",
					"note",
					"attachmentsRequired",
					"orthoMonthsRemaining",
					"lastEventId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"ClaimableProcedure": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"code": {
						"type": "string"
					},
					"description": {
						"type": "string"
					},
					"serviceDate": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"feeCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"units": {
						"type": "integer",
						"minimum": 1,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"tooth": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"surfaces": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"insuranceEstimateCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"benefitRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"code",
					"description",
					"serviceDate",
					"practitionerId",
					"locationId",
					"feeCents",
					"units",
					"currency",
					"tooth",
					"surfaces",
					"insuranceEstimateCents",
					"benefitRevisionId"
				],
				"additionalProperties": false
			},
			"InsuranceClaimItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"claimId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"procedureId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"chargeEntryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"procedureCodeSnapshot": {
						"type": "string"
					},
					"standardId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"edition": {
						"type": "string"
					},
					"standardSystem": {
						"type": "string"
					},
					"tooth": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"surfaces": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"serviceDate": {
						"type": "string"
					},
					"units": {
						"type": "integer",
						"minimum": 1,
						"maximum": 9007199254740991
					},
					"billedCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"benefitRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"estimateInsuranceCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"estimateDeductibleCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"estimatePatientCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"allowedCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"paidCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"deductibleAppliedCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"writeOffCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"patientPortionCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"remarkCodes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"status": {
						"type": "string",
						"enum": [
							"estimate",
							"not_received",
							"received",
							"supplemental",
							"denied"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"claimId",
					"patientId",
					"procedureId",
					"chargeEntryId",
					"procedureCodeSnapshot",
					"standardId",
					"edition",
					"standardSystem",
					"tooth",
					"surfaces",
					"serviceDate",
					"units",
					"billedCents",
					"benefitRevisionId",
					"estimateInsuranceCents",
					"estimateDeductibleCents",
					"estimatePatientCents",
					"allowedCents",
					"paidCents",
					"deductibleAppliedCents",
					"writeOffCents",
					"patientPortionCents",
					"currency",
					"remarkCodes",
					"status",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"InsuranceClaimEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"claimId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"fromStatus": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"draft",
									"queued",
									"sent",
									"accepted",
									"rejected",
									"pending_info",
									"received",
									"paid",
									"partially_paid",
									"denied",
									"void",
									"resubmitted",
									"settled"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"toStatus": {
						"type": "string",
						"enum": [
							"draft",
							"queued",
							"sent",
							"accepted",
							"rejected",
							"pending_info",
							"received",
							"paid",
							"partially_paid",
							"denied",
							"void",
							"resubmitted",
							"settled"
						]
					},
					"occurredAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"actorUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"actorSource": {
						"type": "string",
						"enum": [
							"user",
							"system",
							"provider"
						]
					},
					"reason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"amounts": {},
					"deliveryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ingressReceiptId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"claimId",
					"patientId",
					"fromStatus",
					"toStatus",
					"occurredAt",
					"actorUserId",
					"actorSource",
					"reason",
					"amounts",
					"deliveryId",
					"ingressReceiptId",
					"createdAt"
				],
				"additionalProperties": false
			},
			"InsuranceDeliveryResponse": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"deliveryId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"ingressReceiptId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string"
					},
					"receivedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"deliveryId",
					"ingressReceiptId",
					"kind",
					"receivedAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"InsuranceClaimAttachment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"claimId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientDocumentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"requirementType": {
						"type": "string",
						"enum": [
							"xray",
							"perio_chart",
							"narrative",
							"photo",
							"eob",
							"other"
						]
					},
					"neaNumber": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"submissionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"submissionKind": {
						"type": "string"
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"claimId",
					"patientId",
					"patientDocumentId",
					"requirementType",
					"neaNumber",
					"submissionId",
					"submissionKind",
					"sentAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"InsuranceClaimPriorAdjudicationRow": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"claimId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"revision": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"source": {
						"type": "string",
						"enum": [
							"claim",
							"manual"
						]
					},
					"payerOrder": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"payload": {
						"type": "object",
						"properties": {
							"payer": {
								"type": "object",
								"properties": {
									"payerId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 80
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 60
									},
									"claimControlNumber": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 50
											},
											{
												"type": "null"
											}
										]
									},
									"adjudicationDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"responsibility": {
										"type": "string",
										"enum": [
											"P",
											"S"
										]
									}
								},
								"required": [
									"payerId",
									"name",
									"claimControlNumber",
									"adjudicationDate",
									"responsibility"
								],
								"additionalProperties": false
							},
							"subscriber": {
								"type": "object",
								"properties": {
									"lastName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 60
									},
									"firstName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 35
									},
									"memberId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 80
											},
											{
												"type": "null"
											}
										]
									},
									"relationshipCode": {
										"type": "string",
										"enum": [
											"18",
											"19",
											"01",
											"G8"
										]
									},
									"groupNumber": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 50
											},
											{
												"type": "null"
											}
										]
									},
									"assignmentIndicator": {
										"type": "string",
										"enum": [
											"Y",
											"N"
										]
									},
									"releaseCode": {
										"type": "string",
										"enum": [
											"Y",
											"I"
										]
									}
								},
								"required": [
									"lastName",
									"firstName",
									"memberId",
									"relationshipCode",
									"groupNumber",
									"assignmentIndicator",
									"releaseCode"
								],
								"additionalProperties": false
							},
							"claim": {
								"type": "object",
								"properties": {
									"paidCents": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"adjustments": {
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"group": {
													"type": "string",
													"minLength": 1,
													"maxLength": 2
												},
												"reason": {
													"type": "string",
													"minLength": 1,
													"maxLength": 5
												},
												"amountCents": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"group",
												"reason",
												"amountCents"
											],
											"additionalProperties": false
										}
									},
									"patientLiabilityCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"paidCents",
									"adjustments",
									"patientLiabilityCents"
								],
								"additionalProperties": false
							},
							"items": {
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"procedureId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedureCode": {
											"type": "string",
											"minLength": 1,
											"maxLength": 48
										},
										"paidCents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"units": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"adjustments": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"group": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2
													},
													"reason": {
														"type": "string",
														"minLength": 1,
														"maxLength": 5
													},
													"amountCents": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"group",
													"reason",
													"amountCents"
												],
												"additionalProperties": false
											}
										},
										"patientLiabilityCents": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"date": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										}
									},
									"required": [
										"procedureId",
										"procedureCode",
										"paidCents",
										"units",
										"adjustments",
										"patientLiabilityCents",
										"date"
									],
									"additionalProperties": false
								}
							}
						},
						"required": [
							"payer",
							"subscriber",
							"claim",
							"items"
						],
						"additionalProperties": false
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"claimId",
					"patientId",
					"revision",
					"source",
					"payerOrder",
					"payload",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"InsuranceEligibilityCheck": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"coverageId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"planId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"requestedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"transport": {
						"type": "string",
						"enum": [
							"clearinghouse_270",
							"payer_portal",
							"manual"
						]
					},
					"requestSubmissionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"requestKind": {
						"type": "string"
					},
					"benefitRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ingressReceiptId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"pending",
							"received",
							"failed",
							"parked"
						]
					},
					"receivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"failedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"eligible": {
						"anyOf": [
							{
								"type": "boolean"
							},
							{
								"type": "null"
							}
						]
					},
					"result": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"coverageId",
					"planId",
					"requestedAt",
					"transport",
					"requestSubmissionId",
					"requestKind",
					"benefitRevisionId",
					"ingressReceiptId",
					"status",
					"receivedAt",
					"failedAt",
					"parkedAt",
					"eligible",
					"result",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"NhsBandRate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"nation": {
						"type": "string",
						"enum": [
							"england",
							"wales",
							"scotland",
							"northern_ireland"
						]
					},
					"band": {
						"type": "string",
						"enum": [
							"1",
							"3",
							"2a",
							"2b",
							"2c",
							"urgent",
							"reg11",
							"fluoride_varnish",
							"ortho_assess",
							"ortho_treat",
							"free_repair"
						]
					},
					"effectiveFrom": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"effectiveTo": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"patientChargeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"activityValue": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"providerRemunerationCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"formVersion": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"sourceId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"nation",
					"band",
					"effectiveFrom",
					"effectiveTo",
					"patientChargeCents",
					"activityValue",
					"providerRemunerationCents",
					"currency",
					"formVersion",
					"sourceId",
					"createdAt"
				],
				"additionalProperties": false
			},
			"NhsDatasetRule": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"nation": {
						"type": "string",
						"enum": [
							"england",
							"wales",
							"scotland",
							"northern_ireland"
						]
					},
					"formVersion": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"clinical_item",
							"exemption_code",
							"remission_code",
							"ethnicity_code",
							"band_rule"
						]
					},
					"code": {
						"type": "string"
					},
					"name": {
						"type": "string"
					},
					"allowedBands": {
						"anyOf": [
							{
								"type": "array",
								"items": {
									"type": "string"
								}
							},
							{
								"type": "null"
							}
						]
					},
					"requiresTooth": {
						"type": "boolean"
					},
					"effectiveFrom": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"effectiveTo": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"sourceId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"nation",
					"formVersion",
					"kind",
					"code",
					"name",
					"allowedBands",
					"requiresTooth",
					"effectiveFrom",
					"effectiveTo",
					"sourceId",
					"createdAt"
				],
				"additionalProperties": false
			},
			"NhsRuleSource": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"title": {
						"type": "string"
					},
					"url": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"capturedAt": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"evidencePath": {
						"type": "string"
					},
					"digest": {
						"type": "string"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"title",
					"url",
					"capturedAt",
					"evidencePath",
					"digest",
					"createdAt"
				],
				"additionalProperties": false
			},
			"NhsContract": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"contractNumber": {
						"type": "string"
					},
					"nhsLocationNumber": {
						"type": "string"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"gds",
							"pds",
							"pds_plus",
							"ortho",
							"other"
						]
					},
					"startOn": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"endOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"name": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"notes": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"active": {
						"type": "boolean"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"contractNumber",
					"nhsLocationNumber",
					"locationId",
					"kind",
					"startOn",
					"endOn",
					"name",
					"notes",
					"active",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"NhsContractYear": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"contractId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"yearStart": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"yearEnd": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"udaTarget": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"uoaTarget": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"udaValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"uoaValueCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"source": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"contractId",
					"yearStart",
					"yearEnd",
					"udaTarget",
					"uoaTarget",
					"udaValueCents",
					"uoaValueCents",
					"currency",
					"source",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"NhsPerformerTarget": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"contractId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"practitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"performerNumber": {
						"type": "string"
					},
					"udaTarget": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"uoaTarget": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"isVt": {
						"type": "boolean"
					},
					"defaultForPractitioner": {
						"type": "boolean"
					},
					"from": {
						"type": "string",
						"format": "date",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
					},
					"to": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"contractId",
					"practitionerId",
					"performerNumber",
					"udaTarget",
					"uoaTarget",
					"isVt",
					"defaultForPractitioner",
					"from",
					"to",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"NhsScheduleView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"ingressReceiptId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"contractId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"scheduleMonth": {
						"type": "string"
					},
					"importedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"totalAwardedUda": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"totalAwardedCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lines": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/NhsScheduleLine"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"ingressReceiptId",
					"contractId",
					"scheduleMonth",
					"importedAt",
					"totalAwardedUda",
					"totalAwardedCents",
					"currency",
					"createdAt",
					"lines"
				],
				"additionalProperties": false
			},
			"NhsScheduleLine": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"scheduleId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"contractId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"lineRef": {
						"type": "string"
					},
					"claimId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"nhsbsaReference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"awardedUda": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"awardedCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"disputeFlag": {
						"type": "boolean"
					},
					"matchedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"scheduleId",
					"contractId",
					"lineRef",
					"claimId",
					"nhsbsaReference",
					"awardedUda",
					"awardedCents",
					"currency",
					"disputeFlag",
					"matchedAt",
					"parkedAt",
					"parkedReason",
					"createdAt"
				],
				"additionalProperties": false
			},
			"NhsPatientDetails": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"exemptionCodeRuleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"exemptionRuleKind": {
						"type": "string"
					},
					"exemptionEvidenceSeen": {
						"type": "boolean"
					},
					"exemptionEvidenceAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"exemptionExpiresOn": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"remissionCodeRuleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"remissionRuleKind": {
						"type": "string"
					},
					"consentToContact": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"exemptionCodeRuleId",
					"exemptionRuleKind",
					"exemptionEvidenceSeen",
					"exemptionEvidenceAt",
					"exemptionExpiresOn",
					"remissionCodeRuleId",
					"remissionRuleKind",
					"consentToContact",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"NhsPatientIdentifier": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"nhs_number",
							"chi_number",
							"hc_number"
						]
					},
					"jurisdiction": {
						"type": "string",
						"enum": [
							"unsupported",
							"gb_england",
							"gb_wales",
							"gb_scotland",
							"gb_northern_ireland",
							"us_al",
							"us_ak",
							"us_az",
							"us_ar",
							"us_ca",
							"us_co",
							"us_ct",
							"us_de",
							"us_dc",
							"us_fl",
							"us_ga",
							"us_hi",
							"us_id",
							"us_il",
							"us_in",
							"us_ia",
							"us_ks",
							"us_ky",
							"us_la",
							"us_me",
							"us_md",
							"us_ma",
							"us_mi",
							"us_mn",
							"us_ms",
							"us_mo",
							"us_mt",
							"us_ne",
							"us_nv",
							"us_nh",
							"us_nj",
							"us_nm",
							"us_ny",
							"us_nc",
							"us_nd",
							"us_oh",
							"us_ok",
							"us_or",
							"us_pa",
							"us_ri",
							"us_sc",
							"us_sd",
							"us_tn",
							"us_tx",
							"us_ut",
							"us_vt",
							"us_va",
							"us_wa",
							"us_wv",
							"us_wi",
							"us_wy",
							"it"
						]
					},
					"ruleVersion": {
						"type": "string"
					},
					"value": {
						"type": "string"
					},
					"verifiedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"verifiedSource": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"supersededAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"kind",
					"jurisdiction",
					"ruleVersion",
					"value",
					"verifiedAt",
					"verifiedSource",
					"supersededAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"NhsCourseView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"treatmentPlanId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"contractId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"jurisdiction": {
						"type": "string",
						"enum": [
							"unsupported",
							"gb_england",
							"gb_wales",
							"gb_scotland",
							"gb_northern_ireland",
							"us_al",
							"us_ak",
							"us_az",
							"us_ar",
							"us_ca",
							"us_co",
							"us_ct",
							"us_de",
							"us_dc",
							"us_fl",
							"us_ga",
							"us_hi",
							"us_id",
							"us_il",
							"us_in",
							"us_ia",
							"us_ks",
							"us_ky",
							"us_la",
							"us_me",
							"us_md",
							"us_ma",
							"us_mi",
							"us_mn",
							"us_ms",
							"us_mo",
							"us_mt",
							"us_ne",
							"us_nv",
							"us_nh",
							"us_nj",
							"us_nm",
							"us_ny",
							"us_nc",
							"us_nd",
							"us_oh",
							"us_ok",
							"us_or",
							"us_pa",
							"us_ri",
							"us_sc",
							"us_sd",
							"us_tn",
							"us_tx",
							"us_ut",
							"us_vt",
							"us_va",
							"us_wa",
							"us_wv",
							"us_wi",
							"us_wy",
							"it"
						]
					},
					"ruleVersion": {
						"type": "string"
					},
					"performerTargetId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"performerPractitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"performerCredentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"nation": {
						"type": "string",
						"enum": [
							"england",
							"wales",
							"scotland",
							"northern_ireland"
						]
					},
					"formVersion": {
						"type": "string"
					},
					"band": {
						"type": "string",
						"enum": [
							"1",
							"3",
							"2a",
							"2b",
							"2c",
							"urgent",
							"reg11",
							"fluoride_varnish",
							"ortho_assess",
							"ortho_treat",
							"free_repair"
						]
					},
					"bandRateId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientChargeCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"acceptedOn": {
						"type": "string"
					},
					"completedOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"exemptionRuleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"exemptionRuleKind": {
						"type": "string"
					},
					"exemptionEvidenceSnapshot": {
						"type": "boolean"
					},
					"continuationOfCourseId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"recallIntervalMonths": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"highestBpeSextant": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"0",
									"1",
									"2",
									"3",
									"4",
									"X"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"untreatedDecayedTeeth": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"bestPracticePrevention": {
						"type": "boolean"
					},
					"aerosolAppointments": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"dmf": {},
					"referralToOtherProvider": {
						"type": "boolean"
					},
					"sedation": {
						"type": "boolean"
					},
					"notes": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"sealedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"sealedBySubmissionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"items": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"courseId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"datasetRuleId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"organizationId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
									"description": "Canonical lowercase UUID organization identifier"
								},
								"nation": {
									"type": "string",
									"enum": [
										"england",
										"wales",
										"scotland",
										"northern_ireland"
									]
								},
								"formVersion": {
									"type": "string"
								},
								"ruleKind": {
									"type": "string"
								},
								"quantity": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"tooth": {
									"anyOf": [
										{
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										{
											"type": "null"
										}
									]
								},
								"patientId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"procedureId": {
									"anyOf": [
										{
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										{
											"type": "null"
										}
									]
								},
								"createdAt": {
									"type": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
								},
								"updatedAt": {
									"type": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
								},
								"code": {
									"type": "string"
								},
								"name": {
									"type": "string"
								}
							},
							"required": [
								"courseId",
								"datasetRuleId",
								"organizationId",
								"nation",
								"formVersion",
								"ruleKind",
								"quantity",
								"tooth",
								"patientId",
								"procedureId",
								"createdAt",
								"updatedAt",
								"code",
								"name"
							],
							"additionalProperties": false
						}
					},
					"claims": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/NhsClaim"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"treatmentPlanId",
					"patientId",
					"contractId",
					"locationId",
					"jurisdiction",
					"ruleVersion",
					"performerTargetId",
					"performerPractitionerId",
					"performerCredentialRevisionId",
					"nation",
					"formVersion",
					"band",
					"bandRateId",
					"patientChargeCents",
					"currency",
					"acceptedOn",
					"completedOn",
					"exemptionRuleId",
					"exemptionRuleKind",
					"exemptionEvidenceSnapshot",
					"continuationOfCourseId",
					"recallIntervalMonths",
					"highestBpeSextant",
					"untreatedDecayedTeeth",
					"bestPracticePrevention",
					"aerosolAppointments",
					"dmf",
					"referralToOtherProvider",
					"sedation",
					"notes",
					"sealedAt",
					"sealedBySubmissionId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"items",
					"claims"
				],
				"additionalProperties": false
			},
			"NhsClaim": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"courseId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"contractId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"jurisdiction": {
						"type": "string",
						"enum": [
							"unsupported",
							"gb_england",
							"gb_wales",
							"gb_scotland",
							"gb_northern_ireland",
							"us_al",
							"us_ak",
							"us_az",
							"us_ar",
							"us_ca",
							"us_co",
							"us_ct",
							"us_de",
							"us_dc",
							"us_fl",
							"us_ga",
							"us_hi",
							"us_id",
							"us_il",
							"us_in",
							"us_ia",
							"us_ks",
							"us_ky",
							"us_la",
							"us_me",
							"us_md",
							"us_ma",
							"us_mi",
							"us_mn",
							"us_ms",
							"us_mo",
							"us_mt",
							"us_ne",
							"us_nv",
							"us_nh",
							"us_nj",
							"us_nm",
							"us_ny",
							"us_nc",
							"us_nd",
							"us_oh",
							"us_ok",
							"us_or",
							"us_pa",
							"us_ri",
							"us_sc",
							"us_sd",
							"us_tn",
							"us_tx",
							"us_ut",
							"us_vt",
							"us_va",
							"us_wa",
							"us_wv",
							"us_wi",
							"us_wy",
							"it"
						]
					},
					"ruleVersion": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"fp17"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"new",
							"queued",
							"submitted",
							"received",
							"completed",
							"queried",
							"error",
							"invalid",
							"withdrawn"
						]
					},
					"nhsbsaReference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"expectedUda": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"awardedUda": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"patientChargeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"providerRemunerationCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"transport": {
						"type": "string",
						"enum": [
							"manual_compass"
						]
					},
					"currentSubmissionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"responseCodes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"statusComments": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"nhsUpdatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastEventId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"courseId",
					"patientId",
					"contractId",
					"locationId",
					"jurisdiction",
					"ruleVersion",
					"kind",
					"status",
					"nhsbsaReference",
					"expectedUda",
					"awardedUda",
					"patientChargeCents",
					"providerRemunerationCents",
					"currency",
					"transport",
					"currentSubmissionId",
					"responseCodes",
					"statusComments",
					"nhsUpdatedAt",
					"lastEventId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"NhsClaimEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"claimId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"fromStatus": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"new",
									"queued",
									"submitted",
									"received",
									"completed",
									"queried",
									"error",
									"invalid",
									"withdrawn"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"toStatus": {
						"type": "string",
						"enum": [
							"new",
							"queued",
							"submitted",
							"received",
							"completed",
							"queried",
							"error",
							"invalid",
							"withdrawn"
						]
					},
					"occurredAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"actorUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"actorSource": {
						"type": "string",
						"enum": [
							"user",
							"system",
							"provider"
						]
					},
					"reason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"amounts": {},
					"deliveryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"scheduleLineId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ingressReceiptId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"claimId",
					"patientId",
					"fromStatus",
					"toStatus",
					"occurredAt",
					"actorUserId",
					"actorSource",
					"reason",
					"amounts",
					"deliveryId",
					"scheduleLineId",
					"ingressReceiptId",
					"createdAt"
				],
				"additionalProperties": false
			},
			"NhsClaimDeliveryResponse": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"deliveryId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"ingressReceiptId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"bundle_ack",
							"claim_response"
						]
					},
					"receivedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"deliveryId",
					"ingressReceiptId",
					"kind",
					"receivedAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ProfessionalContact": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"kind": {
						"type": "string",
						"enum": [
							"referrer",
							"lab",
							"specialist",
							"gp",
							"other"
						]
					},
					"displayName": {
						"type": "string"
					},
					"practiceName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"registrationRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"email": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"phone": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine1": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"addressLine2": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"city": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"province": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"postalCode": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"country": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"kind",
					"displayName",
					"practiceName",
					"registrationRef",
					"email",
					"phone",
					"addressLine1",
					"addressLine2",
					"city",
					"province",
					"postalCode",
					"country",
					"note",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"PrescriptionView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"prescriberPractitionerId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"credentialRevisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"jurisdiction": {
						"type": "string",
						"enum": [
							"unsupported",
							"gb_england",
							"gb_wales",
							"gb_scotland",
							"gb_northern_ireland",
							"us_al",
							"us_ak",
							"us_az",
							"us_ar",
							"us_ca",
							"us_co",
							"us_ct",
							"us_de",
							"us_dc",
							"us_fl",
							"us_ga",
							"us_hi",
							"us_id",
							"us_il",
							"us_in",
							"us_ia",
							"us_ks",
							"us_ky",
							"us_la",
							"us_me",
							"us_md",
							"us_ma",
							"us_mi",
							"us_mn",
							"us_ms",
							"us_mo",
							"us_mt",
							"us_ne",
							"us_nv",
							"us_nh",
							"us_nj",
							"us_nm",
							"us_ny",
							"us_nc",
							"us_nd",
							"us_oh",
							"us_ok",
							"us_or",
							"us_pa",
							"us_ri",
							"us_sc",
							"us_sd",
							"us_tn",
							"us_tx",
							"us_ut",
							"us_vt",
							"us_va",
							"us_wa",
							"us_wv",
							"us_wi",
							"us_wy",
							"it"
						]
					},
					"ruleVersion": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"nhs_fp10d",
							"private",
							"us_state"
						]
					},
					"route": {
						"type": "string",
						"enum": [
							"print",
							"electronic",
							"print_and_electronic"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"issued",
							"void"
						]
					},
					"issuedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"documentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"voidedByPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidCredentialRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"voidReauthenticatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"authoringSource": {
						"type": "string",
						"enum": [
							"staff",
							"ai_draft",
							"import",
							"pms_sync",
							"migration"
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"prescriberName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"clinicalDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"items": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PrescriptionItem"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"prescriberPractitionerId",
					"credentialRevisionId",
					"locationId",
					"jurisdiction",
					"ruleVersion",
					"kind",
					"route",
					"status",
					"issuedAt",
					"reauthenticatedAt",
					"documentId",
					"voidedAt",
					"voidReason",
					"voidedByPractitionerId",
					"voidCredentialRevisionId",
					"voidReauthenticatedAt",
					"note",
					"authoringSource",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"prescriberName",
					"clinicalDocumentId",
					"items"
				],
				"additionalProperties": false
			},
			"PrescriptionItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"prescriptionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"drugName": {
						"type": "string"
					},
					"standardId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"codeSnapshot": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"form": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"strength": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"dose": {
						"type": "string"
					},
					"quantity": {
						"type": "string"
					},
					"directions": {
						"type": "string"
					},
					"refills": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"controlledSubstance": {
						"type": "boolean"
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"prescriptionId",
					"patientId",
					"drugName",
					"standardId",
					"codeSnapshot",
					"form",
					"strength",
					"dose",
					"quantity",
					"directions",
					"refills",
					"controlledSubstance",
					"position",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"LabCaseView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"procedureId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentPlanId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"labContactId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"created",
							"sent",
							"received",
							"fitted",
							"returned",
							"cancelled"
						]
					},
					"sentOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"dueOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"receivedOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fittedOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"returnedOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"shade": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"enclosures": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"labReference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"labFeeCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"labSlipDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"resendOfLabCaseId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"labName": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"procedureId",
					"treatmentPlanId",
					"labContactId",
					"appointmentId",
					"status",
					"sentOn",
					"dueOn",
					"receivedOn",
					"fittedOn",
					"returnedOn",
					"shade",
					"enclosures",
					"labReference",
					"labFeeCents",
					"currency",
					"note",
					"labSlipDocumentId",
					"resendOfLabCaseId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"labName"
				],
				"additionalProperties": false
			},
			"ClinicalReferralView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"direction": {
						"type": "string",
						"enum": [
							"outbound",
							"inbound"
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"private_in_group",
							"private_in_house",
							"private_external",
							"nhs_external"
						]
					},
					"fromPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"toPractitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"toContactId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"fromContactId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"procedureId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reason": {
						"type": "string"
					},
					"urgency": {
						"type": "string",
						"enum": [
							"routine",
							"urgent",
							"two_week_wait"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"submitted",
							"accepted",
							"booked",
							"completed",
							"rejected",
							"cancelled"
						]
					},
					"nhsUrn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"letterDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"submittedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"outcomeNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"toName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fromName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"direction",
					"kind",
					"fromPractitionerId",
					"toPractitionerId",
					"toContactId",
					"fromContactId",
					"procedureId",
					"reason",
					"urgency",
					"status",
					"nhsUrn",
					"letterDocumentId",
					"submittedAt",
					"completedAt",
					"outcomeNote",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"toName",
					"fromName"
				],
				"additionalProperties": false
			},
			"LetterTemplate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"recall",
							"referral",
							"estimate",
							"statement_cover",
							"custom"
						]
					},
					"body": {
						"type": "string"
					},
					"mergeFields": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"version": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"kind",
					"body",
					"mergeFields",
					"version",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"GeneratedLetterView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"templateId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"templateVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"renderedDocumentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"delivery": {
						"type": "string",
						"enum": [
							"print",
							"email",
							"sms_link",
							"post"
						]
					},
					"messageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"amendsLetterId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"templateName": {
						"type": "string"
					},
					"clinicalDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"templateId",
					"templateVersion",
					"renderedDocumentId",
					"delivery",
					"messageId",
					"sentAt",
					"amendsLetterId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"templateName",
					"clinicalDocumentId"
				],
				"additionalProperties": false
			},
			"WaitlistRequestView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"asap",
							"short_notice",
							"referral_to_treatment"
						]
					},
					"treatmentPlanId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentTypeId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"earliestOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"latestOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"priority": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"offered",
							"booked",
							"withdrawn"
						]
					},
					"bookedAppointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"patientName": {
						"type": "string"
					},
					"practitionerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"appointmentTypeName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"kind",
					"treatmentPlanId",
					"appointmentTypeId",
					"practitionerId",
					"locationId",
					"earliestOn",
					"latestOn",
					"priority",
					"status",
					"bookedAppointmentId",
					"note",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"patientName",
					"practitionerName",
					"appointmentTypeName"
				],
				"additionalProperties": false
			},
			"TreatmentTemplate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"name": {
						"type": "string"
					},
					"treatmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"name",
					"treatmentId",
					"archivedAt",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"TreatmentTemplateItemView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"templateId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"procedureCodeId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"codeIsAct": {
						"type": "boolean"
					},
					"quantity": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"visitPosition": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"code": {
						"type": "string"
					},
					"name": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"organizationId",
					"templateId",
					"procedureCodeId",
					"codeIsAct",
					"quantity",
					"visitPosition",
					"position",
					"createdAt",
					"updatedAt",
					"code",
					"name"
				],
				"additionalProperties": false
			},
			"Statement": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"accountMemberId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"account",
							"patient"
						]
					},
					"periodStart": {
						"type": "string"
					},
					"periodEnd": {
						"type": "string"
					},
					"balanceCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"pleasePayCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"aging": {},
					"dunningLevel": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"documentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"delivery": {
						"type": "string",
						"enum": [
							"print",
							"email",
							"sms_link",
							"portal"
						]
					},
					"messageId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"generatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"feeEntryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"accountId",
					"patientId",
					"accountMemberId",
					"kind",
					"periodStart",
					"periodEnd",
					"balanceCents",
					"pleasePayCents",
					"currency",
					"aging",
					"dunningLevel",
					"documentId",
					"delivery",
					"messageId",
					"generatedAt",
					"feeEntryId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"MembershipSubscriptionView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountMemberId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"priceListId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"band": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"monthlyFeeCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"providerRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"startsOn": {
						"type": "string"
					},
					"endsOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"lapsed",
							"cancelled"
						]
					},
					"lastChargedOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"assessment": {},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"priceListName": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"organizationId",
					"patientId",
					"accountId",
					"accountMemberId",
					"priceListId",
					"band",
					"monthlyFeeCents",
					"currency",
					"providerRef",
					"startsOn",
					"endsOn",
					"status",
					"lastChargedOn",
					"assessment",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"priceListName"
				],
				"additionalProperties": false
			},
			"PaymentPlanView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"accountMemberId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"in_house",
							"finance_company"
						]
					},
					"financeContactId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"treatmentPlanId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"totalCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"depositCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"instalmentCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"interval": {
						"type": "string",
						"enum": [
							"weekly",
							"biweekly",
							"monthly",
							"quarterly"
						]
					},
					"instalmentCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"interestRateBp": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"startsOn": {
						"type": "string"
					},
					"status": {
						"type": "string",
						"enum": [
							"draft",
							"active",
							"completed",
							"defaulted",
							"cancelled"
						]
					},
					"agreementDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"activatedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"closedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"instalments": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"organizationId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
									"description": "Canonical lowercase UUID organization identifier"
								},
								"paymentPlanId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"accountId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"sequence": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"dueOn": {
									"type": "string"
								},
								"amountCents": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"currency": {
									"type": "string",
									"enum": [
										"EUR",
										"GBP",
										"USD"
									]
								},
								"settledCents": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"waivedAt": {
									"anyOf": [
										{
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										{
											"type": "null"
										}
									]
								},
								"waivedById": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"waiveReason": {
									"anyOf": [
										{
											"type": "string"
										},
										{
											"type": "null"
										}
									]
								},
								"createdAt": {
									"type": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
								},
								"updatedAt": {
									"type": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
								},
								"status": {
									"type": "string",
									"enum": [
										"waived",
										"paid",
										"partial",
										"missed",
										"due"
									]
								}
							},
							"required": [
								"id",
								"organizationId",
								"paymentPlanId",
								"accountId",
								"sequence",
								"dueOn",
								"amountCents",
								"currency",
								"settledCents",
								"waivedAt",
								"waivedById",
								"waiveReason",
								"createdAt",
								"updatedAt",
								"status"
							],
							"additionalProperties": false
						}
					},
					"allocations": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/InstalmentAllocation"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"accountId",
					"patientId",
					"accountMemberId",
					"locationId",
					"kind",
					"financeContactId",
					"treatmentPlanId",
					"totalCents",
					"depositCents",
					"instalmentCents",
					"currency",
					"interval",
					"instalmentCount",
					"interestRateBp",
					"startsOn",
					"status",
					"agreementDocumentId",
					"activatedAt",
					"closedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"instalments",
					"allocations"
				],
				"additionalProperties": false
			},
			"InstalmentAllocation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"instalmentId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"paymentPlanId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"ledgerEntryId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"amountCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"allocatedOn": {
						"type": "string"
					},
					"reversesAllocationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"instalmentId",
					"paymentPlanId",
					"ledgerEntryId",
					"amountCents",
					"currency",
					"allocatedOn",
					"reversesAllocationId",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"TillSessionView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"openedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"closedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"closedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"closedByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"openingFloatCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"countedCashCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"expectedCashCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"varianceCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"terminalSettlementRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"bankDepositRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"open",
							"closed",
							"reconciled"
						]
					},
					"reconciledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"reconciledById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"reconciledByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"locationName": {
						"type": "string"
					},
					"cashMovementCents": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"entries": {
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"organizationId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
									"description": "Canonical lowercase UUID organization identifier"
								},
								"sessionId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"locationId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"ledgerEntryId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"paymentMethodKind": {
									"type": "string",
									"enum": [
										"cash",
										"card",
										"terminal",
										"bank_transfer",
										"cheque",
										"online",
										"finance",
										"other"
									]
								},
								"amountCents": {
									"type": "integer",
									"minimum": -9007199254740991,
									"maximum": 9007199254740991
								},
								"currency": {
									"type": "string",
									"enum": [
										"EUR",
										"GBP",
										"USD"
									]
								},
								"createdAt": {
									"type": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
								},
								"patientId": {
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								"patientName": {
									"type": "string"
								},
								"entryKind": {
									"type": "string"
								},
								"entryDate": {
									"type": "string"
								}
							},
							"required": [
								"id",
								"organizationId",
								"sessionId",
								"locationId",
								"ledgerEntryId",
								"paymentMethodKind",
								"amountCents",
								"currency",
								"createdAt",
								"patientId",
								"patientName",
								"entryKind",
								"entryDate"
							],
							"additionalProperties": false
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"openedAt",
					"closedAt",
					"closedById",
					"closedByName",
					"openingFloatCents",
					"countedCashCents",
					"expectedCashCents",
					"varianceCents",
					"currency",
					"terminalSettlementRef",
					"bankDepositRef",
					"status",
					"reconciledAt",
					"reconciledById",
					"reconciledByName",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"locationName",
					"cashMovementCents",
					"entries"
				],
				"additionalProperties": false
			},
			"AccountingConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"provider": {
						"type": "string",
						"enum": [
							"xero",
							"quickbooks"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"connecting",
							"active",
							"paused",
							"error",
							"disconnected"
						]
					},
					"credentialGeneration": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"externalCompanyId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalCompanyName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"settings": {},
					"lastSyncAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"builtThroughDate": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"provider",
					"status",
					"credentialGeneration",
					"externalCompanyId",
					"externalCompanyName",
					"settings",
					"lastSyncAt",
					"lastError",
					"builtThroughDate",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AccountingAccountMapping": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"revenue_by_category",
							"payment_method",
							"bank_account",
							"deposits_held",
							"refunds",
							"write_offs",
							"patient_liability",
							"vat_exempt",
							"vat_standard",
							"stamp_duty"
						]
					},
					"procedureCategoryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"paymentMethodId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalAccountId": {
						"type": "string"
					},
					"externalAccountName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalTaxRateId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"connectionId",
					"kind",
					"procedureCategoryId",
					"paymentMethodId",
					"locationId",
					"externalAccountId",
					"externalAccountName",
					"externalTaxRateId",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AccountingJournalView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"periodDate": {
						"type": "string"
					},
					"generation": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"kind": {
						"type": "string",
						"enum": [
							"daily_journal",
							"reversal"
						]
					},
					"reversesRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ledgerDigest": {
						"type": "string"
					},
					"carriedIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"payload": {},
					"payloadDigest": {
						"type": "string"
					},
					"idempotencyKey": {
						"type": "string"
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"credentialGeneration": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deadlineAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"locationName": {
						"type": "string"
					},
					"deliveries": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/AccountingDelivery"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"connectionId",
					"locationId",
					"periodDate",
					"generation",
					"kind",
					"reversesRevisionId",
					"ledgerDigest",
					"carriedIds",
					"payload",
					"payloadDigest",
					"idempotencyKey",
					"currency",
					"credentialGeneration",
					"attemptCount",
					"lastAttemptAt",
					"deadlineAt",
					"parkedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"locationName",
					"deliveries"
				],
				"additionalProperties": false
			},
			"AccountingDelivery": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"revisionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"attempt": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"consumedAttempt": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"credentialGeneration": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"state": {
						"type": "string",
						"enum": [
							"claimed",
							"sent",
							"acked",
							"rejected",
							"parked"
						]
					},
					"leaseToken": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deadlineAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"responseIngressReceiptId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"responseCodes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"revisionId",
					"connectionId",
					"attempt",
					"consumedAttempt",
					"credentialGeneration",
					"state",
					"leaseToken",
					"leaseExpiresAt",
					"deadlineAt",
					"sentAt",
					"externalId",
					"responseIngressReceiptId",
					"responseCodes",
					"parkedAt",
					"parkedReason",
					"lastError",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"AccountingJournalRevision": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"connectionId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"periodDate": {
						"type": "string"
					},
					"generation": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"kind": {
						"type": "string",
						"enum": [
							"daily_journal",
							"reversal"
						]
					},
					"reversesRevisionId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"ledgerDigest": {
						"type": "string"
					},
					"carriedIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
						}
					},
					"payload": {},
					"payloadDigest": {
						"type": "string"
					},
					"idempotencyKey": {
						"type": "string"
					},
					"currency": {
						"type": "string",
						"enum": [
							"EUR",
							"GBP",
							"USD"
						]
					},
					"credentialGeneration": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastAttemptAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"deadlineAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"parkedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"connectionId",
					"locationId",
					"periodDate",
					"generation",
					"kind",
					"reversesRevisionId",
					"ledgerDigest",
					"carriedIds",
					"payload",
					"payloadDigest",
					"idempotencyKey",
					"currency",
					"credentialGeneration",
					"attemptCount",
					"lastAttemptAt",
					"deadlineAt",
					"parkedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"StaffRecord": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"userId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"staffName": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"registration",
							"indemnity",
							"dbs_check",
							"immunisation",
							"training",
							"licence",
							"dea",
							"cpr",
							"radiography",
							"safeguarding",
							"other"
						]
					},
					"title": {
						"type": "string"
					},
					"reference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"issuer": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"issuedOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"expiresOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"documentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reminderDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"userId",
					"practitionerId",
					"staffName",
					"kind",
					"title",
					"reference",
					"issuer",
					"issuedOn",
					"expiresOn",
					"documentId",
					"reminderDays",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"CompliancePolicyView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"key": {
						"type": "string"
					},
					"version": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"title": {
						"type": "string"
					},
					"category": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"body": {},
					"bodyText": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"documentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"reviewDueOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"publishedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"publishedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"supersedesPolicyId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"requiresAcknowledgement": {
						"type": "boolean"
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"acknowledgements": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/PolicyAcknowledgement"
						}
					},
					"acknowledgedByMe": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"organizationId",
					"key",
					"version",
					"title",
					"category",
					"body",
					"bodyText",
					"documentId",
					"reviewDueOn",
					"publishedAt",
					"publishedById",
					"supersedesPolicyId",
					"requiresAcknowledgement",
					"archivedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"acknowledgements",
					"acknowledgedByMe"
				],
				"additionalProperties": false
			},
			"PolicyAcknowledgement": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"policyId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"policyVersion": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"userId": {
						"type": "string"
					},
					"acknowledgedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"signatureDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"policyId",
					"policyVersion",
					"userId",
					"acknowledgedAt",
					"signatureDocumentId",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ComplianceCheckView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"kind": {
						"type": "string",
						"enum": [
							"autoclave_cycle",
							"daily_test",
							"spore_test",
							"equipment",
							"fire",
							"first_aid",
							"fridge_temperature",
							"xray_qa",
							"audit",
							"custom"
						]
					},
					"title": {
						"type": "string"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"intervalDays": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"assigneeUserId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"fields": {},
					"active": {
						"type": "boolean"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lastEntry": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ComplianceCheckEntry"
							},
							{
								"type": "null"
							}
						]
					},
					"nextDueOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"organizationId",
					"kind",
					"title",
					"locationId",
					"intervalDays",
					"assigneeUserId",
					"fields",
					"active",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt",
					"lastEntry",
					"nextDueOn"
				],
				"additionalProperties": false
			},
			"ComplianceCheckEntry": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"checkId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"dueOn": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"completedById": {
						"type": "string"
					},
					"values": {},
					"outcome": {
						"type": "string",
						"enum": [
							"pass",
							"fail",
							"na"
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"documentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"taskId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"sterilisationCycleId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"checkId",
					"locationId",
					"dueOn",
					"completedAt",
					"completedById",
					"values",
					"outcome",
					"note",
					"documentId",
					"taskId",
					"sterilisationCycleId",
					"createdAt"
				],
				"additionalProperties": false
			},
			"ComplianceIncident": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"kind": {
						"type": "string",
						"enum": [
							"clinical",
							"safeguarding",
							"data_breach",
							"injury",
							"equipment",
							"complaint",
							"other"
						]
					},
					"title": {
						"type": "string"
					},
					"description": {
						"type": "string"
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"occurredAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"reportedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"reportedById": {
						"type": "string"
					},
					"patientId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"severity": {
						"type": "string",
						"enum": [
							"low",
							"medium",
							"high",
							"critical"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"reported",
							"investigating",
							"closed"
						]
					},
					"investigationNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"rootCause": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"actionsTaken": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"externalReference": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"reportedExternallyAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"closedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"closedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"documentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"kind",
					"title",
					"description",
					"locationId",
					"occurredAt",
					"reportedAt",
					"reportedById",
					"patientId",
					"severity",
					"status",
					"investigationNote",
					"rootCause",
					"actionsTaken",
					"externalReference",
					"reportedExternallyAt",
					"closedAt",
					"closedById",
					"documentId",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"SterilisationCycleView": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"autoclaveRef": {
						"type": "string"
					},
					"cycleNumber": {
						"type": "string"
					},
					"startedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"outcome": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"pass",
									"fail",
									"aborted"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"operatorUserId": {
						"type": "string"
					},
					"printoutDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"checkEntryId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"uses": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/SterilisationCycleUse"
						}
					}
				},
				"required": [
					"id",
					"organizationId",
					"locationId",
					"autoclaveRef",
					"cycleNumber",
					"startedAt",
					"endedAt",
					"outcome",
					"operatorUserId",
					"printoutDocumentId",
					"checkEntryId",
					"createdAt",
					"uses"
				],
				"additionalProperties": false
			},
			"SterilisationCycleUse": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"cycleId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"appointmentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"procedureId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"instrumentSet": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"recordedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"cycleId",
					"patientId",
					"appointmentId",
					"procedureId",
					"instrumentSet",
					"recordedAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt"
				],
				"additionalProperties": false
			},
			"PracticeArchive": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"generation": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"status": {
						"type": "string",
						"enum": [
							"requested",
							"running",
							"completed",
							"acknowledged",
							"failed",
							"superseded"
						]
					},
					"requestedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"cutoffAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"lifecycleGeneration": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"lifecycleState": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"active",
									"closing",
									"purging",
									"custodian"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"runningAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"completedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"manifest": {},
					"manifestDigest": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"exportDocumentId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"completenessProof": {},
					"acknowledgedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"acknowledgedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"failedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"failedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"supersededAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cursor": {},
					"leaseToken": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"leaseExpiresAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"generation",
					"status",
					"requestedAt",
					"cutoffAt",
					"lifecycleGeneration",
					"lifecycleState",
					"runningAt",
					"completedAt",
					"manifest",
					"manifestDigest",
					"exportDocumentId",
					"completenessProof",
					"acknowledgedById",
					"acknowledgedAt",
					"failedAt",
					"failedReason",
					"supersededAt",
					"cursor",
					"leaseToken",
					"leaseExpiresAt",
					"createdById",
					"createdByName",
					"createdBySource",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"StsConnection": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"environment": {
						"type": "string",
						"enum": [
							"test",
							"production"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"active",
							"error",
							"disconnected"
						]
					},
					"credentialGeneration": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"cfProprietario": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"codiceRegione": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"codiceAsl": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"codiceSsa": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"dispositivo": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"lastSyncAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"organizationId",
					"environment",
					"status",
					"credentialGeneration",
					"cfProprietario",
					"codiceRegione",
					"codiceAsl",
					"codiceSsa",
					"dispositivo",
					"lastSyncAt",
					"lastError",
					"createdAt"
				],
				"additionalProperties": false
			},
			"StsSubmission": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"invoiceId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientName": {
						"type": "string"
					},
					"invoiceLabel": {
						"type": "string"
					},
					"kind": {
						"type": "string",
						"enum": [
							"inserimento",
							"variazione",
							"rimborso",
							"cancellazione"
						]
					},
					"generation": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"attemptCount": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"deliveries": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/StsDelivery"
						}
					}
				},
				"required": [
					"id",
					"invoiceId",
					"patientId",
					"patientName",
					"invoiceLabel",
					"kind",
					"generation",
					"attemptCount",
					"createdAt",
					"deliveries"
				],
				"additionalProperties": false
			},
			"StsDelivery": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"attempt": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"state": {
						"type": "string",
						"enum": [
							"claimed",
							"sent",
							"acked",
							"rejected",
							"parked"
						]
					},
					"externalId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"responseCodes": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"parkedReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"sentAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					}
				},
				"required": [
					"id",
					"attempt",
					"state",
					"externalId",
					"responseCodes",
					"parkedReason",
					"lastError",
					"sentAt",
					"createdAt"
				],
				"additionalProperties": false
			},
			"WorklistItem": {
				"type": "object",
				"properties": {
					"key": {
						"type": "string"
					},
					"patientId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"patientName": {
						"type": "string"
					},
					"title": {
						"type": "string"
					},
					"detail": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"on": {
						"anyOf": [
							{
								"type": "string",
								"format": "date",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
							},
							{
								"type": "null"
							}
						]
					},
					"amountCents": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": -9007199254740991,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"locationId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"key",
					"patientId",
					"patientName",
					"title",
					"detail",
					"on",
					"amountCents",
					"locationId",
					"practitionerName"
				],
				"additionalProperties": false
			},
			"ScheduleAbsenceListItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"ownerType": {
						"type": "string",
						"enum": [
							"member",
							"practitioner"
						]
					},
					"userId": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"practitionerId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"kind": {
						"type": "string",
						"enum": [
							"holiday",
							"sick",
							"training",
							"other"
						]
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"status": {
						"type": "string",
						"enum": [
							"requested",
							"approved",
							"declined",
							"cancelled"
						]
					},
					"note": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"requestedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"decidedById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"decidedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"decisionNote": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelledAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelledById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"cancelReason": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"ownerName": {
						"type": "string"
					}
				},
				"required": [
					"id",
					"organizationId",
					"ownerType",
					"userId",
					"practitionerId",
					"kind",
					"startsAt",
					"endsAt",
					"status",
					"note",
					"requestedById",
					"decidedById",
					"decidedAt",
					"decisionNote",
					"cancelledAt",
					"cancelledById",
					"cancelReason",
					"createdAt",
					"updatedAt",
					"ownerName"
				],
				"additionalProperties": false
			},
			"DialerOperation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"kind": {
						"type": "string",
						"enum": [
							"sms_profile_create",
							"sms_registration_submit",
							"sms_number_assign",
							"address_create",
							"document_upload",
							"requirement_group_create",
							"number_order",
							"number_release",
							"number_forwarding_set",
							"raw_line_enable",
							"raw_line_disable",
							"raw_line_rotate_credentials",
							"emergency_enable",
							"portout_authorize",
							"portout_reject",
							"porting_order_create",
							"porting_child_setup",
							"porting_order_submit",
							"porting_order_amend",
							"porting_child_cancel",
							"porting_number_adopt",
							"porting_child_reconcile"
						]
					},
					"status": {
						"type": "string",
						"enum": [
							"queued",
							"claimed",
							"submitted",
							"ambiguous",
							"reconciling",
							"confirmed",
							"completed",
							"rejected",
							"review_required",
							"superseded"
						]
					},
					"numberId": {
						"anyOf": [
							{
								"type": "string",
								"format": "uuid",
								"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
							},
							{
								"type": "null"
							}
						]
					},
					"lastError": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"stalled": {
						"type": "boolean"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"resolvedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"kind",
					"status",
					"numberId",
					"lastError",
					"stalled",
					"createdAt",
					"resolvedAt"
				],
				"additionalProperties": false
			},
			"MessageTemplateSummary": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"organizationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
						"description": "Canonical lowercase UUID organization identifier"
					},
					"version": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"maximum": 9007199254740991
					},
					"name": {
						"type": "string"
					},
					"channel": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"whatsapp",
									"sms",
									"email",
									"webchat",
									"messenger",
									"instagram",
									"telegram",
									"tiktok",
									"facebook_comments",
									"instagram_comments"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"subject": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"body": {
						"type": "string"
					},
					"whatsappTemplateRef": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"language": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"whatsappCategory": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"utility",
									"marketing",
									"authentication"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"whatsappStatus": {
						"anyOf": [
							{
								"type": "string",
								"enum": [
									"draft",
									"submitting",
									"pending",
									"approved",
									"rejected",
									"paused",
									"disabled",
									"parked"
								]
							},
							{
								"type": "null"
							}
						]
					},
					"position": {
						"type": "integer",
						"minimum": -9007199254740991,
						"maximum": 9007199254740991
					},
					"createdById": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdByName": {
						"anyOf": [
							{
								"type": "string"
							},
							{
								"type": "null"
							}
						]
					},
					"createdBySource": {
						"type": "string",
						"enum": [
							"user",
							"patient",
							"automation",
							"campaign",
							"ai",
							"api",
							"import",
							"system"
						]
					},
					"archivedAt": {
						"anyOf": [
							{
								"type": "string",
								"format": "date-time",
								"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
							},
							{
								"type": "null"
							}
						]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"updatedAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"hasDesign": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"organizationId",
					"version",
					"name",
					"channel",
					"subject",
					"body",
					"whatsappTemplateRef",
					"language",
					"whatsappCategory",
					"whatsappStatus",
					"position",
					"createdById",
					"createdByName",
					"createdBySource",
					"archivedAt",
					"createdAt",
					"updatedAt",
					"hasDesign"
				],
				"additionalProperties": false
			},
			"BookingHoldReservation": {
				"type": "object",
				"properties": {
					"uid": {
						"type": "string"
					},
					"holdExpiresAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"startsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"endsAt": {
						"type": "string",
						"format": "date-time",
						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
					},
					"timezone": {
						"type": "string"
					},
					"requiresConfirmation": {
						"type": "boolean"
					},
					"deposit": {
						"anyOf": [
							{
								"type": "object",
								"properties": {
									"amountCents": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"currency": {
										"type": "string",
										"enum": [
											"EUR",
											"GBP",
											"USD"
										]
									},
									"checkoutUrl": {
										"type": "string",
										"format": "uri"
									}
								},
								"required": [
									"amountCents",
									"currency",
									"checkoutUrl"
								],
								"additionalProperties": false
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"uid",
					"holdExpiresAt",
					"startsAt",
					"endsAt",
					"timezone",
					"requiresConfirmation",
					"deposit"
				],
				"additionalProperties": false
			},
			"BookingRequestReceived": {
				"type": "object",
				"properties": {
					"status": {
						"type": "string",
						"const": "request_received"
					}
				},
				"required": [
					"status"
				],
				"additionalProperties": false
			},
			"schema0": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema0"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema0"
						}
					}
				]
			},
			"schema1": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema1"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema1"
						}
					}
				]
			},
			"schema2": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema2"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema2"
						}
					}
				]
			},
			"schema3": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema3"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema3"
						}
					}
				]
			},
			"schema4": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema4"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema4"
						}
					}
				]
			},
			"schema5": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema5"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema5"
						}
					}
				]
			},
			"schema6": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema6"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema6"
						}
					}
				]
			},
			"schema7": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema7"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema7"
						}
					}
				]
			},
			"schema8": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema8"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema8"
						}
					}
				]
			},
			"schema9": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema9"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema9"
						}
					}
				]
			},
			"schema10": {
				"anyOf": [
					{
						"type": "string"
					},
					{
						"type": "number"
					},
					{
						"type": "boolean"
					},
					{
						"type": "null"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/schema10"
						}
					},
					{
						"type": "object",
						"propertyNames": {
							"type": "string"
						},
						"additionalProperties": {
							"$ref": "#/components/schemas/schema10"
						}
					}
				]
			},
			"SeoContentReviewer": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"displayName": {
						"type": "string",
						"minLength": 1,
						"maxLength": 300
					},
					"registrationRef": {
						"anyOf": [
							{
								"type": "string",
								"maxLength": 200
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"id",
					"displayName",
					"registrationRef"
				],
				"additionalProperties": false
			},
			"SeoContentTargetSuggestion": {
				"type": "object",
				"properties": {
					"keywordId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"locationId": {
						"type": "string",
						"format": "uuid",
						"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
					},
					"targetPhrase": {
						"type": "string",
						"minLength": 1,
						"maxLength": 120
					},
					"searchVolume": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 9007199254740991
							},
							{
								"type": "null"
							}
						]
					},
					"difficulty": {
						"anyOf": [
							{
								"type": "integer",
								"minimum": 0,
								"maximum": 100
							},
							{
								"type": "null"
							}
						]
					}
				},
				"required": [
					"keywordId",
					"locationId",
					"targetPhrase",
					"searchVolume",
					"difficulty"
				],
				"additionalProperties": false
			}
		},
		"securitySchemes": {
			"bearerAuth": {
				"type": "http",
				"scheme": "bearer",
				"description": "A practice API key or an OAuth access token, both presented as `Authorization: Bearer <token>`. The token itself names the practice, so no organization header is needed."
			},
			"oauth2": {
				"type": "oauth2",
				"description": "First-party authorization-code grant for third-party apps. Tokens are opaque and practice-scoped: the practice is fixed at consent and cannot be re-pointed by a header.",
				"flows": {
					"authorizationCode": {
						"authorizationUrl": "https://api-eu.smileline.io/auth/oauth2/authorize",
						"tokenUrl": "https://api-eu.smileline.io/auth/oauth2/token",
						"refreshUrl": "https://api-eu.smileline.io/auth/oauth2/token",
						"scopes": {
							"read": "Read practice data — safe methods only.",
							"write": "Create, change and delete practice data.",
							"offline_access": "Issue a refresh token so the connection outlives one access token.",
							"dialer": "Reach the voice/dialer surface (first-party extension client only)."
						}
					}
				}
			}
		}
	}
}
