{
	"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"
			]
		},
		{
			"oauth2": [
				"patients.read"
			]
		},
		{
			"oauth2": [
				"patients.write"
			]
		},
		{
			"oauth2": [
				"appointments.read"
			]
		},
		{
			"oauth2": [
				"appointments.write"
			]
		},
		{
			"oauth2": [
				"journeys.read"
			]
		},
		{
			"oauth2": [
				"journeys.write"
			]
		},
		{
			"oauth2": [
				"tasks.read"
			]
		},
		{
			"oauth2": [
				"tasks.write"
			]
		},
		{
			"oauth2": [
				"conversations.read"
			]
		},
		{
			"oauth2": [
				"conversations.write"
			]
		},
		{
			"oauth2": [
				"treatments.read"
			]
		},
		{
			"oauth2": [
				"treatments.write"
			]
		},
		{
			"oauth2": [
				"campaigns.read"
			]
		},
		{
			"oauth2": [
				"campaigns.write"
			]
		},
		{
			"oauth2": [
				"deposits.read"
			]
		},
		{
			"oauth2": [
				"deposits.write"
			]
		},
		{
			"oauth2": [
				"reputation.read"
			]
		},
		{
			"oauth2": [
				"reputation.write"
			]
		},
		{
			"oauth2": [
				"reports.read"
			]
		},
		{
			"oauth2": [
				"reports.write"
			]
		},
		{
			"oauth2": [
				"webhooks.read"
			]
		},
		{
			"oauth2": [
				"webhooks.write"
			]
		},
		{
			"oauth2": [
				"settings.read"
			]
		},
		{
			"oauth2": [
				"settings.write"
			]
		}
	],
	"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": "pms"
		},
		{
			"name": "goals"
		},
		{
			"name": "Assistant"
		},
		{
			"name": "Team chat"
		},
		{
			"name": "campaigns"
		},
		{
			"name": "bootstrap"
		},
		{
			"name": "billing"
		},
		{
			"name": "organization"
		},
		{
			"name": "appointments"
		},
		{
			"name": "settings"
		},
		{
			"name": "capture"
		},
		{
			"name": "site"
		},
		{
			"name": "website-analytics"
		},
		{
			"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": "Channel connections"
		},
		{
			"name": "automations"
		},
		{
			"name": "Settings"
		},
		{
			"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": "sites"
		},
		{
			"name": "Social"
		},
		{
			"name": "Clinical storage"
		},
		{
			"name": "Shared patient files (recipient)"
		},
		{
			"name": "Episodes"
		},
		{
			"name": "Treatment plans"
		},
		{
			"name": "Clinical notes"
		},
		{
			"name": "Voice notes"
		},
		{
			"name": "SmileDesign"
		},
		{
			"name": "Imaging"
		},
		{
			"name": "Medical history"
		},
		{
			"name": "Patient forms"
		},
		{
			"name": "patient-form-public"
		},
		{
			"name": "Recalls"
		},
		{
			"name": "Ledger"
		},
		{
			"name": "Invoices"
		},
		{
			"name": "Card terminal"
		},
		{
			"name": "Perio"
		},
		{
			"name": "Ortho"
		},
		{
			"name": "Insurance"
		},
		{
			"name": "NHS"
		},
		{
			"name": "Prescriptions"
		},
		{
			"name": "Lab cases"
		},
		{
			"name": "Lab order page"
		},
		{
			"name": "Lab orders"
		},
		{
			"name": "Scanners"
		},
		{
			"name": "Uploader"
		},
		{
			"name": "Uploader device"
		},
		{
			"name": "Clinical referrals"
		},
		{
			"name": "Letters"
		},
		{
			"name": "Waitlist"
		},
		{
			"name": "Treatment templates"
		},
		{
			"name": "Statements"
		},
		{
			"name": "Memberships"
		},
		{
			"name": "Payment plans"
		},
		{
			"name": "Till"
		},
		{
			"name": "Banking"
		},
		{
			"name": "Associate pay"
		},
		{
			"name": "Inventory"
		},
		{
			"name": "Accounting"
		},
		{
			"name": "Compliance"
		},
		{
			"name": "Practice archive"
		},
		{
			"name": "Sistema TS"
		},
		{
			"name": "Finance checks"
		},
		{
			"name": "Finance checks (patient)"
		},
		{
			"name": "scheduling"
		},
		{
			"name": "Staffing"
		},
		{
			"name": "Shop"
		},
		{
			"name": "page-notes"
		}
	],
	"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). An all-digit q also matches the patient number exactly, and a date the date of birth exactly: YYYY-MM-DD, or day and month with a four-digit year, read month first for a US practice and day first elsewhere. `filters` is URL-encoded JSON matching the PatientFilters schema; keys are AND-ed, or OR-ed when it carries `\"match\": \"any\"` (the status still narrows every match). sort=relevance ranks by similarity to q. embed=tags attaches each row's tags; embed=clinic the clinic's columns (dentist and their diary colour, hygienist, price list, next visit, last visit and its type, whether there is any visit, recall, balance), each absent when the caller may not read it; clinicColumns (a comma list of those column keys) reads only the ones named, never one the caller may not read. Archived patients are excluded unless includeArchived=true or a status filter asks for archived. ids (a comma list of patient ids) narrows the list to those patients.",
				"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",
								"nextVisit",
								"lastVisit",
								"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",
							"pattern": "^(tags|clinic|journeys)(,(tags|clinic|journeys))*$"
						}
					},
					{
						"name": "clinicColumns",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(dentist|hygienist|priceList|nextVisit|lastVisit|visits|recall|balance|owedFor|plannedValue|legacyChartNumber|gp)(,(dentist|hygienist|priceList|nextVisit|lastVisit|visits|recall|balance|owedFor|plannedValue|legacyChartNumber|gp))*$"
						}
					},
					{
						"name": "ids",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36})*$"
						}
					},
					{
						"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": {
										"type": [
											"string",
											"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": {
										"type": [
											"string",
											"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-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneMobile": {
										"type": [
											"string",
											"null"
										]
									},
									"phoneOther": {
										"type": [
											"string",
											"null"
										]
									},
									"addressLine1": {
										"type": [
											"string",
											"null"
										]
									},
									"addressLine2": {
										"type": [
											"string",
											"null"
										]
									},
									"city": {
										"type": [
											"string",
											"null"
										]
									},
									"province": {
										"type": [
											"string",
											"null"
										]
									},
									"postalCode": {
										"type": [
											"string",
											"null"
										]
									},
									"country": {
										"type": [
											"string",
											"null"
										]
									},
									"language": {
										"type": [
											"string",
											"null"
										]
									},
									"preferredContactMethod": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"phone",
													"sms",
													"email",
													"whatsapp"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"preferredContactTime": {
										"type": [
											"string",
											"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": {
										"type": [
											"string",
											"null"
										]
									},
									"note": {
										"type": [
											"string",
											"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"
											}
										]
									},
									"occupation": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"gpContactId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"emergencyContactName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"emergencyContactRelationship": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"emergencyContactPhone": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerGenderPreference": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"no_preference",
													"female",
													"male",
													"declined"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"customFields": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									},
									"status": {
										"type": "string",
										"enum": [
											"enquiry",
											"patient"
										],
										"description": "`patient` for someone already a patient of the practice (Clinical's New patient). Absent means `enquiry`, which CRM Today triages."
									}
								},
								"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"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. The clinic's visit, recall and balance columns need appointment:read, recall:read and ledger:read (403 without). Caps at 10000 rows because the CSV is built in memory — code EXPORT_TOO_LARGE; POST /transfer/exports with entity `patients` and this query (q, filters, sort, direction, columns, ids) as `patientQuery` runs the same export in the background with no row limit.",
				"parameters": [
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "createdAt",
							"type": "string",
							"enum": [
								"createdAt",
								"updatedAt",
								"lastName",
								"firstName",
								"status",
								"dateOfBirth",
								"city",
								"email",
								"nextVisit",
								"lastVisit",
								"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": "ids",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36})*$"
						}
					},
					{
						"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]+)*$"
						}
					}
				],
				"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, details.minAttempts) when the selection holds leads under the practice's minimum contact attempts since the last conversation (minAttemptsBeforeGivingUp in practice settings, default 9) 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|calls|visit)(,(timeline|journeys|touches|pms|deposits|referral|marketing|calls|visit))*$"
						}
					}
				],
				"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. 409 LEAD_SOURCE_FROM_ATTRIBUTION when `leadSourceId` would change a lead source Smileline set from the attribution the patient arrived with (`leadSourceLocked` on the patient's detail). 422 PATIENT_GP_INVALID when the GP is not this practice's kind-`gp` contact, or is archived and not already the patient's; 422 EMERGENCY_CONTACT_NAME_REQUIRED when the emergency contact would have a relationship or phone but no name; 422 PATIENT_CONTACT_REQUIRED when the change would leave a patient who had a mobile or an email with neither.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
										"type": [
											"string",
											"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": {
										"type": [
											"string",
											"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-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneMobile": {
										"type": [
											"string",
											"null"
										]
									},
									"phoneOther": {
										"type": [
											"string",
											"null"
										]
									},
									"addressLine1": {
										"type": [
											"string",
											"null"
										]
									},
									"addressLine2": {
										"type": [
											"string",
											"null"
										]
									},
									"city": {
										"type": [
											"string",
											"null"
										]
									},
									"province": {
										"type": [
											"string",
											"null"
										]
									},
									"postalCode": {
										"type": [
											"string",
											"null"
										]
									},
									"country": {
										"type": [
											"string",
											"null"
										]
									},
									"language": {
										"type": [
											"string",
											"null"
										]
									},
									"preferredContactMethod": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"phone",
													"sms",
													"email",
													"whatsapp"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"preferredContactTime": {
										"type": [
											"string",
											"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": {
										"type": [
											"string",
											"null"
										]
									},
									"note": {
										"type": [
											"string",
											"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"
											}
										]
									},
									"occupation": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"gpContactId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"emergencyContactName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"emergencyContactRelationship": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"emergencyContactPhone": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"type": "null"
											}
										]
									},
									"practitionerGenderPreference": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"no_preference",
													"female",
													"male",
													"declined"
												]
											},
											{
												"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Erase a patient",
				"tags": [
					"patients"
				],
				"description": "Owner only: the right-to-erasure request. In one short transaction the patient is restricted — hidden from every staff surface, contact details cleared, nothing new attachable, nothing sent — and an erasure request opens; the patient's CRM records (journeys, activities, conversations and messages, calls, voicemails, transcripts, tasks, consent and lead history) are then removed step by step, and stored files are cleaned up separately. `erasure` reports progress and what earlier copies may still hold the person. A patient with clinical or payment records (or an account, a consent or payer relationship, an insurance subscription or referral evidence) keeps those records under a restricted identity that only the owner can open, until a computed date (`erasure.status` is `kept`). Idempotent while the request runs. A refusal is 409 with the first reason's code (PATIENT_MERGED, PATIENT_LEGAL_HOLD, PATIENT_PAYS_FOR_OTHERS, PATIENT_CARRIES_PAYER_AUTHORITY, PATIENT_HAS_LIVE_WORK — including an active membership or payment plan — or PATIENT_HAS_FAMILY_RELATIONSHIP) and every reason in details.reasons. 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
										},
										"erasure": {
											"$ref": "#/components/schemas/PatientErasure"
										}
									},
									"required": [
										"ok",
										"recordingsScheduled",
										"erasure"
									],
									"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}/touches/{touchId}": {
			"get": {
				"summary": "One capture touch",
				"tags": [
					"patients"
				],
				"description": "One of the patient's capture touches by id, in the same shape as the patient's embedded touches (website form or lead form, with its submitted answers previewed and its attribution) — for a touch older than the patient's newest 20. Requires patient:read. 404 for a touch that is not this patient's.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "touchId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"referrerDomain": {
											"type": [
												"string",
												"null"
											]
										},
										"landingUrl": {
											"type": [
												"string",
												"null"
											]
										},
										"utmSource": {
											"type": [
												"string",
												"null"
											]
										},
										"utmMedium": {
											"type": [
												"string",
												"null"
											]
										},
										"utmCampaign": {
											"type": [
												"string",
												"null"
											]
										},
										"utmTerm": {
											"type": [
												"string",
												"null"
											]
										},
										"utmContent": {
											"type": [
												"string",
												"null"
											]
										},
										"utmId": {
											"type": [
												"string",
												"null"
											]
										},
										"utmSourcePlatform": {
											"type": [
												"string",
												"null"
											]
										},
										"utmCreativeFormat": {
											"type": [
												"string",
												"null"
											]
										},
										"utmMarketingTactic": {
											"type": [
												"string",
												"null"
											]
										},
										"utmAdName": {
											"type": [
												"string",
												"null"
											]
										},
										"clickIds": {
											"type": "object",
											"propertyNames": {
												"type": "string"
											},
											"additionalProperties": {
												"type": "string"
											}
										},
										"adCampaignId": {
											"type": [
												"string",
												"null"
											]
										},
										"adGroupId": {
											"type": [
												"string",
												"null"
											]
										},
										"adId": {
											"type": [
												"string",
												"null"
											]
										},
										"adPlacement": {
											"type": [
												"string",
												"null"
											]
										},
										"adNetwork": {
											"type": [
												"string",
												"null"
											]
										},
										"adKeyword": {
											"type": [
												"string",
												"null"
											]
										},
										"adMatchType": {
											"type": [
												"string",
												"null"
											]
										},
										"adDevice": {
											"type": [
												"string",
												"null"
											]
										},
										"gaClientId": {
											"type": [
												"string",
												"null"
											]
										},
										"gaSessionId": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"affiliate": {
											"type": [
												"string",
												"null"
											]
										},
										"submission": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"label": {
														"type": "string"
													},
													"value": {
														"type": "string"
													}
												},
												"required": [
													"label",
													"value"
												],
												"additionalProperties": false
											}
										},
										"submissionTruncated": {
											"type": "boolean"
										},
										"leadAd": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"provider": {
															"type": "string",
															"enum": [
																"meta",
																"google_ads",
																"tiktok"
															]
														},
														"platform": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"facebook",
																		"instagram"
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"formName": {
															"type": [
																"string",
																"null"
															]
														},
														"campaignName": {
															"type": [
																"string",
																"null"
															]
														},
														"adSetName": {
															"type": [
																"string",
																"null"
															]
														},
														"adName": {
															"type": [
																"string",
																"null"
															]
														},
														"answerCount": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"provider",
														"platform",
														"formName",
														"campaignName",
														"adSetName",
														"adName",
														"answerCount"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"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",
										"leadAd"
									],
									"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}/touches/{touchId}/answers": {
			"get": {
				"summary": "Every answer a lead form submitted",
				"tags": [
					"patients"
				],
				"description": "The complete answers of one native lead-form touch (Meta, Google Ads or TikTok), read from the record the patient keeps: every question, unclipped, and the form, campaign, ad set and ad by name — never the provider's ids. Requires patient:read. 404 for any other touch, or one that is not this patient's.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "touchId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"submission": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"label": {
														"type": "string"
													},
													"value": {
														"type": "string"
													}
												},
												"required": [
													"label",
													"value"
												],
												"additionalProperties": false
											}
										},
										"leadAd": {
											"type": "object",
											"properties": {
												"provider": {
													"type": "string",
													"enum": [
														"meta",
														"google_ads",
														"tiktok"
													]
												},
												"platform": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"facebook",
																"instagram"
															]
														},
														{
															"type": "null"
														}
													]
												},
												"formName": {
													"type": [
														"string",
														"null"
													]
												},
												"campaignName": {
													"type": [
														"string",
														"null"
													]
												},
												"adSetName": {
													"type": [
														"string",
														"null"
													]
												},
												"adName": {
													"type": [
														"string",
														"null"
													]
												},
												"answerCount": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"provider",
												"platform",
												"formName",
												"campaignName",
												"adSetName",
												"adName",
												"answerCount"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"submission",
										"leadAd"
									],
									"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}/gp": {
			"post": {
				"summary": "Register a new GP and make them the patient's",
				"tags": [
					"patients"
				],
				"description": "Adds a kind-`gp` professional contact and links it to the patient in one transaction, under `patient:update`. A retry with the same `requestId` and body answers the recorded result and never touches the patient's GP again (a GP chosen since stays); the same id with another body is 409 ID_TAKEN.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"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)$"
									},
									"displayName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"practiceName": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"phone": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 40
											},
											{
												"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-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"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"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"requestId",
									"displayName"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"contact": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
													"const": "gp"
												},
												"displayName": {
													"type": "string"
												},
												"practiceName": {
													"type": [
														"string",
														"null"
													]
												},
												"phone": {
													"type": [
														"string",
														"null"
													]
												},
												"email": {
													"type": [
														"string",
														"null"
													]
												},
												"addressLine1": {
													"type": [
														"string",
														"null"
													]
												},
												"addressLine2": {
													"type": [
														"string",
														"null"
													]
												},
												"city": {
													"type": [
														"string",
														"null"
													]
												},
												"postalCode": {
													"type": [
														"string",
														"null"
													]
												}
											},
											"required": [
												"id",
												"kind",
												"displayName",
												"practiceName",
												"phone",
												"email",
												"addressLine1",
												"addressLine2",
												"city",
												"postalCode"
											],
											"additionalProperties": false
										},
										"linked": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"contact",
										"linked"
									],
									"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}/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 (details.minAttempts) when a lead under the practice's minimum contact attempts since the last conversation (minAttemptsBeforeGivingUp in practice settings, default 9) 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}/pin": {
			"put": {
				"summary": "Pin or unpin a patient on Today",
				"tags": [
					"patients"
				],
				"description": "Pins the patient to the top of every teammate's Today queue (pinned: true) or unpins them (pinned: false). Idempotent: pinning an already-pinned patient keeps the original pinnedAt. 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": {
									"pinned": {
										"type": "boolean"
									}
								},
								"required": [
									"pinned"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"pinnedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
										"pinnedAt"
									],
									"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}/automations": {
			"get": {
				"summary": "A patient's automations switch",
				"tags": [
					"patients"
				],
				"description": "Whether the team stopped the patient's automations (when, and who), and the lead flows running for them now. Needs journey: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": {
										"stoppedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"stoppedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"running": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"enrollmentId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"flowName": {
														"type": "string"
													}
												},
												"required": [
													"enrollmentId",
													"flowName"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"stoppedAt",
										"stoppedByName",
										"running"
									],
									"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}/automations/stop": {
			"post": {
				"summary": "Stop a patient's automations",
				"tags": [
					"patients"
				],
				"description": "Stops every lead flow running for the patient (reason `manual`) and keeps new ones from starting, resuming or sending — long-term nurture included — until POST /patients/:id/automations/resume. Booking messages, appointment reminders, recalls and missed-call texts still go. Idempotent: stopping again keeps the first stop's time and member. 409 PATIENT_MERGED when the patient was merged into another record. Needs journey:update.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"stoppedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"stoppedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"running": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"enrollmentId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"flowName": {
														"type": "string"
													}
												},
												"required": [
													"enrollmentId",
													"flowName"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"stoppedAt",
										"stoppedByName",
										"running"
									],
									"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}/automations/resume": {
			"post": {
				"summary": "Let a patient's automations run",
				"tags": [
					"patients"
				],
				"description": "Clears the stop: lead flows may start again on their next moment (long-term nurture on the quiet sweep's next look), and on flows a flow stopped part-way resumes after the last step it reached, never sending one twice. Stopped runs are not restarted here. Idempotent. 409 PATIENT_MERGED when the patient was merged into another record. Needs journey:update.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"stoppedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"stoppedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"running": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"enrollmentId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"flowName": {
														"type": "string"
													}
												},
												"required": [
													"enrollmentId",
													"flowName"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"stoppedAt",
										"stoppedByName",
										"running"
									],
									"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}/merge-preview": {
			"get": {
				"summary": "Preview merging a duplicate into this patient",
				"tags": [
					"patients"
				],
				"description": "The two records side by side, their open journeys, what blocks the merge (details in `blockers`) and the source's contact details the kept record cannot hold. 409 PATIENT_MERGED when either record was already merged.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "sourceId",
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"survivor": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
													"type": [
														"string",
														"null"
													]
												},
												"email": {
													"type": [
														"string",
														"null"
													]
												},
												"phoneMobile": {
													"type": [
														"string",
														"null"
													]
												},
												"phoneOther": {
													"type": [
														"string",
														"null"
													]
												},
												"status": {
													"type": "string",
													"enum": [
														"enquiry",
														"lead",
														"patient",
														"inactive",
														"archived",
														"deceased"
													]
												},
												"createdAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"updatedAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"openJourneys": {
													"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)$"
															},
															"version": {
																"type": "integer",
																"exclusiveMinimum": 0,
																"maximum": 9007199254740991
															},
															"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)$"
															},
															"pipelineName": {
																"type": "string"
															},
															"stageName": {
																"type": "string"
															},
															"stagePosition": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"treatmentName": {
																"type": [
																	"string",
																	"null"
																]
															}
														},
														"required": [
															"id",
															"version",
															"pipelineId",
															"pipelineName",
															"stageName",
															"stagePosition",
															"treatmentName"
														],
														"additionalProperties": false
													}
												}
											},
											"required": [
												"id",
												"firstName",
												"lastName",
												"preferredName",
												"email",
												"phoneMobile",
												"phoneOther",
												"status",
												"createdAt",
												"updatedAt",
												"openJourneys"
											],
											"additionalProperties": false
										},
										"source": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
													"type": [
														"string",
														"null"
													]
												},
												"email": {
													"type": [
														"string",
														"null"
													]
												},
												"phoneMobile": {
													"type": [
														"string",
														"null"
													]
												},
												"phoneOther": {
													"type": [
														"string",
														"null"
													]
												},
												"status": {
													"type": "string",
													"enum": [
														"enquiry",
														"lead",
														"patient",
														"inactive",
														"archived",
														"deceased"
													]
												},
												"createdAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"updatedAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"openJourneys": {
													"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)$"
															},
															"version": {
																"type": "integer",
																"exclusiveMinimum": 0,
																"maximum": 9007199254740991
															},
															"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)$"
															},
															"pipelineName": {
																"type": "string"
															},
															"stageName": {
																"type": "string"
															},
															"stagePosition": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"treatmentName": {
																"type": [
																	"string",
																	"null"
																]
															}
														},
														"required": [
															"id",
															"version",
															"pipelineId",
															"pipelineName",
															"stageName",
															"stagePosition",
															"treatmentName"
														],
														"additionalProperties": false
													}
												}
											},
											"required": [
												"id",
												"firstName",
												"lastName",
												"preferredName",
												"email",
												"phoneMobile",
												"phoneOther",
												"status",
												"createdAt",
												"updatedAt",
												"openJourneys"
											],
											"additionalProperties": false
										},
										"blockers": {
											"type": "array",
											"items": {
												"type": "string",
												"enum": [
													"clinical",
													"billing",
													"insurance",
													"nhs",
													"pms_link",
													"identifier",
													"deposit",
													"waitlist",
													"relationship",
													"referral",
													"form_link",
													"finance_check",
													"legal_hold",
													"live_call",
													"post_call_processing",
													"conversion_upload",
													"outreach_sending"
												]
											}
										},
										"dropped": {
											"type": "object",
											"properties": {
												"emails": {
													"type": "array",
													"items": {
														"type": "string"
													}
												},
												"phones": {
													"type": "array",
													"items": {
														"type": "string"
													}
												}
											},
											"required": [
												"emails",
												"phones"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"survivor",
										"source",
										"blockers",
										"dropped"
									],
									"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}/merge": {
			"post": {
				"summary": "Merge a duplicate into this patient",
				"tags": [
					"patients"
				],
				"description": "Moves the source's CRM history (journeys, calls, messages, tasks, attribution, consent, tags) onto this patient and leaves the source as a read-only merged record pointing here. Cannot be undone. Folds each `combine` pair: the folded journey's sequences stop, its open tasks are cancelled and its pending ad conversions are skipped. 409 PATIENT_MERGE_BLOCKED with details.reasons (see PATIENT_MERGE_BLOCKERS) and details.retryable; 409 MERGE_PREVIEW_STALE when either record or a journey changed since the preview; 409 PATIENT_MERGED when either record was already merged elsewhere. Repeating a completed merge returns the same result.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"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)$"
									},
									"combine": {
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"keepJourneyId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"foldJourneyId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
												"keepJourneyId",
												"foldJourneyId"
											]
										}
									},
									"expected": {
										"type": "object",
										"properties": {
											"survivorUpdatedAt": {
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											"sourceUpdatedAt": {
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
											},
											"journeyVersions": {
												"type": "object",
												"propertyNames": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												}
											}
										},
										"required": [
											"survivorUpdatedAt",
											"sourceUpdatedAt",
											"journeyVersions"
										]
									}
								},
								"required": [
									"sourceId",
									"combine",
									"expected"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/patient-erasures/search": {
			"get": {
				"summary": "Find a patient to erase",
				"tags": [
					"patients"
				],
				"description": "Owner only. The patient search for the erase action, open while the practice is closing (when the patient list is not): one bounded page of id, name, date of birth and status. Erased patients never appear.",
				"parameters": [
					{
						"name": "q",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					}
				],
				"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)$"
													},
													"firstName": {
														"type": "string"
													},
													"lastName": {
														"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"
															}
														]
													},
													"status": {
														"type": "string",
														"enum": [
															"enquiry",
															"lead",
															"patient",
															"inactive",
															"archived",
															"deceased"
														]
													}
												},
												"required": [
													"id",
													"firstName",
													"lastName",
													"dateOfBirth",
													"status"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patient-erasures": {
			"get": {
				"summary": "List erasure requests",
				"tags": [
					"patients"
				],
				"description": "Owner only. The practice's patient erasure requests, newest first, one page at a time (`after` is the previous page's `nextCursor`). Rows carry a reference, never a name.",
				"parameters": [
					{
						"name": "after",
						"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/PatientErasure"
											}
										},
										"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
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patient-erasures/{id}": {
			"get": {
				"summary": "Get an erasure request",
				"tags": [
					"patients"
				],
				"description": "Owner only. One erasure request, with what earlier copies may still hold the person (the erase dialog polls this).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"status": {
											"type": "string",
											"enum": [
												"in_progress",
												"waiting",
												"needs_attention",
												"erased",
												"kept"
											]
										},
										"waitingFor": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"legal_hold",
														"live_call",
														"call_processing",
														"recording_pending",
														"carrier_recording",
														"update"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"attention": {
											"type": [
												"string",
												"null"
											]
										},
										"keptReason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"clinical_record",
														"financial_record"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"keptUntil": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"physicalCleanup": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"in_progress",
														"needs_attention",
														"done"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"progress": {
											"type": "object",
											"properties": {
												"step": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"of": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"step",
												"of"
											],
											"additionalProperties": false
										},
										"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))$"
										},
										"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"
												}
											]
										},
										"disclosure": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"practiceArchives": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"exportFilesUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"transferPackagesUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"importFilesUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"pmsExports": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"webhookDeliveries": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"pmsProvider": {
															"type": [
																"string",
																"null"
															]
														}
													},
													"required": [
														"practiceArchives",
														"exportFilesUntil",
														"transferPackagesUntil",
														"importFilesUntil",
														"pmsExports",
														"webhookDeliveries",
														"pmsProvider"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"status",
										"waitingFor",
										"attention",
										"keptReason",
										"keptUntil",
										"physicalCleanup",
										"progress",
										"requestedAt",
										"finishedAt",
										"disclosure"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/patient-erasures/{id}/retry": {
			"post": {
				"summary": "Retry a parked erasure",
				"tags": [
					"patients"
				],
				"description": "Owner only. Replays an erasure that needs attention from where it stopped. 409 NOTHING_TO_RETRY when it 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": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
												"in_progress",
												"waiting",
												"needs_attention",
												"erased",
												"kept"
											]
										},
										"waitingFor": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"legal_hold",
														"live_call",
														"call_processing",
														"recording_pending",
														"carrier_recording",
														"update"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"attention": {
											"type": [
												"string",
												"null"
											]
										},
										"keptReason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"clinical_record",
														"financial_record"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"keptUntil": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"physicalCleanup": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"in_progress",
														"needs_attention",
														"done"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"progress": {
											"type": "object",
											"properties": {
												"step": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"of": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"step",
												"of"
											],
											"additionalProperties": false
										},
										"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))$"
										},
										"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"
												}
											]
										},
										"disclosure": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"practiceArchives": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"exportFilesUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"transferPackagesUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"importFilesUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"pmsExports": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"webhookDeliveries": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"pmsProvider": {
															"type": [
																"string",
																"null"
															]
														}
													},
													"required": [
														"practiceArchives",
														"exportFilesUntil",
														"transferPackagesUntil",
														"importFilesUntil",
														"pmsExports",
														"webhookDeliveries",
														"pmsProvider"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"status",
										"waitingFor",
										"attention",
										"keptReason",
										"keptUntil",
										"physicalCleanup",
										"progress",
										"requestedAt",
										"finishedAt",
										"disclosure"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/patient-erasures/{id}/retry-cleanup": {
			"post": {
				"summary": "Retry an erasure's file cleanup",
				"tags": [
					"patients"
				],
				"description": "Owner only. Re-arms the erasure's parked file-cleanup obligations into a fresh lifecycle. One parked by a legal hold re-arms only once the hold is released.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"rearmed": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"erasure": {
											"$ref": "#/components/schemas/PatientErasure"
										}
									},
									"required": [
										"rearmed",
										"erasure"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/patient-erasures/{id}/record": {
			"get": {
				"summary": "Read a kept record",
				"tags": [
					"patients"
				],
				"description": "Owner only, checked on the server whatever the role's permissions. What an erasure kept under its restricted identity — the identity, the clinical and financial records and the account graph — one page at a time (`cursor` is the previous page's `nextCursor`), with a one-minute link for each kept document. Every page is audited as a clinical read. 404 when the erasure kept nothing.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 500
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"identity": {
											"anyOf": [
												{
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {}
												},
												{
													"type": "null"
												}
											]
										},
										"tables": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"table": {
														"type": "string"
													},
													"rows": {
														"type": "array",
														"items": {
															"type": "object",
															"propertyNames": {
																"type": "string"
															},
															"additionalProperties": {}
														}
													}
												},
												"required": [
													"table",
													"rows"
												],
												"additionalProperties": false
											}
										},
										"part": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"table": {
															"type": "string"
														},
														"offset": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"text": {
															"type": "string"
														},
														"last": {
															"type": "boolean"
														}
													},
													"required": [
														"table",
														"offset",
														"text",
														"last"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"documents": {
											"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)$"
													},
													"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": [
													"id",
													"path",
													"expiresAt"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"identity",
										"tables",
										"part",
										"documents",
										"nextCursor"
									],
									"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}/export": {
			"get": {
				"summary": "Export everything held about one patient",
				"tags": [
					"patients"
				],
				"description": "The subject-access package as JSON: profile, calls, voicemails, transcripts, Call AI analyses (the patient tier), live transcript lines and live-assist events, the Shop materials chosen for the patient's treatments, the devices placed and the image details, and the clinical record (`clinicalRecord`): treatments, findings, notes, periodontal exams, prescriptions, lab cases, referrals, plans with their acceptances and the chart each completion left, recalls, forms and medical history, episodes, voice notes (consent, transcript, drafts and uses, with a link to the recording) and a manifest of documents and images — every entry with its correction history and `status`. Short-lived signed links reach the stored recordings and documents. The export and its clinical read are written to the audit log; the links are not. A patient erased or being erased answers 404.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
													},
													"machineDetection": {
														"type": [
															"string",
															"null"
														]
													},
													"machineDetectedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"recordingUrl": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"direction",
													"fromNumber",
													"toNumber",
													"status",
													"startedAt",
													"answeredAt",
													"endedAt",
													"durationSec",
													"voicemail",
													"machineDetection",
													"machineDetectedAt",
													"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))$"
													},
													"recordingUrl": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"callLogId",
													"fromNumber",
													"durationSec",
													"heardAt",
													"createdAt",
													"recordingUrl"
												],
												"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": {
														"type": [
															"string",
															"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
											}
										},
										"callAnalyses": {
											"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)$"
													},
													"status": {
														"type": "string",
														"enum": [
															"waiting",
															"pending",
															"processing",
															"stored",
															"skipped",
															"parked"
														]
													},
													"skipReason": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"too_short",
																	"no_patient",
																	"not_eligible",
																	"voicemail",
																	"wrong_number",
																	"no_transcript",
																	"patient_erased"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"analyzedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
																	"booked",
																	"callback_agreed",
																	"not_booked",
																	"no_booking_needed",
																	"voicemail"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"notBookedReason": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"no_booking_ask",
																	"objection_not_handled",
																	"price",
																	"no_suitable_slot",
																	"treatment_not_offered",
																	"needs_time_to_think",
																	"partner_or_family_decision",
																	"comparing_options",
																	"not_ready_yet",
																	"fear_or_anxiety",
																	"finance_not_available",
																	"out_of_area",
																	"not_a_genuine_lead",
																	"other"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"reasonOwner": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"staff",
																	"practice",
																	"patient",
																	"marketing"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"objectionKeys": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"emailDraftStatus": {
														"type": "string",
														"enum": [
															"none",
															"draft",
															"used",
															"dismissed"
														]
													},
													"result": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"v": {
																		"type": "number",
																		"const": 1
																	},
																	"summary": {
																		"type": "string"
																	},
																	"callRecap": {
																		"default": [],
																		"type": "array",
																		"items": {
																			"type": "string"
																		}
																	},
																	"outcomeNote": {
																		"type": "string"
																	},
																	"nextStep": {
																		"anyOf": [
																			{
																				"type": "object",
																				"properties": {
																					"title": {
																						"type": "string"
																					},
																					"dueInDays": {
																						"type": "integer",
																						"minimum": -9007199254740991,
																						"maximum": 9007199254740991
																					}
																				},
																				"required": [
																					"title",
																					"dueInDays"
																				],
																				"additionalProperties": false
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"emailDraft": {
																		"anyOf": [
																			{
																				"type": "object",
																				"properties": {
																					"topic": {
																						"type": "string",
																						"enum": [
																							"price_list",
																							"finance",
																							"consultation_details",
																							"booking_link"
																						]
																					},
																					"subject": {
																						"type": "string"
																					},
																					"body": {
																						"type": "string"
																					}
																				},
																				"required": [
																					"topic",
																					"subject",
																					"body"
																				],
																				"additionalProperties": false
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"nextCallPlan": {
																		"anyOf": [
																			{
																				"type": "object",
																				"properties": {
																					"opener": {
																						"type": "string"
																					},
																					"talkingPoints": {
																						"type": "array",
																						"items": {
																							"type": "string"
																						}
																					}
																				},
																				"required": [
																					"opener",
																					"talkingPoints"
																				],
																				"additionalProperties": false
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"profile": {
																		"type": "object",
																		"properties": {
																			"sentiment": {
																				"anyOf": [
																					{
																						"type": "string",
																						"enum": [
																							"positive",
																							"neutral",
																							"negative"
																						]
																					},
																					{
																						"type": "null"
																					}
																				]
																			},
																			"bookChance": {
																				"type": "string",
																				"enum": [
																					"high",
																					"medium",
																					"low"
																				]
																			},
																			"need": {
																				"default": null,
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"blocker": {
																				"default": null,
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"win": {
																				"default": null,
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"recap": {
																				"default": [],
																				"type": "array",
																				"items": {
																					"type": "string"
																				}
																			},
																			"bookChanceReason": {
																				"default": "",
																				"type": "string"
																			},
																			"bestWayToConvert": {
																				"default": "",
																				"type": "string"
																			},
																			"keyFacts": {
																				"default": [],
																				"type": "array",
																				"items": {
																					"type": "string"
																				}
																			},
																			"motivations": {
																				"default": [],
																				"type": "array",
																				"items": {
																					"type": "string"
																				}
																			},
																			"openConcerns": {
																				"default": [],
																				"type": "array",
																				"items": {
																					"type": "object",
																					"properties": {
																						"said": {
																							"type": "string"
																						},
																						"answer": {
																							"type": "string"
																						}
																					},
																					"required": [
																						"said",
																						"answer"
																					],
																					"additionalProperties": false
																				}
																			}
																		},
																		"required": [
																			"sentiment",
																			"bookChance",
																			"need",
																			"blocker",
																			"win",
																			"recap",
																			"bookChanceReason",
																			"bestWayToConvert",
																			"keyFacts",
																			"motivations",
																			"openConcerns"
																		],
																		"additionalProperties": false
																	}
																},
																"required": [
																	"v",
																	"summary",
																	"callRecap",
																	"outcomeNote",
																	"nextStep",
																	"emailDraft",
																	"nextCallPlan",
																	"profile"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"objections": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"key": {
																	"type": "string"
																},
																"name": {
																	"type": "string"
																},
																"said": {
																	"type": "string"
																}
															},
															"required": [
																"key",
																"name",
																"said"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"callLogId",
													"status",
													"skipReason",
													"analyzedAt",
													"outcome",
													"notBookedReason",
													"reasonOwner",
													"objectionKeys",
													"emailDraftStatus",
													"result",
													"objections"
												],
												"additionalProperties": false
											}
										},
										"callAssistEvents": {
											"type": "array",
											"items": {
												"anyOf": [
													{
														"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)$"
															},
															"kind": {
																"type": "string",
																"enum": [
																	"card",
																	"check",
																	"gap",
																	"unparsed"
																]
															},
															"topic": {
																"type": [
																	"string",
																	"null"
																]
															},
															"title": {
																"type": [
																	"string",
																	"null"
																]
															},
															"question": {
																"type": "string"
															},
															"heardAt": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															"body": {}
														},
														"required": [
															"callLogId",
															"kind",
															"topic",
															"title",
															"question",
															"heardAt",
															"body"
														],
														"additionalProperties": false
													},
													{
														"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)$"
															},
															"kind": {
																"type": "string",
																"enum": [
																	"card",
																	"check",
																	"gap",
																	"unparsed"
																]
															},
															"itemKey": {
																"type": "string"
															},
															"shownAt": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?: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",
															"kind",
															"itemKey",
															"shownAt"
														],
														"additionalProperties": false
													}
												]
											}
										},
										"callLiveSuggestions": {
											"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)$"
													},
													"outcome": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"considering",
																	"callback_later",
																	"booked",
																	"not_proceeding",
																	"going_ahead"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"agreedDate": {
														"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"
															}
														]
													},
													"agreedTime": {
														"type": [
															"string",
															"null"
														]
													},
													"emailTemplate": {
														"type": [
															"string",
															"null"
														]
													},
													"whatsappTemplate": {
														"type": [
															"string",
															"null"
														]
													},
													"email": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"subject": {
																		"type": "string"
																	},
																	"body": {
																		"type": "string"
																	}
																},
																"required": [
																	"subject",
																	"body"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"lostReason": {
														"type": [
															"string",
															"null"
														]
													},
													"treatment": {
														"type": [
															"string",
															"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"
															}
														]
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?: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",
													"outcome",
													"agreedDate",
													"agreedTime",
													"emailTemplate",
													"whatsappTemplate",
													"email",
													"lostReason",
													"treatment",
													"acceptedAt",
													"updatedAt"
												],
												"additionalProperties": false
											}
										},
										"transcriptLines": {
											"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)$"
													},
													"speaker": {
														"type": "string",
														"enum": [
															"patient",
															"practice"
														]
													},
													"text": {
														"type": "string"
													},
													"spokenAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?: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",
													"speaker",
													"text",
													"spokenAt"
												],
												"additionalProperties": false
											}
										},
										"shopMaterials": {
											"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)$"
													},
													"productName": {
														"type": "string"
													},
													"variantLabel": {
														"type": "string"
													},
													"quantity": {
														"type": "number"
													},
													"status": {
														"type": "string",
														"enum": [
															"chosen",
															"deducted",
															"cancelled"
														]
													},
													"chosenAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"deductedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
													"procedureId",
													"productName",
													"variantLabel",
													"quantity",
													"status",
													"chosenAt",
													"deductedAt"
												],
												"additionalProperties": false
											}
										},
										"placedDevices": {
											"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)$"
													},
													"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)$"
													},
													"status": {
														"type": "string",
														"enum": [
															"current",
															"corrected",
															"entered_in_error",
															"voided"
														]
													},
													"correctsId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"correctionReason": {
														"type": [
															"string",
															"null"
														]
													},
													"manufacturer": {
														"type": [
															"string",
															"null"
														]
													},
													"product": {
														"type": [
															"string",
															"null"
														]
													},
													"gtin": {
														"type": [
															"string",
															"null"
														]
													},
													"lot": {
														"type": [
															"string",
															"null"
														]
													},
													"serial": {
														"type": [
															"string",
															"null"
														]
													},
													"expiryOn": {
														"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"
															}
														]
													},
													"size": {
														"type": [
															"string",
															"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"
															}
														]
													},
													"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"
															}
														]
													},
													"source": {
														"type": "string",
														"enum": [
															"scan",
															"manual",
															"shop"
														]
													},
													"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))$"
													}
												},
												"required": [
													"id",
													"procedureId",
													"status",
													"correctsId",
													"correctionReason",
													"manufacturer",
													"product",
													"gtin",
													"lot",
													"serial",
													"expiryOn",
													"size",
													"siteKind",
													"tooth",
													"root",
													"area",
													"source",
													"recordedAt"
												],
												"additionalProperties": false
											}
										},
										"imageDetails": {
											"type": "array",
											"items": {
												"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)$"
													},
													"revision": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"status": {
														"type": "string",
														"enum": [
															"current",
															"corrected",
															"entered_in_error",
															"voided"
														]
													},
													"modality": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"periapical",
																	"bitewing",
																	"occlusal",
																	"panoramic",
																	"cephalometric",
																	"cbct",
																	"intraoral_photo",
																	"extraoral_photo",
																	"scan"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"view": {
														"type": [
															"string",
															"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"
															}
														]
													},
													"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"
															}
														]
													},
													"teeth": {
														"anyOf": [
															{
																"type": "array",
																"items": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																}
															},
															{
																"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"
															}
														]
													},
													"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"
															}
														]
													},
													"justification": {
														"type": [
															"string",
															"null"
														]
													},
													"qualityGrade": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"A",
																	"N"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"evaluation": {
														"type": [
															"string",
															"null"
														]
													},
													"evaluatedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"drawings": {
														"anyOf": [
															{
																"type": "array",
																"items": {
																	"oneOf": [
																		{
																			"type": "object",
																			"properties": {
																				"tool": {
																					"type": "string",
																					"const": "pen"
																				},
																				"color": {
																					"type": "string",
																					"enum": [
																						"red",
																						"yellow",
																						"green",
																						"blue",
																						"white"
																					]
																				},
																				"points": {
																					"minItems": 2,
																					"type": "array",
																					"items": {
																						"type": "array",
																						"prefixItems": [
																							{
																								"type": "number",
																								"minimum": 0,
																								"maximum": 1
																							},
																							{
																								"type": "number",
																								"minimum": 0,
																								"maximum": 1
																							}
																						],
																						"items": false,
																						"minItems": 2,
																						"maxItems": 2
																					}
																				}
																			},
																			"required": [
																				"tool",
																				"color",
																				"points"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"tool": {
																					"type": "string",
																					"const": "line"
																				},
																				"color": {
																					"type": "string",
																					"enum": [
																						"red",
																						"yellow",
																						"green",
																						"blue",
																						"white"
																					]
																				},
																				"from": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				},
																				"to": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				}
																			},
																			"required": [
																				"tool",
																				"color",
																				"from",
																				"to"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"tool": {
																					"type": "string",
																					"const": "arrow"
																				},
																				"color": {
																					"type": "string",
																					"enum": [
																						"red",
																						"yellow",
																						"green",
																						"blue",
																						"white"
																					]
																				},
																				"from": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				},
																				"to": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				}
																			},
																			"required": [
																				"tool",
																				"color",
																				"from",
																				"to"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"tool": {
																					"type": "string",
																					"const": "circle"
																				},
																				"color": {
																					"type": "string",
																					"enum": [
																						"red",
																						"yellow",
																						"green",
																						"blue",
																						"white"
																					]
																				},
																				"from": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				},
																				"to": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				}
																			},
																			"required": [
																				"tool",
																				"color",
																				"from",
																				"to"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"tool": {
																					"type": "string",
																					"const": "rect"
																				},
																				"color": {
																					"type": "string",
																					"enum": [
																						"red",
																						"yellow",
																						"green",
																						"blue",
																						"white"
																					]
																				},
																				"from": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				},
																				"to": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				}
																			},
																			"required": [
																				"tool",
																				"color",
																				"from",
																				"to"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"tool": {
																					"type": "string",
																					"const": "text"
																				},
																				"color": {
																					"type": "string",
																					"enum": [
																						"red",
																						"yellow",
																						"green",
																						"blue",
																						"white"
																					]
																				},
																				"at": {
																					"type": "array",
																					"prefixItems": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					],
																					"items": false,
																					"minItems": 2,
																					"maxItems": 2
																				},
																				"text": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 200
																				}
																			},
																			"required": [
																				"tool",
																				"color",
																				"at",
																				"text"
																			],
																			"additionalProperties": false
																		}
																	]
																}
															},
															{
																"type": "null"
															}
														]
													},
													"drawnByName": {
														"type": [
															"string",
															"null"
														]
													},
													"drawnAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"required": [
													"documentId",
													"revision",
													"status",
													"modality",
													"view",
													"siteKind",
													"tooth",
													"root",
													"area",
													"teeth",
													"takenOn",
													"appointmentId",
													"procedureId",
													"justification",
													"qualityGrade",
													"evaluation",
													"evaluatedAt",
													"drawings",
													"drawnByName",
													"drawnAt",
													"recordedAt"
												],
												"additionalProperties": false
											}
										},
										"imagingCaptures": {
											"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": [
															"receiving",
															"waiting",
															"filing",
															"filed",
															"unsupported",
															"discarded"
														]
													},
													"detectedType": {
														"type": "string",
														"enum": [
															"jpeg",
															"png",
															"dicom",
															"other"
														]
													},
													"fileName": {
														"type": [
															"string",
															"null"
														]
													},
													"bytes": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"sha256": {
														"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))$"
													},
													"filedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
															}
														]
													},
													"suggested": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"state",
													"detectedType",
													"fileName",
													"bytes",
													"sha256",
													"receivedAt",
													"filedAt",
													"documentId",
													"suggested"
												],
												"additionalProperties": false
											}
										},
										"stickyNotes": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientStickyNote"
											}
										},
										"fileShares": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"recipient": {
														"type": "string"
													},
													"note": {
														"type": [
															"string",
															"null"
														]
													},
													"sharedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"sharedByName": {
														"type": [
															"string",
															"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"
															}
														]
													},
													"turnedOffAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": 0,
														"maximum": 9007199254740991
													},
													"lastOpenedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"files": {
														"type": "array",
														"items": {
															"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)$"
																},
																"title": {
																	"type": "string"
																}
															},
															"required": [
																"documentId",
																"title"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"recipient",
													"note",
													"sharedAt",
													"sharedByName",
													"expiresAt",
													"turnedOffAt",
													"openCount",
													"lastOpenedAt",
													"files"
												],
												"additionalProperties": false
											}
										},
										"clinicalRecord": {
											"$ref": "#/components/schemas/PatientClinicalRecordExport"
										}
									},
									"required": [
										"exportedAt",
										"profile",
										"calls",
										"voicemails",
										"transcripts",
										"callAnalyses",
										"callAssistEvents",
										"callLiveSuggestions",
										"transcriptLines",
										"shopMaterials",
										"placedDevices",
										"imageDetails",
										"imagingCaptures",
										"stickyNotes",
										"fileShares",
										"clinicalRecord"
									],
									"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. For a signed-in member of a practice in a SmileDesign country, in its PMS workspace, who may read the patient's documents, the patient's SmileDesign events are among them as Changes (on no journey, from no import): a `pms_event` whose `properties.smileDesign` names the event (`created`, `duplicated`, `hd_ready`, `hd_accepted`, `video_ready`, `video_accepted`, `shared`) and the design (`designId`). They are read from the designs as they stand, never stored, and a page that shows one is audited as a clinical 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)$"
						}
					},
					{
						"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",
								"patient_app"
							]
						}
					},
					{
						"name": "imported",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"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": "category",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"calls",
								"messages",
								"notes",
								"changes",
								"thread"
							]
						}
					}
				],
				"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
										},
										"counts": {
											"type": "object",
											"properties": {
												"calls": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"messages": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"notes": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"changes": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"calls",
												"messages",
												"notes",
												"changes"
											],
											"additionalProperties": false
										}
									},
									"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}/new-lead-window-closures": {
			"post": {
				"summary": "Log why a new lead's desktop window was closed unhandled",
				"tags": [
					"patients"
				],
				"description": "activity:create. The reason (required) is saved as a titled note on the lead's timeline and task, which cannot be edited. 404 when the patient, journey or task is not this practice's, or the journey or task is not this patient's.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"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)$"
									},
									"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)$"
									},
									"reason": {
										"type": "string",
										"minLength": 1
									}
								},
								"required": [
									"taskId",
									"journeyId",
									"reason"
								]
							}
						}
					}
				},
				"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}/notes/{noteId}": {
			"patch": {
				"summary": "Edit your own note on the patient timeline",
				"tags": [
					"patients"
				],
				"description": "Only the note's author can edit it, and only a note a team member typed (not a referral, inbox, automation, form or patient note). The previous text is kept in the audit log. 409 NOTE_CONFLICT when the note changed since `expectedEditedAt` (details.current holds it); 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": "noteId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"expectedEditedAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
									"body",
									"expectedEditedAt"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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}/sticky-notes": {
			"post": {
				"summary": "Add a sticky note to a patient",
				"tags": [
					"patients"
				],
				"description": "Idempotent on the note id: the same id and body replays; the same id with another body is 409 STICKY_NOTE_ID_REUSED. Returns the patient's notes. 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": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 10000
									}
								},
								"required": [
									"id",
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientStickyNote"
											}
										},
										"dismissedSeen": {
											"anyOf": [
												{
													"type": "array",
													"items": {
														"type": "string"
													}
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"dismissedSeen"
									],
									"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}/sticky-notes/{noteId}": {
			"patch": {
				"summary": "Edit a patient's sticky note",
				"tags": [
					"patients"
				],
				"description": "Refused with 409 STICKY_NOTE_CONFLICT (the current note in details.current) when the note changed since `expectedUpdatedAt`. Returns the patient's notes.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "noteId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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,
										"maxLength": 10000
									},
									"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",
									"expectedUpdatedAt"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientStickyNote"
											}
										},
										"dismissedSeen": {
											"anyOf": [
												{
													"type": "array",
													"items": {
														"type": "string"
													}
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"dismissedSeen"
									],
									"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 a patient's sticky note",
				"tags": [
					"patients"
				],
				"description": "Refused with 409 STICKY_NOTE_CONFLICT when the note changed since `expectedUpdatedAt`; a note already gone returns the notes unchanged. Returns the patient's notes.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "noteId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "expectedUpdatedAt",
						"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": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientStickyNote"
											}
										},
										"dismissedSeen": {
											"anyOf": [
												{
													"type": "array",
													"items": {
														"type": "string"
													}
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"dismissedSeen"
									],
									"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}/sticky-notes/dismiss": {
			"post": {
				"summary": "Hide a patient's sticky notes for the signed-in member",
				"tags": [
					"patients"
				],
				"description": "Records the notes in view (`seen`) when the member hid the stack: it stops sliding in for them until another note exists. Needs only patient read access.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"seen": {
										"type": "array",
										"items": {
											"type": "string",
											"maxLength": 100
										}
									}
								},
								"required": [
									"seen"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PatientStickyNote"
											}
										},
										"dismissedSeen": {
											"anyOf": [
												{
													"type": "array",
													"items": {
														"type": "string"
													}
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"dismissedSeen"
									],
									"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/{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, one keyset page at a time: pass `nextCursor` back as `cursor` until it is null (an invalid cursor is 400 INVALID_CURSOR).",
				"parameters": [
					{
						"name": "entity",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"patients",
								"conversations",
								"reports"
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SavedView"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			},
			"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",
								"reports"
							]
						}
					}
				],
				"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": {
													"match": {
														"type": "string",
														"enum": [
															"all",
															"any"
														]
													},
													"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
													},
													"age": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": 0,
																"maximum": 150
															},
															"to": {
																"type": "integer",
																"minimum": 0,
																"maximum": 150
															}
														},
														"additionalProperties": false
													},
													"birthday": {
														"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
															}
														]
													},
													"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
													},
													"dentistPractitionerId": {
														"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
													},
													"hygienistPractitionerId": {
														"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
													},
													"defaultPriceListId": {
														"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
													},
													"nextVisit": {
														"type": "object",
														"properties": {
															"present": {
																"type": "boolean"
															}
														},
														"required": [
															"present"
														],
														"additionalProperties": false
													},
													"lastVisit": {
														"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
															}
														]
													},
													"firstVisit": {
														"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
															}
														]
													},
													"nextVisitAt": {
														"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
															}
														]
													},
													"lastMissed": {
														"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
															}
														]
													},
													"recallDue": {
														"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
															}
														]
													},
													"accountBalance": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"totalInvoiced": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"totalPaid": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed0to29": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed30to59": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed60to89": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed90plus": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"plannedValue": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"recallMethod": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"phone",
																		"sms",
																		"email",
																		"whatsapp",
																		"letter"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"recallType": {
														"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)$"
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"recallInterval": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": 1,
																"maximum": 32767
															},
															"to": {
																"type": "integer",
																"minimum": 1,
																"maximum": 32767
															}
														},
														"additionalProperties": false
													},
													"visitType": {
														"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)$"
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"treatment": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"treatmentCompletedOn": {
														"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
															}
														]
													},
													"treatmentCharged": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"treatmentReferredBy": {
														"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
													},
													"bookedAt": {
														"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
															}
														]
													},
													"bookedBy": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"minLength": 1
																}
															},
															"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)$"
																}
															},
															"channelIn": {
																"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"
																	]
																}
															},
															"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
																	}
																]
															},
															"campaign": {
																"type": "string",
																"minLength": 1,
																"maxLength": 4000
															},
															"notContacted": {
																"type": "boolean",
																"const": true
															}
														},
														"additionalProperties": false
													}
												},
												"additionalProperties": false
											},
											"columns": {
												"maxItems": 30,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"name",
														"status",
														"contact",
														"email",
														"phoneMobile",
														"tags",
														"leadSource",
														"location",
														"city",
														"province",
														"dateOfBirth",
														"age",
														"gender",
														"language",
														"preferredContactMethod",
														"smsOptOut",
														"emailOptOut",
														"whatsappOptOut",
														"fiscalCode",
														"chartNumber",
														"createdAt",
														"updatedAt",
														"dentist",
														"hygienist",
														"priceList",
														"nextVisit",
														"lastVisit",
														"recall",
														"balance",
														"owedFor",
														"plannedValue",
														"legacyChartNumber",
														"occupation",
														"gp",
														"emergencyContact",
														"practitionerGenderPreference"
													]
												}
											},
											"sort": {
												"type": "string",
												"enum": [
													"createdAt",
													"updatedAt",
													"lastName",
													"firstName",
													"status",
													"dateOfBirth",
													"city",
													"email",
													"nextVisit",
													"lastVisit",
													"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",
																	"patient_app"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assignee": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															{
																"type": "null"
															}
														]
													},
													"unread": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											}
										},
										"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": {
													"report": {
														"type": "string",
														"enum": [
															"dashboard",
															"snapshot",
															"lead-volume",
															"lead-sources",
															"lead-attribution",
															"calls",
															"call-insights",
															"call-insights-weekly-digest",
															"funnel",
															"conversion-summary",
															"speed-to-lead",
															"lost-journeys",
															"revenue-summary",
															"revenue-by-treatment",
															"pipeline-value",
															"patient-value",
															"patient-retention",
															"recall-success",
															"appointment-volume",
															"attendance",
															"appointments",
															"appointments-per-month",
															"recalls",
															"waiting-lists",
															"team-activity",
															"team-conversion",
															"practitioner-performance",
															"team-calling",
															"referral-program",
															"lead-flow",
															"seo-weekly-digest",
															"ads-weekly-digest",
															"day-sheet",
															"aged-debt",
															"patient-accounts",
															"income",
															"production",
															"collections",
															"associate-pay",
															"utilisation",
															"sundries",
															"invoice-timeline",
															"invoice-months",
															"payment-allocations",
															"payment-allocation-totals",
															"monthly-accounts",
															"radiograph-audit",
															"perio-coverage",
															"treatment-completed",
															"practitioner-activity",
															"treatment-plans",
															"plans-completed-not-closed",
															"unbooked-treatment",
															"unfinished-treatment",
															"lab-turnaround",
															"prescriptions-issued",
															"new-patients",
															"new-patient-visits",
															"clinical-referrals",
															"age-groups",
															"birthdays",
															"lapsed-patients",
															"audit",
															"report-runs",
															"user-sessions",
															"stock-summary",
															"low-stock",
															"stock-usage",
															"stock-transactions",
															"stock-moves",
															"stock-expiry"
														]
													},
													"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
															},
															"stockRoomId": {
																"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
															},
															"stockItemName": {
																"type": "object",
																"properties": {
																	"contains": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 200
																	},
																	"eq": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 200
																	},
																	"present": {
																		"type": "boolean"
																	}
																},
																"additionalProperties": false
															},
															"stockMovementKind": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"take",
																				"restock",
																				"count",
																				"move",
																				"revalue"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"stockMovementSource": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"manual",
																				"procedure_completion",
																				"shop_delivery",
																				"shop_check_in",
																				"shop_return",
																				"transfer",
																				"stocktake",
																				"pick_list",
																				"purchase_order",
																				"opening",
																				"import"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"staffUserId": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"maxItems": 100,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"minLength": 1
																		}
																	},
																	"present": {
																		"type": "boolean"
																	}
																},
																"additionalProperties": false
															},
															"paymentMethodId": {
																"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
															},
															"allocation": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"unallocated"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"paymentSearch": {
																"type": "object",
																"properties": {
																	"contains": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 200
																	}
																},
																"required": [
																	"contains"
																],
																"additionalProperties": false
															},
															"callObjection": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"maxItems": 100,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"pattern": "^[a-z][a-z_]{0,39}$"
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"invoiceState": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"paid",
																				"unpaid"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"accountState": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"debit",
																				"credit",
																				"settled"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"auditAction": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"create",
																				"update",
																				"delete",
																				"merge",
																				"export",
																				"access",
																				"import"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"auditEntityType": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"maxItems": 500,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 100
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"recallStatus": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"booked",
																				"unbooked"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															}
														},
														"additionalProperties": false
													},
													"grain": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"day",
																	"week",
																	"month"
																]
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"report",
													"filters",
													"grain"
												],
												"additionalProperties": false
											}
										},
										"required": [
											"name",
											"filters"
										],
										"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",
								"reports"
							]
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
													"match": {
														"type": "string",
														"enum": [
															"all",
															"any"
														]
													},
													"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
													},
													"age": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": 0,
																"maximum": 150
															},
															"to": {
																"type": "integer",
																"minimum": 0,
																"maximum": 150
															}
														},
														"additionalProperties": false
													},
													"birthday": {
														"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
															}
														]
													},
													"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
													},
													"dentistPractitionerId": {
														"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
													},
													"hygienistPractitionerId": {
														"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
													},
													"defaultPriceListId": {
														"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
													},
													"nextVisit": {
														"type": "object",
														"properties": {
															"present": {
																"type": "boolean"
															}
														},
														"required": [
															"present"
														],
														"additionalProperties": false
													},
													"lastVisit": {
														"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
															}
														]
													},
													"firstVisit": {
														"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
															}
														]
													},
													"nextVisitAt": {
														"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
															}
														]
													},
													"lastMissed": {
														"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
															}
														]
													},
													"recallDue": {
														"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
															}
														]
													},
													"accountBalance": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"totalInvoiced": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"totalPaid": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed0to29": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed30to59": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed60to89": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"owed90plus": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"plannedValue": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"to": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"additionalProperties": false
													},
													"recallMethod": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"phone",
																		"sms",
																		"email",
																		"whatsapp",
																		"letter"
																	]
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"recallType": {
														"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)$"
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"recallInterval": {
														"type": "object",
														"properties": {
															"from": {
																"type": "integer",
																"minimum": 1,
																"maximum": 32767
															},
															"to": {
																"type": "integer",
																"minimum": 1,
																"maximum": 32767
															}
														},
														"additionalProperties": false
													},
													"visitType": {
														"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)$"
																}
															}
														},
														"required": [
															"in"
														],
														"additionalProperties": false
													},
													"treatment": {
														"type": "object",
														"properties": {
															"contains": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"eq": {
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															"present": {
																"type": "boolean"
															}
														},
														"additionalProperties": false
													},
													"treatmentCompletedOn": {
														"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
															}
														]
													},
													"treatmentCharged": {
														"type": "object",
														"properties": {
															"eq": {
																"type": "boolean"
															}
														},
														"required": [
															"eq"
														],
														"additionalProperties": false
													},
													"treatmentReferredBy": {
														"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
													},
													"bookedAt": {
														"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
															}
														]
													},
													"bookedBy": {
														"type": "object",
														"properties": {
															"in": {
																"minItems": 1,
																"maxItems": 100,
																"type": "array",
																"items": {
																	"type": "string",
																	"minLength": 1
																}
															},
															"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)$"
																}
															},
															"channelIn": {
																"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"
																	]
																}
															},
															"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
																	}
																]
															},
															"campaign": {
																"type": "string",
																"minLength": 1,
																"maxLength": 4000
															},
															"notContacted": {
																"type": "boolean",
																"const": true
															}
														},
														"additionalProperties": false
													}
												},
												"additionalProperties": false
											},
											"columns": {
												"maxItems": 30,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"name",
														"status",
														"contact",
														"email",
														"phoneMobile",
														"tags",
														"leadSource",
														"location",
														"city",
														"province",
														"dateOfBirth",
														"age",
														"gender",
														"language",
														"preferredContactMethod",
														"smsOptOut",
														"emailOptOut",
														"whatsappOptOut",
														"fiscalCode",
														"chartNumber",
														"createdAt",
														"updatedAt",
														"dentist",
														"hygienist",
														"priceList",
														"nextVisit",
														"lastVisit",
														"recall",
														"balance",
														"owedFor",
														"plannedValue",
														"legacyChartNumber",
														"occupation",
														"gp",
														"emergencyContact",
														"practitionerGenderPreference"
													]
												}
											},
											"sort": {
												"type": "string",
												"enum": [
													"createdAt",
													"updatedAt",
													"lastName",
													"firstName",
													"status",
													"dateOfBirth",
													"city",
													"email",
													"nextVisit",
													"lastVisit",
													"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",
																	"patient_app"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assignee": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 200
															},
															{
																"type": "null"
															}
														]
													},
													"unread": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											}
										},
										"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": {
													"report": {
														"type": "string",
														"enum": [
															"dashboard",
															"snapshot",
															"lead-volume",
															"lead-sources",
															"lead-attribution",
															"calls",
															"call-insights",
															"call-insights-weekly-digest",
															"funnel",
															"conversion-summary",
															"speed-to-lead",
															"lost-journeys",
															"revenue-summary",
															"revenue-by-treatment",
															"pipeline-value",
															"patient-value",
															"patient-retention",
															"recall-success",
															"appointment-volume",
															"attendance",
															"appointments",
															"appointments-per-month",
															"recalls",
															"waiting-lists",
															"team-activity",
															"team-conversion",
															"practitioner-performance",
															"team-calling",
															"referral-program",
															"lead-flow",
															"seo-weekly-digest",
															"ads-weekly-digest",
															"day-sheet",
															"aged-debt",
															"patient-accounts",
															"income",
															"production",
															"collections",
															"associate-pay",
															"utilisation",
															"sundries",
															"invoice-timeline",
															"invoice-months",
															"payment-allocations",
															"payment-allocation-totals",
															"monthly-accounts",
															"radiograph-audit",
															"perio-coverage",
															"treatment-completed",
															"practitioner-activity",
															"treatment-plans",
															"plans-completed-not-closed",
															"unbooked-treatment",
															"unfinished-treatment",
															"lab-turnaround",
															"prescriptions-issued",
															"new-patients",
															"new-patient-visits",
															"clinical-referrals",
															"age-groups",
															"birthdays",
															"lapsed-patients",
															"audit",
															"report-runs",
															"user-sessions",
															"stock-summary",
															"low-stock",
															"stock-usage",
															"stock-transactions",
															"stock-moves",
															"stock-expiry"
														]
													},
													"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
															},
															"stockRoomId": {
																"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
															},
															"stockItemName": {
																"type": "object",
																"properties": {
																	"contains": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 200
																	},
																	"eq": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 200
																	},
																	"present": {
																		"type": "boolean"
																	}
																},
																"additionalProperties": false
															},
															"stockMovementKind": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"take",
																				"restock",
																				"count",
																				"move",
																				"revalue"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"stockMovementSource": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"manual",
																				"procedure_completion",
																				"shop_delivery",
																				"shop_check_in",
																				"shop_return",
																				"transfer",
																				"stocktake",
																				"pick_list",
																				"purchase_order",
																				"opening",
																				"import"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"staffUserId": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"maxItems": 100,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"minLength": 1
																		}
																	},
																	"present": {
																		"type": "boolean"
																	}
																},
																"additionalProperties": false
															},
															"paymentMethodId": {
																"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
															},
															"allocation": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"unallocated"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"paymentSearch": {
																"type": "object",
																"properties": {
																	"contains": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 200
																	}
																},
																"required": [
																	"contains"
																],
																"additionalProperties": false
															},
															"callObjection": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"maxItems": 100,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"pattern": "^[a-z][a-z_]{0,39}$"
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"invoiceState": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"paid",
																				"unpaid"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"accountState": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"debit",
																				"credit",
																				"settled"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"auditAction": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"create",
																				"update",
																				"delete",
																				"merge",
																				"export",
																				"access",
																				"import"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"auditEntityType": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"maxItems": 500,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 100
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															},
															"recallStatus": {
																"type": "object",
																"properties": {
																	"in": {
																		"minItems": 1,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"enum": [
																				"booked",
																				"unbooked"
																			]
																		}
																	}
																},
																"required": [
																	"in"
																],
																"additionalProperties": false
															}
														},
														"additionalProperties": false
													},
													"grain": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"day",
																	"week",
																	"month"
																]
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"report",
													"filters",
													"grain"
												],
												"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",
								"reports"
							]
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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 (into the won stage for going ahead), a not_proceeding outcome and reopen. `duplicateHintDismissed: true` is Keep both: the record stops warning that this General enquiry looks like a duplicate.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {}
									},
									"duplicateHintDismissed": {
										"type": "boolean",
										"const": true
									}
								},
								"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 the pipeline's \"won\" stage records that the patient is going ahead: it also sets status=won and closedAt. 409 when the lead is locked by another user on the Today page (LOCKED); 503 when that lock could not be checked (LOCK_CHECK_UNAVAILABLE, nothing saved) or the save was interrupted (SAVE_INTERRUPTED) — retry the 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)$"
						}
					}
				],
				"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"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. The optional reason (else the label of the lost reason the journey closed with) is kept as junkReason and shown, with the lead's name, to the practice's partner agency in its lead reports. Marking an already-junk journey changes nothing: unmark it first to give a different 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
									},
									"reason": {
										"type": "string",
										"maxLength": 500
									}
								},
								"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 and its reason, which also withdraws the lead from the partner's lead reports. 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"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}/combine": {
			"post": {
				"summary": "Combine a duplicate journey into another",
				"tags": [
					"journeys"
				],
				"description": "Folds the path's journey (normally a General enquiry) into `intoJourneyId`, the same patient's open journey on the same board: the folded one is archived as combined, its automatic chasing (the Call now card, nurture, a queued AI call) stops, its other open tasks move to the kept journey and its pending ad conversions are skipped as merged. Both versions must be the ones shown; a booking, a deposit, an ad conversion being sent or an AI call ringing on either journey refuses it. 409 JOURNEY_COMBINE_REFUSED names why in `details.reason` (one of JOURNEY_COMBINE_REFUSALS) and changes nothing; 404 when either journey is not this practice's, they belong to different patients, or the patient was erased. Needs journey:update.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"intoJourneyId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"fromVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"intoVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"intoJourneyId",
									"fromVersion",
									"intoVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"journey": {
											"$ref": "#/components/schemas/Journey"
										}
									},
									"required": [
										"journey"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": {
										"type": [
											"string",
											"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": {
										"type": [
											"string",
											"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"
				],
				"description": "A dentist, hygienist or nurse sees only their own tasks: assigned to or created by them, on no lead journey, of kind `staff`, `compliance_check` or `worklist:<kind>`. The same scope applies to GET, PATCH and complete (a task outside it answers 404). `q` matches the task's title, or its patient as `GET /patients?q=` does.",
				"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",
								"completedAt"
							]
						}
					},
					{
						"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",
								"week",
								"later"
							]
						}
					},
					{
						"name": "hideWaiting",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 120
						}
					}
				],
				"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"
				],
				"description": "Kinds `compliance_check` and `staff_record_expiry` are opened only by a due compliance check or an expiring staff record (400 TASK_KIND_RESERVED). A dentist, hygienist or nurse creates kind `staff` (the default for them) or `worklist:<kind>`, never on a journey (403 OWN_TASKS_ONLY). The task's `workspace` follows from it: `crm` on a journey; else `pms` for a staff or worklist task, or one assigned to a dentist, hygienist or nurse; else `crm`. A `crm` task assigned to a dentist, hygienist or nurse, who could never see it, answers 422 TASK_ASSIGNEE_CANNOT_SEE; one assigned to a suspended member answers 422 ASSIGNEE_SUSPENDED.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"title": {
										"type": "string",
										"minLength": 1
									},
									"kind": {
										"type": "string",
										"minLength": 1
									},
									"note": {
										"type": [
											"string",
											"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/team": {
			"get": {
				"summary": "Every open task of the clinic team",
				"tags": [
					"tasks"
				],
				"description": "To do › Team tasks: every open task in the clinic's workspace (`workspace` `pms`, on no lead journey), assigned or not, soonest due first and undated last, one page at a time — pass `nextCursor` back as `cursor` until it is null. A task of a patient erased or being erased is left out. For a role that works every task; a dentist, hygienist or nurse answers 403 OWN_TASKS_ONLY. An invalid cursor answers 400.",
				"parameters": [
					{
						"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": "due",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"overdue",
								"today",
								"upcoming",
								"week",
								"later"
							]
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"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/Task"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/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"
				],
				"description": "409 VERSION_CONFLICT on a stale expectedVersion; 409 COMPLIANCE_TASK_NEEDS_ENTRY when a compliance check's task would change status or kind (it closes by recording the check; assignee, due date, priority, title and note stay editable); 400 TASK_KIND_RESERVED when any other task would become compliance_check or staff_record_expiry, or a staff record's reminder would change kind. The check or staff record a task belongs to is never editable here. A dentist, hygienist or nurse gets 403 OWN_TASKS_ONLY when the edit would link a journey, give the task a kind they may not create, or leave the task no longer theirs. Linking a journey makes the task `crm` work; a reassignment or that move answers 422 TASK_ASSIGNEE_CANNOT_SEE when the assignee is a dentist, hygienist or nurse, who could never see a `crm` task. A new assignee must be a live member (422 ASSIGNEE_SUSPENDED); a task already with a suspended member keeps them until reassigned. Moving a `flexible` retry's `dueAt` by hand makes it a `kept` call-back (the time a person chose), which nothing automatic moves or closes.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
										"type": [
											"string",
											"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"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 (LOCKED), or for a compliance check's task, which closes only by recording the check (COMPLIANCE_TASK_NEEDS_ENTRY); 503 when that lock could not be checked (LOCK_CHECK_UNAVAILABLE, nothing saved) or the save was interrupted (SAVE_INTERRUPTED) — retry the 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)$"
						}
					}
				],
				"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/reopen": {
			"post": {
				"summary": "Reopen a completed task",
				"tags": [
					"tasks"
				],
				"description": "Moves a task that was simply ticked done back to open: its completion is cleared on the task and kept in its history with the reason (`task_reopened`). Refused with 409 TASK_NOT_REOPENABLE for a task that is not done, one closed by a recorded outcome or a stage move (which keeps its own Undo), a lead's task, and a compliance check's, staff record's, outcome record's or attendance question's task; 409 VERSION_CONFLICT on a stale expectedVersion, so a repeat never reopens twice. The same scope as PATCH applies (404 outside 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
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1000
									}
								},
								"required": [
									"expectedVersion",
									"reason"
								]
							}
						}
					}
				},
				"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}/cancel": {
			"post": {
				"summary": "Cancel an open task with a reason",
				"tags": [
					"tasks"
				],
				"description": "Moves an open task to cancelled and keeps the reason in its history (`task_cancelled`). 409 TASK_NOT_OPEN when it is not open; 409 COMPLIANCE_TASK_NEEDS_ENTRY for a compliance check's task, which closes by recording the check (or disabling it); 409 TASK_KIND_RESERVED for an outcome record; 409 VERSION_CONFLICT on a stale expectedVersion. The same scope as PATCH applies (404 outside 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
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1000
									}
								},
								"required": [
									"expectedVersion",
									"reason"
								]
							}
						}
					}
				},
				"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}/history": {
			"get": {
				"summary": "A task's history, newest first",
				"tags": [
					"tasks"
				],
				"description": "One page at a time: pass `nextCursor` back as `cursor` until it is null. A task the caller cannot read answers 404 before any history is read; an entry about an erased patient is left out. An invalid cursor answers 400.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "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/TaskHistoryEvent"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/next-callback": {
			"get": {
				"summary": "When a lead nobody reached would be called next",
				"tags": [
					"tasks"
				],
				"description": "The retry POST /tasks/:id/outcome would plan for a no_answer, message_sent or no_show recorded now: every try of a chain inside its three calling days of the task's location (else the journey's, else the automation site) — a new three once they hold no more tries — at the practice's best hours to reach people, its opening hours and closures, counting this try. `at` is its aim, `availableAt` when it may be called early and `reason` why it is aimed there; `lastTry` says this try makes the practice's tries since the last conversation and closes the lead as Unable to contact instead (then `at` is the moment of asking). Saving later re-plans from then. Reads nothing else and writes nothing. 404 when the caller cannot read the 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"at": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"availableAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"reason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"best_time",
														"stated_morning",
														"stated_afternoon",
														"stated_evening",
														"stated_hours",
														"answered_before",
														"soon"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"lastTry": {
											"type": "boolean"
										}
									},
									"required": [
										"at",
										"availableAt",
										"reason",
										"lastTry"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/consultation-visit": {
			"get": {
				"summary": "The consultation a consultation check asks about",
				"tags": [
					"tasks"
				],
				"description": "For an open `consultation_check` task: the diary visit its booking stands for (the visit pinned on the check, else the one the booking named, else the patient's single visit that day) and how it can be moved — `check` (no visit), `diary` (Smileline's own diary), `pms` (the connected PMS moves it: Dentally, Open Dental) or `pms_check` (the PMS cannot be written to; the question moves and the sync brings the visit). `messages` names, per answer, the channels of the appointment messages switched on for this visit (settings, not a delivery promise; null when unknown). `pms.operation` is the latest provider move while the visit is not yet where it was asked to go. Reads only. 404 when the caller cannot read the task; 409 NOT_A_CONSULTATION_CHECK, TASK_NOT_OPEN, CONSULTATION_CHECK_SUPERSEDED, or PMS_OPERATION_PENDING while the PMS is still creating the 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"mode": {
											"type": "string",
											"enum": [
												"check",
												"diary",
												"pms",
												"pms_check"
											]
										},
										"visit": {
											"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)$"
														},
														"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"
														},
														"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"
																}
															]
														},
														"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"
																}
															]
														},
														"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"
																}
															]
														},
														"status": {
															"type": "string",
															"enum": [
																"pending",
																"booked",
																"confirmed",
																"arrived",
																"in_chair",
																"fulfilled",
																"cancelled",
																"no_show"
															]
														}
													},
													"required": [
														"appointmentId",
														"startsAt",
														"endsAt",
														"timezone",
														"locationId",
														"appointmentTypeId",
														"treatmentId",
														"practitionerIds",
														"operatoryId",
														"status"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"pms": {
											"anyOf": [
												{
													"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)$"
														},
														"provider": {
															"type": "string",
															"enum": [
																"dentally",
																"dentally_nexgen",
																"aerona",
																"exact",
																"carestream_r4",
																"systems_for_dentists",
																"pearl",
																"dentrix",
																"eaglesoft",
																"open_dental",
																"denticon",
																"sensei",
																"curve_dental",
																"carestack",
																"tab32",
																"archy",
																"oryx",
																"other"
															]
														},
														"label": {
															"type": "string"
														},
														"canMove": {
															"type": "boolean"
														},
														"operation": {
															"anyOf": [
																{
																	"$ref": "#/components/schemas/PmsAppointmentOperation"
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"connectionId",
														"provider",
														"label",
														"canMove",
														"operation"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"messages": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"missed": {
															"type": "array",
															"items": {
																"type": "string",
																"enum": [
																	"email",
																	"sms",
																	"whatsapp"
																]
															}
														},
														"moved": {
															"type": "array",
															"items": {
																"type": "string",
																"enum": [
																	"email",
																	"sms",
																	"whatsapp"
																]
															}
														},
														"cancelled": {
															"type": "array",
															"items": {
																"type": "string",
																"enum": [
																	"email",
																	"sms",
																	"whatsapp"
																]
															}
														},
														"afterVisit": {
															"type": "array",
															"items": {
																"type": "string",
																"enum": [
																	"email",
																	"sms",
																	"whatsapp"
																]
															}
														}
													},
													"required": [
														"missed",
														"moved",
														"cancelled",
														"afterVisit"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"mode",
										"visit",
										"pms",
										"messages"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/pms-conflict": {
			"get": {
				"summary": "The double booking a PMS conflict review is about",
				"tags": [
					"tasks"
				],
				"description": "For a `pms_appointment_conflict_review` task: the visit the practice system sent, the visits it clashed with (those it was filed against and any it still overlaps on the same practitioner or room), and whether it still clashes. Each visit names its time and timezone, practitioners, room, status, how it was booked and its practice system; its patient only with patient:read and while the patient is not erased. The task closes itself once the clash is gone. Reads only; needs task:read and appointment:read. 404 when the caller cannot read the task; 409 NOT_A_PMS_CONFLICT_REVIEW for any other 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"visit": {
											"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)$"
														},
														"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"
														},
														"status": {
															"type": "string",
															"enum": [
																"pending",
																"booked",
																"confirmed",
																"arrived",
																"in_chair",
																"fulfilled",
																"cancelled",
																"no_show"
															]
														},
														"bookedVia": {
															"type": "string",
															"enum": [
																"staff",
																"online",
																"api",
																"automation",
																"pms",
																"import"
															]
														},
														"pms": {
															"anyOf": [
																{
																	"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)$"
																		},
																		"provider": {
																			"type": "string",
																			"enum": [
																				"dentally",
																				"dentally_nexgen",
																				"aerona",
																				"exact",
																				"carestream_r4",
																				"systems_for_dentists",
																				"pearl",
																				"dentrix",
																				"eaglesoft",
																				"open_dental",
																				"denticon",
																				"sensei",
																				"curve_dental",
																				"carestack",
																				"tab32",
																				"archy",
																				"oryx",
																				"other"
																			]
																		}
																	},
																	"required": [
																		"connectionId",
																		"provider"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"practitioners": {
															"type": "array",
															"items": {
																"type": "string"
															}
														},
														"room": {
															"type": [
																"string",
																"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)$"
																		},
																		"firstName": {
																			"type": "string"
																		},
																		"lastName": {
																			"type": "string"
																		},
																		"preferredName": {
																			"type": [
																				"string",
																				"null"
																			]
																		}
																	},
																	"required": [
																		"id",
																		"firstName",
																		"lastName",
																		"preferredName"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"appointmentId",
														"startsAt",
														"endsAt",
														"timezone",
														"status",
														"bookedVia",
														"pms",
														"practitioners",
														"room",
														"patient"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"clashes": {
											"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)$"
													},
													"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"
													},
													"status": {
														"type": "string",
														"enum": [
															"pending",
															"booked",
															"confirmed",
															"arrived",
															"in_chair",
															"fulfilled",
															"cancelled",
															"no_show"
														]
													},
													"bookedVia": {
														"type": "string",
														"enum": [
															"staff",
															"online",
															"api",
															"automation",
															"pms",
															"import"
														]
													},
													"pms": {
														"anyOf": [
															{
																"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)$"
																	},
																	"provider": {
																		"type": "string",
																		"enum": [
																			"dentally",
																			"dentally_nexgen",
																			"aerona",
																			"exact",
																			"carestream_r4",
																			"systems_for_dentists",
																			"pearl",
																			"dentrix",
																			"eaglesoft",
																			"open_dental",
																			"denticon",
																			"sensei",
																			"curve_dental",
																			"carestack",
																			"tab32",
																			"archy",
																			"oryx",
																			"other"
																		]
																	}
																},
																"required": [
																	"connectionId",
																	"provider"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"practitioners": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"room": {
														"type": [
															"string",
															"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)$"
																	},
																	"firstName": {
																		"type": "string"
																	},
																	"lastName": {
																		"type": "string"
																	},
																	"preferredName": {
																		"type": [
																			"string",
																			"null"
																		]
																	}
																},
																"required": [
																	"id",
																	"firstName",
																	"lastName",
																	"preferredName"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"appointmentId",
													"startsAt",
													"endsAt",
													"timezone",
													"status",
													"bookedVia",
													"pms",
													"practitioners",
													"room",
													"patient"
												],
												"additionalProperties": false
											}
										},
										"stillClashing": {
											"type": "boolean"
										}
									},
									"required": [
										"visit",
										"clashes",
										"stillClashing"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/tasks/{id}/reschedule-consultation": {
			"post": {
				"summary": "Move the consultation a consultation check asks about",
				"tags": [
					"tasks"
				],
				"description": "Moves the booked consultation and its attendance question together — never a new booking. `diary`: the visit moves in Smileline's diary (absent `endsAt` keeps its length; absent `practitionerId`/`operatoryId` keep its participants) and the check follows, with its booking's messages. `check` and `pms_check`: only the question moves (pinned to its visit, so the PMS sync later aligns it). `pms`: answers 202 with a queued provider move; the visit and the question move when the PMS confirms (poll GET /pms/appointment-operations/:id until `completed`). Appends one timeline entry; not a contact attempt, no outcome, no undo. Needs task:update and appointment:update. 409 VERSION_CONFLICT, TASK_NOT_OPEN, NOT_A_CONSULTATION_CHECK, CONSULTATION_CHECK_SUPERSEDED, VISIT_NOT_MOVABLE (the visit already happened or was cancelled), PMS_OPERATION_PENDING (a PMS create or move for this visit is still running), PMS_AUTHORITY_FROZEN, ZONE_RESERVED (resend with zoneOverride), APPOINTMENT_RESOURCE_CONFLICT (pick another time or send overbookReason), LOCKED; 400 when startsAt is not in the future.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"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))$"
									},
									"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
									},
									"zoneOverride": {
										"type": "boolean",
										"const": true
									},
									"note": {
										"type": "string",
										"maxLength": 2000
									}
								},
								"required": [
									"expectedVersion",
									"startsAt"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"task": {
											"$ref": "#/components/schemas/Task"
										},
										"mode": {
											"type": "string",
											"enum": [
												"check",
												"diary",
												"pms",
												"pms_check"
											]
										},
										"operation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/PmsAppointmentOperation"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"task",
										"mode",
										"operation"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"task": {
											"$ref": "#/components/schemas/Task"
										},
										"mode": {
											"type": "string",
											"enum": [
												"check",
												"diary",
												"pms",
												"pms_check"
											]
										},
										"operation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/PmsAppointmentOperation"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"task",
										"mode",
										"operation"
									],
									"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"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 (lostReasonId required after a conversation; a lead nobody reached sends none and closes with the practice's Unable to contact reason), wins it for outcome=going_ahead (below), optionally confirms the value (`potentialValueCents`, the estimate, with booked; `confirmedValueCents`, the agreed treatment value, with going_ahead), 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 (for a lead nobody reached — no_answer, message_sent, no_show — a `flexible` retry planned by the server: every try of the chain inside its three calling days — once they hold no more tries, the next starts three new ones — at most `callbacksPerDay` a day, at the practice's best hours within the location's opening hours and never on a closure — `dueAt` its aim, `availableAt` from when it may be called early, `retryReason` why — ignoring any `followUp.dueAt` sent unless `followUp.override` moves it there, which makes it `kept` — past two of the location's working days that needs a `note` (400 CALLBACK_NOTE_REQUIRED, nothing saved) and notifies the practice's owners and managers (lead.callback_deferred, kept if the outcome is undone); after a conversation, a `kept` call-back at the `dueAt` sent — or, with `followUp.forClosers` on callback_later (team calling), the closers' promised call-back: kind `closer_callback`, due at once, unassigned, carrying the outcome's note; the task's own workspace; a follow-up assigned to a dentist, hygienist or nurse for a `crm` task answers 422 TASK_ASSIGNEE_CANNOT_SEE, and one assigned to a suspended member 422 ASSIGNEE_SUSPENDED, before anything is saved) and appends a human-readable timeline activity. Booked without a conversation (contacted=false, outcome=booked, `appointmentId` required; Today's Record booking, for a visit the practice booked elsewhere such as its own system) links that visit as the contacted branch does (appointment:update; APPOINTMENT_NOT_LINKABLE and APPOINTMENT_OTHER_JOURNEY alike), moves the journey to consultation_booked and credits the recorder with the booking, but stamps no first-contact time, counts as no contact attempt nor as working the lead in any report, and moves none of the patient's chats; `booking`, a contact method, a `callLogId` or a `followUp` are refused (400). On a journey, any outcome also closes the lead's leftover automatic call-backs: its open `flexible` retries are cancelled (task.cancelled), while `kept` call-backs a person or Call AI timed stay open; undo reopens them. A no_answer may name the call it is about (`callLogId`, Next lead): it is honoured only once that call has ended — while it is still live it answers 409 CALL_STILL_ACTIVE with nothing saved, so try again once it ends — and only while that is the task's latest call and no person answered it, else CALL_WAS_ANSWERED. The last try closes the lead: a no_answer or message_sent that makes the practice's `minAttemptsBeforeGivingUp` unanswered tries since the last conversation (any contacted outcome starts the count again) on an active journey records as not_proceeding instead, closing the lead with the practice's Unable to contact reason and no follow-up (the CALL_WAS_ANSWERED check still asks first) — unless `followUp.override` times the next call by hand, which records the answer as sent and books that one more try at the `dueAt` sent. With `notLastTry` (Next lead, which never closes a lead in one tap) a save that would be that last try — a teammate may have logged a try since GET /tasks/:id/next-callback was read — is refused instead: 409 LAST_TRY with nothing saved, for the member to record it on the card (checked after CALL_STILL_ACTIVE and CALL_WAS_ANSWERED). Giving up by hand below that minimum (outcome=not_proceeding, contacted=false, on an active journey) needs a `note`, the written reason: without one it answers 409 GIVE_UP_REASON_REQUIRED (details.attempts, details.minAttempts) with nothing saved; with one the lead closes and the practice's owners and managers are notified (lead.closed_early). After a conversation the Unable to contact reason is never accepted (422 UNABLE_TO_CONTACT_NOT_PICKABLE), and the reason with slug `other` needs a `note` (422 OTHER_REASON_NOTE_REQUIRED). Going ahead is recorded once the consultation happened: on a `consultation_check` task (contacted=false; it also marks the visit its booking named in the own diary attended, so it needs appointment:update), or with the journey at or past its pipeline's `consultation_attended` stage (contacted=true after a call). It saves the agreed value, then moves the journey into the pipeline's won stage, so the journey.won webhook, won sequences, won conversion uploads and referral qualification follow; anywhere else it answers 409 GOING_AHEAD_NEEDS_CONSULTATION with nothing saved (a journey still before its consultation or already closed, a task with no journey, a pipeline with no consultation_attended stage off the check). On a `consultation_check` task two answers close the lead with the reason staff pick (`lostReasonId`, required; Unable to contact refused; no attempts minimum and no lead.closed_early): `declined` (they came and are not going ahead) marks the visit attended in the own diary and moves the journey to its consultation_attended stage first; `cancelled` (they cancelled and are not coming) cancels the visit in the own diary with `cancellationReasonId` (400 CANCELLATION_REASON_REQUIRED without one; never a deposit forfeit, and a paid deposit is refunded only by the practice's cancellation refund rule, Settings → Payments) and stops its messages. Both need appointment:update, are refused on any other task (409 ATTENDANCE_NEEDS_CHECK), never count as a contact attempt and are never undone. With outcome=attended, `stillThinking` says the answer was \"Still thinking it over\" (true: they came and have not decided) or only that they came (false); the timeline names it, and reads an attended answer sent without it by its reminder. Returns an undo receipt valid for 60 seconds; undo never cancels the booking. 403 OWN_TASKS_ONLY for a dentist, hygienist or nurse (as on undo). 409 when the task is not open (TASK_ALREADY_DONE), is a compliance check's (COMPLIANCE_TASK_NEEDS_ENTRY) or the lead is locked by another user (LOCKED); 422 when the site books by chair and no operatory was sent; 503 when the lock could not be checked (LOCK_CHECK_UNAVAILABLE, nothing saved) or the save was interrupted (SAVE_INTERRUPTED) — retry the 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)$"
						}
					}
				],
				"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",
													"going_ahead"
												]
											},
											"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)$"
											},
											"pmsRequestId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
															"message"
														]
													},
													"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))$"
													},
													"override": {
														"type": "boolean",
														"const": true
													},
													"forClosers": {
														"type": "boolean",
														"const": true
													},
													"assigneeId": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"channel"
												]
											},
											"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)$"
											},
											"confirmedValueCents": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"contacted",
											"outcome",
											"contactMethodId",
											"expectedVersion"
										]
									},
									{
										"type": "object",
										"properties": {
											"contacted": {
												"type": "boolean",
												"const": false
											},
											"outcome": {
												"type": "string",
												"enum": [
													"booked",
													"no_answer",
													"message_sent",
													"not_proceeding",
													"attended",
													"no_show",
													"going_ahead",
													"declined",
													"cancelled"
												]
											},
											"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)$"
											},
											"noAnswerConfirmed": {
												"type": "boolean",
												"const": true
											},
											"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)$"
											},
											"stillThinking": {
												"type": "boolean"
											},
											"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)$"
											},
											"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)$"
											},
											"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"
												]
											},
											"expectedVersion": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											},
											"note": {
												"type": "string",
												"minLength": 1
											},
											"followUp": {
												"type": "object",
												"properties": {
													"channel": {
														"type": "string",
														"enum": [
															"call",
															"sms",
															"email",
															"whatsapp",
															"message"
														]
													},
													"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))$"
													},
													"override": {
														"type": "boolean",
														"const": true
													},
													"forClosers": {
														"type": "boolean",
														"const": true
													},
													"assigneeId": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"channel"
												]
											},
											"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)$"
											},
											"confirmedValueCents": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"notLastTry": {
												"type": "boolean",
												"const": true
											}
										},
										"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/journeys/{id}/outcome": {
			"post": {
				"summary": "Record a contact outcome for a journey with no open task",
				"tags": [
					"tasks"
				],
				"description": "The Today outcome from the patient page, for a journey that has no open task: in one commit it opens a `lead_outcome` source task (never open outside this commit, never sent as a task.created webhook or Today row) and records the outcome on it exactly as POST /tasks/:id/outcome does, with the same receipt, permissions and refusals — so going_ahead here needs the journey at or past its consultation_attended stage (409 GOING_AHEAD_NEEDS_CONSULTATION). `expectedVersion` is the journey's version; `requestId`, one per attempt, makes a repeated send the same command. 409 OUTCOME_ALREADY_RECORDED when this requestId was already saved, JOURNEY_NOT_ACTIVE when the journey is closed or archived, VERSION_CONFLICT when it changed, JOURNEY_HAS_OPEN_TASK when it has an open task (record the outcome on that task), LOCKED when another user holds the lead on Today. Undo (POST /tasks/:id/outcome/undo on the receipt's task) cancels the source task instead of reopening 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": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"contacted": {
												"type": "boolean",
												"const": true
											},
											"outcome": {
												"type": "string",
												"enum": [
													"considering",
													"callback_later",
													"booked",
													"not_proceeding",
													"going_ahead"
												]
											},
											"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)$"
											},
											"pmsRequestId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
															"message"
														]
													},
													"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))$"
													},
													"override": {
														"type": "boolean",
														"const": true
													},
													"forClosers": {
														"type": "boolean",
														"const": true
													},
													"assigneeId": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"channel"
												]
											},
											"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)$"
											},
											"confirmedValueCents": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"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)$"
											}
										},
										"required": [
											"contacted",
											"outcome",
											"contactMethodId",
											"expectedVersion",
											"requestId"
										]
									},
									{
										"type": "object",
										"properties": {
											"contacted": {
												"type": "boolean",
												"const": false
											},
											"outcome": {
												"type": "string",
												"enum": [
													"booked",
													"no_answer",
													"message_sent",
													"not_proceeding",
													"attended",
													"no_show",
													"going_ahead",
													"declined",
													"cancelled"
												]
											},
											"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)$"
											},
											"noAnswerConfirmed": {
												"type": "boolean",
												"const": true
											},
											"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)$"
											},
											"stillThinking": {
												"type": "boolean"
											},
											"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)$"
											},
											"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)$"
											},
											"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"
												]
											},
											"expectedVersion": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											},
											"note": {
												"type": "string",
												"minLength": 1
											},
											"followUp": {
												"type": "object",
												"properties": {
													"channel": {
														"type": "string",
														"enum": [
															"call",
															"sms",
															"email",
															"whatsapp",
															"message"
														]
													},
													"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))$"
													},
													"override": {
														"type": "boolean",
														"const": true
													},
													"forClosers": {
														"type": "boolean",
														"const": true
													},
													"assigneeId": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"channel"
												]
											},
											"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)$"
											},
											"confirmedValueCents": {
												"anyOf": [
													{
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													{
														"type": "null"
													}
												]
											},
											"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)$"
											},
											"notLastTry": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"contacted",
											"outcome",
											"expectedVersion",
											"requestId"
										]
									}
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"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, reopens the leftover automatic call-backs the outcome closed (409 CONFLICT when one has changed since) and reopens the task (a managers' alert the outcome raised — lead.closed_early, lead.callback_deferred — stays sent) — or, for a `lead_outcome` source task (POST /journeys/:id/outcome), cancels it, so the journey is back to having no open task. Undoing going_ahead returns the journey to the stage it left, active, with its previous agreed value: the won sequences stop, won conversion uploads not yet sent are skipped and the referral it qualified is reversed (partners receive journey.updated). 409 CONFLICT when the value the outcome confirmed (booked's estimate, going_ahead's agreed value) has been changed since; 409 UNDO_NOT_AVAILABLE when the answer also marked a diary visit attended or missed (attended, no_show, or going_ahead on the consultation check): that visit's status is final, and a journey won that way is reopened instead (POST /journeys/:id/reopen); and always for the consultation check's declined and cancelled, whose lead is reopened instead. 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 and lead-form enquiries (callers first, then newest submission first), overdue tasks, website enquiry triage cards + today's tasks, and tomorrow's follow-ups. A flexible retry callable early (`task.availableAt` passed) is listed whatever its aim, and one past its window (`retryExpiresAt`) stays listed — never served as the next lead — until a person records its outcome: nothing closes it by itself, and a No answer saved on it is the last try. `buckets.reachedOut` lists, longest wait first, missed callers (one row per number, for a role that uses the dialer) and WhatsApp/SMS chats the interest check let through (for a role that reads conversations). A closer's promised call-backs (`closer_callback`) are listed only to closers and to managers — never to openers, nor to installed mobile builds. `truncated` flags a bucket that holds more rows than the response carries. Pass ?date=YYYY-MM-DD (today … today+41, practice-local) to preview a future day — those responses carry only that day's due tasks. Add ?through=YYYY-MM-DD (date … today+41) to preview every day from `date` through `through` at once, in due order. 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"
						}
					},
					{
						"name": "through",
						"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/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. Pass `projection=compact` to omit task audit/completion metadata and journey snoozedUntil while keeping every queue row and all action/contact fields. Without it the full response is unchanged. 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"
						}
					},
					{
						"name": "projection",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "compact"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"anyOf": [
										{
											"$ref": "#/components/schemas/TodayPage"
										},
										{
											"$ref": "#/components/schemas/CompactTodayPage"
										}
									]
								}
							}
						}
					},
					"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": {
														"type": [
															"string",
															"null"
														]
													},
													"appointmentTypeName": {
														"type": [
															"string",
															"null"
														]
													},
													"treatmentName": {
														"type": [
															"string",
															"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": {
														"type": [
															"string",
															"null"
														]
													},
													"isFirstVisit": {
														"type": "boolean"
													},
													"bookedVia": {
														"type": "string"
													},
													"bookedOnline": {
														"type": "boolean"
													},
													"bookedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"bookedByName": {
														"type": [
															"string",
															"null"
														]
													},
													"bookedBySource": {
														"type": "string",
														"enum": [
															"user",
															"patient",
															"automation",
															"campaign",
															"ai",
															"api",
															"import",
															"system",
															"lab"
														]
													},
													"phoneMobile": {
														"type": [
															"string",
															"null"
														]
													},
													"pmsManaged": {
														"type": "boolean"
													},
													"pmsCanConfirm": {
														"type": "boolean"
													},
													"pmsCanMove": {
														"type": "boolean"
													},
													"pmsMovePending": {
														"type": "boolean"
													},
													"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"
															}
														]
													},
													"cancelledBy": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"patient",
																	"practice",
																	"system",
																	"unknown"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"cancellationKind": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"cancelled",
																	"rescheduled",
																	"hold_released",
																	"entered_in_error"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"label": {
														"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)$"
																	},
																	"label": {
																		"type": "string"
																	},
																	"color": {
																		"type": [
																			"string",
																			"null"
																		]
																	},
																	"showsWhile": {
																		"anyOf": [
																			{
																				"type": "string",
																				"enum": [
																					"booked",
																					"confirmed",
																					"arrived",
																					"in_chair"
																				]
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"id",
																	"label",
																	"color",
																	"showsWhile"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"appointmentId",
													"patientId",
													"firstName",
													"lastName",
													"preferredName",
													"appointmentTypeName",
													"treatmentName",
													"status",
													"startsAt",
													"endsAt",
													"version",
													"practitionerIds",
													"operatoryId",
													"locationId",
													"appointmentTypeId",
													"note",
													"isFirstVisit",
													"bookedVia",
													"phoneMobile",
													"pmsManaged",
													"pmsCanConfirm",
													"heldUntil",
													"cancelledBy",
													"cancellationKind"
												],
												"additionalProperties": false
											}
										},
										"working": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListInterval"
											}
										},
										"rosteredFrom": {
											"type": "object",
											"propertyNames": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
												"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"
													}
												]
											}
										},
										"absences": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListInterval"
											}
										},
										"closures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListClosure"
											}
										},
										"zones": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListZone"
											}
										},
										"pmsRotaDays": {
											"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)$"
													},
													"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": [
													"practitionerId",
													"date"
												],
												"additionalProperties": false
											}
										},
										"pmsBlocks": {
											"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)$"
													},
													"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))$"
													},
													"label": {
														"type": [
															"string",
															"null"
														]
													},
													"kind": {
														"type": "string",
														"enum": [
															"match_review",
															"awaiting_patient"
														]
													}
												},
												"required": [
													"practitionerId",
													"startsAt",
													"endsAt",
													"label"
												],
												"additionalProperties": false
											}
										},
										"inactivePractitioners": {
											"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"
													}
												},
												"required": [
													"id",
													"displayName"
												],
												"additionalProperties": false
											}
										},
										"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)$"
													}
												},
												"required": [
													"practitionerId"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"date",
										"from",
										"to",
										"timezone",
										"locationId",
										"items",
										"working",
										"rosteredFrom",
										"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 and lead recap 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/PipelineCard"
											}
										},
										"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",
								"nextVisit",
								"lastVisit",
								"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",
							"pattern": "^(tags|clinic|journeys)(,(tags|clinic|journeys))*$"
						}
					},
					{
						"name": "clinicColumns",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^(dentist|hygienist|priceList|nextVisit|lastVisit|visits|recall|balance|owedFor|plannedValue|legacyChartNumber|gp)(,(dentist|hygienist|priceList|nextVisit|lastVisit|visits|recall|balance|owedFor|plannedValue|legacyChartNumber|gp))*$"
						}
					},
					{
						"name": "ids",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36})*$"
						}
					},
					{
						"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"
											}
										},
										"stages": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PipelineStage"
											}
										},
										"journeyTotal": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"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",
								"all"
							]
						}
					},
					{
						"name": "channel",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"whatsapp",
								"sms",
								"email",
								"webchat",
								"messenger",
								"instagram",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments",
								"patient_app"
							]
						}
					},
					{
						"name": "assignee",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "unread",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "hidden",
						"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": {
													"type": [
														"string",
														"null"
													]
												}
											},
											"required": [
												"items",
												"nextCursor"
											],
											"additionalProperties": false
										},
										"counts": {
											"$ref": "#/components/schemas/InboxCounts"
										},
										"unreadTotal": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"savedViews": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/SavedView"
													}
												}
											},
											"required": [
												"items"
											],
											"additionalProperties": false
										},
										"members": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/InboxMember"
											}
										},
										"hiddenOffered": {
											"type": "boolean"
										}
									},
									"required": [
										"conversations",
										"counts",
										"unreadTotal",
										"savedViews",
										"members",
										"hiddenOffered"
									],
									"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 (enquiries created — the dashboard's 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, complete breakdown aggregates, plus the first page (200 rows) of each underlying section merged chronologically — new leads with their source, every outbound contact, all appointments (any status), journeys won/lost with values, and open tasks due. `nextCursors` continue the appointment and journey sections through GET /calendar/appointments and /calendar/journeys. Journey rows and won-by-treatment need journey:read and are empty without it.",
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/calendar/leads": {
			"get": {
				"summary": "The leads that came in over a span of calendar days",
				"tags": [
					"calendar"
				],
				"description": "Every enquiry (journey) created in the inclusive practice-local range — the calendar's and the dashboard's New leads, archived ones included — oldest first, with its patient, source, stage, owner, first contact and closing facts. 500 per page; pass `nextCursor` back as `cursor` until it is null. Requires journey: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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarLeadPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/calendar/appointments": {
			"get": {
				"summary": "Appointments over a span of calendar days, page by page",
				"tags": [
					"calendar"
				],
				"description": "Every appointment taking place in the inclusive practice-local range, any status, by start time — the rows GET /calendar/detail starts. 200 per page; pass `nextCursor` back as `cursor` until it is null.",
				"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarAppointmentPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/calendar/journeys": {
			"get": {
				"summary": "Journeys won or lost over a span of calendar days, page by page",
				"tags": [
					"calendar"
				],
				"description": "Every journey closed with the given status in the inclusive practice-local range, by closing time, with its deal value — the rows GET /calendar/detail starts. 200 per page; pass `nextCursor` back as `cursor` until it is null. Requires journey: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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"won",
								"lost"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarJourneyPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/calendar/team": {
			"get": {
				"summary": "What each teammate did over a span of calendar days",
				"tags": [
					"calendar"
				],
				"description": "Per person over the inclusive practice-local range: every activity they are the actor of, counted by type and practice-local hour, and the distinct leads they worked (the dashboard leaderboard's Leads contacted). Teammates who can work leads and did nothing are listed after the rest. Requires report:read and patient: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])))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarTeam"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/calendar/team/activity": {
			"get": {
				"summary": "The team's activity over a span of calendar days",
				"tags": [
					"calendar"
				],
				"description": "Every activity a teammate is the actor of in the inclusive practice-local range, newest first, with its patient's name — one person's with `userId`, everyone's without. 50 per page; pass `nextCursor` back as `cursor` until it is null. Requires report:read and patient: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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "userId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 255
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarTeamActivityPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/calendar/callbacks": {
			"get": {
				"summary": "Open call-backs and follow-ups over a span of calendar days",
				"tags": [
					"calendar"
				],
				"description": "Every open follow-up and closer call-back due in the inclusive practice-local range (from ≤ to, ≤45 days), as Today lists them — closed leads and archived patients out, a closer's call-back only for closers and managers — by due time, as Today's task rows. 200 per page; pass `nextCursor` back as `cursor` until it is null. Requires task:read and a role that works every lead's tasks (403 OWN_TASKS_ONLY otherwise).",
				"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalendarCallbacksPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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",
								"call-insights",
								"call-insights-weekly-digest",
								"funnel",
								"conversion-summary",
								"speed-to-lead",
								"lost-journeys",
								"revenue-summary",
								"revenue-by-treatment",
								"pipeline-value",
								"patient-value",
								"patient-retention",
								"recall-success",
								"appointment-volume",
								"attendance",
								"appointments",
								"appointments-per-month",
								"recalls",
								"waiting-lists",
								"team-activity",
								"team-conversion",
								"practitioner-performance",
								"team-calling",
								"referral-program",
								"lead-flow",
								"seo-weekly-digest",
								"ads-weekly-digest",
								"day-sheet",
								"aged-debt",
								"patient-accounts",
								"income",
								"production",
								"collections",
								"associate-pay",
								"utilisation",
								"sundries",
								"invoice-timeline",
								"invoice-months",
								"payment-allocations",
								"payment-allocation-totals",
								"monthly-accounts",
								"radiograph-audit",
								"perio-coverage",
								"treatment-completed",
								"practitioner-activity",
								"treatment-plans",
								"plans-completed-not-closed",
								"unbooked-treatment",
								"unfinished-treatment",
								"lab-turnaround",
								"prescriptions-issued",
								"new-patients",
								"new-patient-visits",
								"clinical-referrals",
								"age-groups",
								"birthdays",
								"lapsed-patients",
								"audit",
								"report-runs",
								"user-sessions",
								"stock-summary",
								"low-stock",
								"stock-usage",
								"stock-transactions",
								"stock-moves",
								"stock-expiry"
							]
						}
					},
					{
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/reports/{report}/rows": {
			"get": {
				"summary": "One page of a report's row table",
				"tags": [
					"reports"
				],
				"description": "A report's rows — those naming patients, and long lists such as stock movements — one keyset page at a time (the report envelope carries aggregates only): pass `nextCursor` back as `cursor` until it is null; an invalid cursor is 400 INVALID_CURSOR. `table` names one of the report's row tables (404 for a report or table with none); `filters` is the report's own filter JSON. A table that says `searchable` narrows to rows matching `q` (ignored by any other), one with `chips` to the rows of the one named by `chip` (400 INVALID_REPORT_ROWS_CHIP for a key it has none of), and one that has them answers its first page with `totals` over every row kept. Needs report:read, plus patient:read for a table that names patients (403 PATIENT_READ_REQUIRED) and inventory:read for an inventory report — a token's scopes cap the role. Call insights' `objectionCalls` (what callers said when they raised an objection, and the reply; `filters.callObjection` and `filters.staffUserId` pick a grid cell) is also open with dialer:use, and serves every call's only to dialer:manage — anyone else reads the calls they handled. A restricted or erased patient is named \"Erased patient\" and never linked. A clinical report's page is audited as one clinical read per patient it names, in the transaction that serves it.",
				"parameters": [
					{
						"name": "report",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"dashboard",
								"snapshot",
								"lead-volume",
								"lead-sources",
								"lead-attribution",
								"calls",
								"call-insights",
								"call-insights-weekly-digest",
								"funnel",
								"conversion-summary",
								"speed-to-lead",
								"lost-journeys",
								"revenue-summary",
								"revenue-by-treatment",
								"pipeline-value",
								"patient-value",
								"patient-retention",
								"recall-success",
								"appointment-volume",
								"attendance",
								"appointments",
								"appointments-per-month",
								"recalls",
								"waiting-lists",
								"team-activity",
								"team-conversion",
								"practitioner-performance",
								"team-calling",
								"referral-program",
								"lead-flow",
								"seo-weekly-digest",
								"ads-weekly-digest",
								"day-sheet",
								"aged-debt",
								"patient-accounts",
								"income",
								"production",
								"collections",
								"associate-pay",
								"utilisation",
								"sundries",
								"invoice-timeline",
								"invoice-months",
								"payment-allocations",
								"payment-allocation-totals",
								"monthly-accounts",
								"radiograph-audit",
								"perio-coverage",
								"treatment-completed",
								"practitioner-activity",
								"treatment-plans",
								"plans-completed-not-closed",
								"unbooked-treatment",
								"unfinished-treatment",
								"lab-turnaround",
								"prescriptions-issued",
								"new-patients",
								"new-patient-visits",
								"clinical-referrals",
								"age-groups",
								"birthdays",
								"lapsed-patients",
								"audit",
								"report-runs",
								"user-sessions",
								"stock-summary",
								"low-stock",
								"stock-usage",
								"stock-transactions",
								"stock-moves",
								"stock-expiry"
							]
						}
					},
					{
						"name": "table",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 64
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2000
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "chip",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 64
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ReportRowsPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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": {
			"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",
											"call-insights",
											"call-insights-weekly-digest",
											"funnel",
											"conversion-summary",
											"speed-to-lead",
											"lost-journeys",
											"revenue-summary",
											"revenue-by-treatment",
											"pipeline-value",
											"patient-value",
											"patient-retention",
											"recall-success",
											"appointment-volume",
											"attendance",
											"appointments",
											"appointments-per-month",
											"recalls",
											"waiting-lists",
											"team-activity",
											"team-conversion",
											"practitioner-performance",
											"team-calling",
											"referral-program",
											"lead-flow",
											"seo-weekly-digest",
											"ads-weekly-digest",
											"day-sheet",
											"aged-debt",
											"patient-accounts",
											"income",
											"production",
											"collections",
											"associate-pay",
											"utilisation",
											"sundries",
											"invoice-timeline",
											"invoice-months",
											"payment-allocations",
											"payment-allocation-totals",
											"monthly-accounts",
											"radiograph-audit",
											"perio-coverage",
											"treatment-completed",
											"practitioner-activity",
											"treatment-plans",
											"plans-completed-not-closed",
											"unbooked-treatment",
											"unfinished-treatment",
											"lab-turnaround",
											"prescriptions-issued",
											"new-patients",
											"new-patient-visits",
											"clinical-referrals",
											"age-groups",
											"birthdays",
											"lapsed-patients",
											"audit",
											"report-runs",
											"user-sessions",
											"stock-summary",
											"low-stock",
											"stock-usage",
											"stock-transactions",
											"stock-moves",
											"stock-expiry"
										]
									},
									"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
											},
											"stockRoomId": {
												"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
											},
											"stockItemName": {
												"type": "object",
												"properties": {
													"contains": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"eq": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"stockMovementKind": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"take",
																"restock",
																"count",
																"move",
																"revalue"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"stockMovementSource": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"manual",
																"procedure_completion",
																"shop_delivery",
																"shop_check_in",
																"shop_return",
																"transfer",
																"stocktake",
																"pick_list",
																"purchase_order",
																"opening",
																"import"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"staffUserId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"paymentMethodId": {
												"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
											},
											"allocation": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"unallocated"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"paymentSearch": {
												"type": "object",
												"properties": {
													"contains": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													}
												},
												"required": [
													"contains"
												],
												"additionalProperties": false
											},
											"callObjection": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"pattern": "^[a-z][a-z_]{0,39}$"
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"invoiceState": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"paid",
																"unpaid"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"accountState": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"debit",
																"credit",
																"settled"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"auditAction": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"create",
																"update",
																"delete",
																"merge",
																"export",
																"access",
																"import"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"auditEntityType": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 500,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1,
															"maxLength": 100
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"recallStatus": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"booked",
																"unbooked"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"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",
											"call-insights",
											"call-insights-weekly-digest",
											"funnel",
											"conversion-summary",
											"speed-to-lead",
											"lost-journeys",
											"revenue-summary",
											"revenue-by-treatment",
											"pipeline-value",
											"patient-value",
											"patient-retention",
											"recall-success",
											"appointment-volume",
											"attendance",
											"appointments",
											"appointments-per-month",
											"recalls",
											"waiting-lists",
											"team-activity",
											"team-conversion",
											"practitioner-performance",
											"team-calling",
											"referral-program",
											"lead-flow",
											"seo-weekly-digest",
											"ads-weekly-digest",
											"day-sheet",
											"aged-debt",
											"patient-accounts",
											"income",
											"production",
											"collections",
											"associate-pay",
											"utilisation",
											"sundries",
											"invoice-timeline",
											"invoice-months",
											"payment-allocations",
											"payment-allocation-totals",
											"monthly-accounts",
											"radiograph-audit",
											"perio-coverage",
											"treatment-completed",
											"practitioner-activity",
											"treatment-plans",
											"plans-completed-not-closed",
											"unbooked-treatment",
											"unfinished-treatment",
											"lab-turnaround",
											"prescriptions-issued",
											"new-patients",
											"new-patient-visits",
											"clinical-referrals",
											"age-groups",
											"birthdays",
											"lapsed-patients",
											"audit",
											"report-runs",
											"user-sessions",
											"stock-summary",
											"low-stock",
											"stock-usage",
											"stock-transactions",
											"stock-moves",
											"stock-expiry"
										]
									},
									"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
											},
											"stockRoomId": {
												"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
											},
											"stockItemName": {
												"type": "object",
												"properties": {
													"contains": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"eq": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"stockMovementKind": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"take",
																"restock",
																"count",
																"move",
																"revalue"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"stockMovementSource": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"manual",
																"procedure_completion",
																"shop_delivery",
																"shop_check_in",
																"shop_return",
																"transfer",
																"stocktake",
																"pick_list",
																"purchase_order",
																"opening",
																"import"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"staffUserId": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1
														}
													},
													"present": {
														"type": "boolean"
													}
												},
												"additionalProperties": false
											},
											"paymentMethodId": {
												"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
											},
											"allocation": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"unallocated"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"paymentSearch": {
												"type": "object",
												"properties": {
													"contains": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													}
												},
												"required": [
													"contains"
												],
												"additionalProperties": false
											},
											"callObjection": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 100,
														"type": "array",
														"items": {
															"type": "string",
															"pattern": "^[a-z][a-z_]{0,39}$"
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"invoiceState": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"paid",
																"unpaid"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"accountState": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"debit",
																"credit",
																"settled"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"auditAction": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"create",
																"update",
																"delete",
																"merge",
																"export",
																"access",
																"import"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"auditEntityType": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"maxItems": 500,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1,
															"maxLength": 100
														}
													}
												},
												"required": [
													"in"
												],
												"additionalProperties": false
											},
											"recallStatus": {
												"type": "object",
												"properties": {
													"in": {
														"minItems": 1,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"booked",
																"unbooked"
															]
														}
													}
												},
												"required": [
													"in"
												],
												"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",
							"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/ReportDelivery"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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.enquiry",
															"lead.uncontacted",
															"lead.closed_early",
															"lead.callback_deferred",
															"intake.review_waiting",
															"call.missed",
															"voicemail.received",
															"voice.ai_handoff_unanswered",
															"voice.emergency_dialed",
															"message.received",
															"conversation.reply_window_closing",
															"conversation.ai_attention",
															"booking.created",
															"booking.cancelled",
															"deposit.paid",
															"deposit.paid_after_call",
															"review.received",
															"feedback.received",
															"seo.review_requested",
															"seo.changes_requested",
															"seo.review_due",
															"social.video_ready",
															"social.video_needs_attention",
															"social.image_ready",
															"social.image_needs_attention",
															"integration.failed",
															"ingest.review_required",
															"ingest.review_waiting",
															"tracking.ceiling_reached",
															"billing.storage_allowance_passed",
															"ads.attention",
															"team.message",
															"rota.changed",
															"time_off.requested",
															"time_off.decided",
															"shift.swap_requested",
															"shift_request.pending",
															"shift_request.decided",
															"open_shift.posted",
															"rota.shift_reminder",
															"rota.clock_in_reminder",
															"rota.clock_out_reminder",
															"goal.reply_due",
															"goal.clock_out_soon",
															"goal.week_summary",
															"goal.month_recap",
															"goal.badge_level",
															"job.application_received",
															"staffing.cover",
															"shop.order_placed",
															"shop.team_order_placed",
															"shop.order_update",
															"shop.order_attention",
															"shop.payment_method_update",
															"shop.approval_requested",
															"shop.approval_decided",
															"shop.quote_update",
															"shop.verification_update",
															"shop.stock_digest",
															"shop.stock_alert",
															"shop.back_in_stock",
															"shop.recall",
															"supplier.order_received",
															"supplier.order_cancelled",
															"supplier.dispatch_late",
															"supplier.return_requested",
															"supplier.quote_requested",
															"supplier.buyer_check_requested",
															"supplier.statement_ready",
															"supplier.statement_paid",
															"supplier.account_update",
															"supplier.import_needs_review",
															"supplier.product_request_update",
															"lab.order_attention",
															"lab.order_update",
															"lab.invitation",
															"inventory.low_stock",
															"inventory.out_of_stock",
															"inventory.digest"
														]
													},
													"group": {
														"type": "string",
														"enum": [
															"leads",
															"conversations",
															"bookings",
															"reputation",
															"operations",
															"team",
															"shop",
															"supplier",
															"lab",
															"inventory"
														]
													},
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"quietHoursStartHour": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 23
												},
												{
													"type": "null"
												}
											]
										},
										"quietHoursEndHour": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 23
												},
												{
													"type": "null"
												}
											]
										},
										"shiftReminderLeadMinutes": {
											"anyOf": [
												{
													"type": "number",
													"enum": [
														60,
														120,
														240,
														720,
														1440,
														2880
													]
												},
												{
													"type": "null"
												}
											]
										},
										"webPushVapidPublicKey": {
											"type": [
												"string",
												"null"
											]
										},
										"readOnly": {
											"type": "boolean"
										},
										"devices": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PushDevice"
											}
										}
									},
									"required": [
										"kinds",
										"timezone",
										"quietHoursStartHour",
										"quietHoursEndHour",
										"shiftReminderLeadMinutes",
										"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.enquiry",
												"lead.uncontacted",
												"lead.closed_early",
												"lead.callback_deferred",
												"intake.review_waiting",
												"call.missed",
												"voicemail.received",
												"voice.ai_handoff_unanswered",
												"voice.emergency_dialed",
												"message.received",
												"conversation.reply_window_closing",
												"conversation.ai_attention",
												"booking.created",
												"booking.cancelled",
												"deposit.paid",
												"deposit.paid_after_call",
												"review.received",
												"feedback.received",
												"seo.review_requested",
												"seo.changes_requested",
												"seo.review_due",
												"social.video_ready",
												"social.video_needs_attention",
												"social.image_ready",
												"social.image_needs_attention",
												"integration.failed",
												"ingest.review_required",
												"ingest.review_waiting",
												"tracking.ceiling_reached",
												"billing.storage_allowance_passed",
												"ads.attention",
												"team.message",
												"rota.changed",
												"time_off.requested",
												"time_off.decided",
												"shift.swap_requested",
												"shift_request.pending",
												"shift_request.decided",
												"open_shift.posted",
												"rota.shift_reminder",
												"rota.clock_in_reminder",
												"rota.clock_out_reminder",
												"goal.reply_due",
												"goal.clock_out_soon",
												"goal.week_summary",
												"goal.month_recap",
												"goal.badge_level",
												"job.application_received",
												"staffing.cover",
												"shop.order_placed",
												"shop.team_order_placed",
												"shop.order_update",
												"shop.order_attention",
												"shop.payment_method_update",
												"shop.approval_requested",
												"shop.approval_decided",
												"shop.quote_update",
												"shop.verification_update",
												"shop.stock_digest",
												"shop.stock_alert",
												"shop.back_in_stock",
												"shop.recall",
												"supplier.order_received",
												"supplier.order_cancelled",
												"supplier.dispatch_late",
												"supplier.return_requested",
												"supplier.quote_requested",
												"supplier.buyer_check_requested",
												"supplier.statement_ready",
												"supplier.statement_paid",
												"supplier.account_update",
												"supplier.import_needs_review",
												"supplier.product_request_update",
												"lab.order_attention",
												"lab.order_update",
												"lab.invitation",
												"inventory.low_stock",
												"inventory.out_of_stock",
												"inventory.digest"
											]
										},
										"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"
											}
										]
									},
									"shiftReminderLeadMinutes": {
										"anyOf": [
											{
												"type": "number",
												"enum": [
													60,
													120,
													240,
													720,
													1440,
													2880
												]
											},
											{
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/me/preferences": {
			"get": {
				"summary": "The signed-in member's chart and perio preferences",
				"tags": [
					"pms"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"chart": {
											"type": "object",
											"properties": {
												"condensed": {
													"type": "boolean"
												},
												"roots": {
													"type": "boolean"
												},
												"mixedDentition": {
													"type": "boolean"
												},
												"locked": {
													"type": "boolean"
												},
												"showAllPlans": {
													"type": "boolean"
												},
												"notation": {
													"type": "string",
													"enum": [
														"fdi",
														"universal",
														"palmer"
													]
												},
												"rail": {
													"type": "boolean"
												},
												"hoverChart": {
													"type": "object",
													"properties": {
														"on": {
															"type": "boolean"
														},
														"mode": {
															"type": "string",
															"enum": [
																"automated",
																"manual"
															]
														},
														"manual": {
															"type": "object",
															"properties": {
																"treatment": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"base": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																}
															},
															"additionalProperties": false
														},
														"automated": {
															"type": "object",
															"propertyNames": {
																"type": "string",
																"enum": [
																	"upper_incisor",
																	"upper_premolar",
																	"upper_molar",
																	"lower_incisor",
																	"lower_premolar",
																	"lower_molar",
																	"child",
																	"upper_incisor_base",
																	"upper_premolar_base",
																	"upper_molar_base",
																	"lower_incisor_base",
																	"lower_premolar_base",
																	"lower_molar_base",
																	"child_base"
																]
															},
															"additionalProperties": {
																"maxItems": 10,
																"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
												},
												"favouriteCodeIds": {
													"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)$"
													}
												},
												"favouriteTemplateIds": {
													"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)$"
													}
												},
												"sort": {
													"type": "string",
													"enum": [
														"code",
														"name"
													]
												},
												"pinFavourites": {
													"type": "boolean"
												},
												"category": {
													"type": "string",
													"minLength": 1,
													"maxLength": 64
												},
												"agePrediction": {
													"type": "string",
													"enum": [
														"ask",
														"auto"
													]
												},
												"imageSize": {
													"type": "string",
													"enum": [
														"small",
														"medium",
														"large"
													]
												},
												"quickButtons": {
													"maxItems": 12,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"codeId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"surfaces": {
																"maxItems": 6,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"M",
																		"O",
																		"D",
																		"B",
																		"L",
																		"I"
																	]
																}
															}
														},
														"required": [
															"codeId",
															"surfaces"
														],
														"additionalProperties": false
													}
												}
											},
											"additionalProperties": false
										},
										"perio": {
											"type": "object",
											"properties": {
												"order": {
													"minItems": 4,
													"maxItems": 4,
													"type": "array",
													"items": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													}
												},
												"directions": {
													"type": "object",
													"propertyNames": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													},
													"additionalProperties": {
														"type": "string",
														"enum": [
															"ltr",
															"rtl"
														]
													}
												},
												"entry": {
													"type": "string",
													"enum": [
														"row",
														"tooth"
													]
												},
												"auto": {
													"type": "boolean"
												}
											},
											"additionalProperties": false
										},
										"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": [
										"chart",
										"perio",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Change the signed-in member's preferences",
				"tags": [
					"pms"
				],
				"description": "Each top-level key of `chart` or `perio` that is sent replaces the stored one whole; keys not sent are kept. Serialised per member.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"chart": {
										"type": "object",
										"properties": {
											"condensed": {
												"type": "boolean"
											},
											"roots": {
												"type": "boolean"
											},
											"mixedDentition": {
												"type": "boolean"
											},
											"locked": {
												"type": "boolean"
											},
											"showAllPlans": {
												"type": "boolean"
											},
											"notation": {
												"type": "string",
												"enum": [
													"fdi",
													"universal",
													"palmer"
												]
											},
											"rail": {
												"type": "boolean"
											},
											"hoverChart": {
												"type": "object",
												"properties": {
													"on": {
														"type": "boolean"
													},
													"mode": {
														"type": "string",
														"enum": [
															"automated",
															"manual"
														]
													},
													"manual": {
														"type": "object",
														"properties": {
															"treatment": {
																"maxItems": 10,
																"type": "array",
																"items": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"base": {
																"maxItems": 10,
																"type": "array",
																"items": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															}
														}
													},
													"automated": {
														"type": "object",
														"propertyNames": {
															"type": "string",
															"enum": [
																"upper_incisor",
																"upper_premolar",
																"upper_molar",
																"lower_incisor",
																"lower_premolar",
																"lower_molar",
																"child",
																"upper_incisor_base",
																"upper_premolar_base",
																"upper_molar_base",
																"lower_incisor_base",
																"lower_premolar_base",
																"lower_molar_base",
																"child_base"
															]
														},
														"additionalProperties": {
															"maxItems": 10,
															"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)$"
															}
														}
													}
												}
											},
											"favouriteCodeIds": {
												"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)$"
												}
											},
											"favouriteTemplateIds": {
												"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)$"
												}
											},
											"sort": {
												"type": "string",
												"enum": [
													"code",
													"name"
												]
											},
											"pinFavourites": {
												"type": "boolean"
											},
											"category": {
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											"agePrediction": {
												"type": "string",
												"enum": [
													"ask",
													"auto"
												]
											},
											"imageSize": {
												"type": "string",
												"enum": [
													"small",
													"medium",
													"large"
												]
											},
											"quickButtons": {
												"maxItems": 12,
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"codeId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"surfaces": {
															"maxItems": 6,
															"type": "array",
															"items": {
																"type": "string",
																"enum": [
																	"M",
																	"O",
																	"D",
																	"B",
																	"L",
																	"I"
																]
															}
														}
													},
													"required": [
														"codeId",
														"surfaces"
													]
												}
											}
										}
									},
									"perio": {
										"type": "object",
										"properties": {
											"order": {
												"minItems": 4,
												"maxItems": 4,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"upper_palatal",
														"upper_buccal",
														"lower_buccal",
														"lower_lingual"
													]
												}
											},
											"directions": {
												"type": "object",
												"propertyNames": {
													"type": "string",
													"enum": [
														"upper_palatal",
														"upper_buccal",
														"lower_buccal",
														"lower_lingual"
													]
												},
												"additionalProperties": {
													"type": "string",
													"enum": [
														"ltr",
														"rtl"
													]
												}
											},
											"entry": {
												"type": "string",
												"enum": [
													"row",
													"tooth"
												]
											},
											"auto": {
												"type": "boolean"
											}
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"chart": {
											"type": "object",
											"properties": {
												"condensed": {
													"type": "boolean"
												},
												"roots": {
													"type": "boolean"
												},
												"mixedDentition": {
													"type": "boolean"
												},
												"locked": {
													"type": "boolean"
												},
												"showAllPlans": {
													"type": "boolean"
												},
												"notation": {
													"type": "string",
													"enum": [
														"fdi",
														"universal",
														"palmer"
													]
												},
												"rail": {
													"type": "boolean"
												},
												"hoverChart": {
													"type": "object",
													"properties": {
														"on": {
															"type": "boolean"
														},
														"mode": {
															"type": "string",
															"enum": [
																"automated",
																"manual"
															]
														},
														"manual": {
															"type": "object",
															"properties": {
																"treatment": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"base": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																}
															},
															"additionalProperties": false
														},
														"automated": {
															"type": "object",
															"propertyNames": {
																"type": "string",
																"enum": [
																	"upper_incisor",
																	"upper_premolar",
																	"upper_molar",
																	"lower_incisor",
																	"lower_premolar",
																	"lower_molar",
																	"child",
																	"upper_incisor_base",
																	"upper_premolar_base",
																	"upper_molar_base",
																	"lower_incisor_base",
																	"lower_premolar_base",
																	"lower_molar_base",
																	"child_base"
																]
															},
															"additionalProperties": {
																"maxItems": 10,
																"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
												},
												"favouriteCodeIds": {
													"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)$"
													}
												},
												"favouriteTemplateIds": {
													"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)$"
													}
												},
												"sort": {
													"type": "string",
													"enum": [
														"code",
														"name"
													]
												},
												"pinFavourites": {
													"type": "boolean"
												},
												"category": {
													"type": "string",
													"minLength": 1,
													"maxLength": 64
												},
												"agePrediction": {
													"type": "string",
													"enum": [
														"ask",
														"auto"
													]
												},
												"imageSize": {
													"type": "string",
													"enum": [
														"small",
														"medium",
														"large"
													]
												},
												"quickButtons": {
													"maxItems": 12,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"codeId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"surfaces": {
																"maxItems": 6,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"M",
																		"O",
																		"D",
																		"B",
																		"L",
																		"I"
																	]
																}
															}
														},
														"required": [
															"codeId",
															"surfaces"
														],
														"additionalProperties": false
													}
												}
											},
											"additionalProperties": false
										},
										"perio": {
											"type": "object",
											"properties": {
												"order": {
													"minItems": 4,
													"maxItems": 4,
													"type": "array",
													"items": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													}
												},
												"directions": {
													"type": "object",
													"propertyNames": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													},
													"additionalProperties": {
														"type": "string",
														"enum": [
															"ltr",
															"rtl"
														]
													}
												},
												"entry": {
													"type": "string",
													"enum": [
														"row",
														"tooth"
													]
												},
												"auto": {
													"type": "boolean"
												}
											},
											"additionalProperties": false
										},
										"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": [
										"chart",
										"perio",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/me/preferences/import": {
			"post": {
				"summary": "Copy a browser's preferences up once",
				"tags": [
					"pms"
				],
				"description": "Fills only what the member has not saved: every value the server already holds — false, an empty list and an empty object included — is kept, and nested objects are filled key by key. Retrying it changes nothing more. Serialised per member.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"chart": {
										"type": "object",
										"properties": {
											"condensed": {
												"type": "boolean"
											},
											"roots": {
												"type": "boolean"
											},
											"mixedDentition": {
												"type": "boolean"
											},
											"locked": {
												"type": "boolean"
											},
											"showAllPlans": {
												"type": "boolean"
											},
											"notation": {
												"type": "string",
												"enum": [
													"fdi",
													"universal",
													"palmer"
												]
											},
											"rail": {
												"type": "boolean"
											},
											"hoverChart": {
												"type": "object",
												"properties": {
													"on": {
														"type": "boolean"
													},
													"mode": {
														"type": "string",
														"enum": [
															"automated",
															"manual"
														]
													},
													"manual": {
														"type": "object",
														"properties": {
															"treatment": {
																"maxItems": 10,
																"type": "array",
																"items": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"base": {
																"maxItems": 10,
																"type": "array",
																"items": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "uuid",
																			"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															}
														}
													},
													"automated": {
														"type": "object",
														"propertyNames": {
															"type": "string",
															"enum": [
																"upper_incisor",
																"upper_premolar",
																"upper_molar",
																"lower_incisor",
																"lower_premolar",
																"lower_molar",
																"child",
																"upper_incisor_base",
																"upper_premolar_base",
																"upper_molar_base",
																"lower_incisor_base",
																"lower_premolar_base",
																"lower_molar_base",
																"child_base"
															]
														},
														"additionalProperties": {
															"maxItems": 10,
															"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)$"
															}
														}
													}
												}
											},
											"favouriteCodeIds": {
												"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)$"
												}
											},
											"favouriteTemplateIds": {
												"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)$"
												}
											},
											"sort": {
												"type": "string",
												"enum": [
													"code",
													"name"
												]
											},
											"pinFavourites": {
												"type": "boolean"
											},
											"category": {
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											"agePrediction": {
												"type": "string",
												"enum": [
													"ask",
													"auto"
												]
											},
											"imageSize": {
												"type": "string",
												"enum": [
													"small",
													"medium",
													"large"
												]
											},
											"quickButtons": {
												"maxItems": 12,
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"codeId": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"surfaces": {
															"maxItems": 6,
															"type": "array",
															"items": {
																"type": "string",
																"enum": [
																	"M",
																	"O",
																	"D",
																	"B",
																	"L",
																	"I"
																]
															}
														}
													},
													"required": [
														"codeId",
														"surfaces"
													]
												}
											}
										}
									},
									"perio": {
										"type": "object",
										"properties": {
											"order": {
												"minItems": 4,
												"maxItems": 4,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"upper_palatal",
														"upper_buccal",
														"lower_buccal",
														"lower_lingual"
													]
												}
											},
											"directions": {
												"type": "object",
												"propertyNames": {
													"type": "string",
													"enum": [
														"upper_palatal",
														"upper_buccal",
														"lower_buccal",
														"lower_lingual"
													]
												},
												"additionalProperties": {
													"type": "string",
													"enum": [
														"ltr",
														"rtl"
													]
												}
											},
											"entry": {
												"type": "string",
												"enum": [
													"row",
													"tooth"
												]
											},
											"auto": {
												"type": "boolean"
											}
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"chart": {
											"type": "object",
											"properties": {
												"condensed": {
													"type": "boolean"
												},
												"roots": {
													"type": "boolean"
												},
												"mixedDentition": {
													"type": "boolean"
												},
												"locked": {
													"type": "boolean"
												},
												"showAllPlans": {
													"type": "boolean"
												},
												"notation": {
													"type": "string",
													"enum": [
														"fdi",
														"universal",
														"palmer"
													]
												},
												"rail": {
													"type": "boolean"
												},
												"hoverChart": {
													"type": "object",
													"properties": {
														"on": {
															"type": "boolean"
														},
														"mode": {
															"type": "string",
															"enum": [
																"automated",
																"manual"
															]
														},
														"manual": {
															"type": "object",
															"properties": {
																"treatment": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"base": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																}
															},
															"additionalProperties": false
														},
														"automated": {
															"type": "object",
															"propertyNames": {
																"type": "string",
																"enum": [
																	"upper_incisor",
																	"upper_premolar",
																	"upper_molar",
																	"lower_incisor",
																	"lower_premolar",
																	"lower_molar",
																	"child",
																	"upper_incisor_base",
																	"upper_premolar_base",
																	"upper_molar_base",
																	"lower_incisor_base",
																	"lower_premolar_base",
																	"lower_molar_base",
																	"child_base"
																]
															},
															"additionalProperties": {
																"maxItems": 10,
																"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
												},
												"favouriteCodeIds": {
													"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)$"
													}
												},
												"favouriteTemplateIds": {
													"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)$"
													}
												},
												"sort": {
													"type": "string",
													"enum": [
														"code",
														"name"
													]
												},
												"pinFavourites": {
													"type": "boolean"
												},
												"category": {
													"type": "string",
													"minLength": 1,
													"maxLength": 64
												},
												"agePrediction": {
													"type": "string",
													"enum": [
														"ask",
														"auto"
													]
												},
												"imageSize": {
													"type": "string",
													"enum": [
														"small",
														"medium",
														"large"
													]
												},
												"quickButtons": {
													"maxItems": 12,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"codeId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"surfaces": {
																"maxItems": 6,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"M",
																		"O",
																		"D",
																		"B",
																		"L",
																		"I"
																	]
																}
															}
														},
														"required": [
															"codeId",
															"surfaces"
														],
														"additionalProperties": false
													}
												}
											},
											"additionalProperties": false
										},
										"perio": {
											"type": "object",
											"properties": {
												"order": {
													"minItems": 4,
													"maxItems": 4,
													"type": "array",
													"items": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													}
												},
												"directions": {
													"type": "object",
													"propertyNames": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													},
													"additionalProperties": {
														"type": "string",
														"enum": [
															"ltr",
															"rtl"
														]
													}
												},
												"entry": {
													"type": "string",
													"enum": [
														"row",
														"tooth"
													]
												},
												"auto": {
													"type": "boolean"
												}
											},
											"additionalProperties": false
										},
										"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": [
										"chart",
										"perio",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/me/preferences/hover-learn": {
			"post": {
				"summary": "Learn a charted code for the hover chart",
				"tags": [
					"pms"
				],
				"description": "Dentally's rule: the code is appended to the region's list unless it is already there or the list holds ten, when nothing changes. Serialised per member.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"region": {
										"type": "string",
										"enum": [
											"upper_incisor",
											"upper_premolar",
											"upper_molar",
											"lower_incisor",
											"lower_premolar",
											"lower_molar",
											"child",
											"upper_incisor_base",
											"upper_premolar_base",
											"upper_molar_base",
											"lower_incisor_base",
											"lower_premolar_base",
											"lower_molar_base",
											"child_base"
										]
									},
									"codeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"region",
									"codeId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"chart": {
											"type": "object",
											"properties": {
												"condensed": {
													"type": "boolean"
												},
												"roots": {
													"type": "boolean"
												},
												"mixedDentition": {
													"type": "boolean"
												},
												"locked": {
													"type": "boolean"
												},
												"showAllPlans": {
													"type": "boolean"
												},
												"notation": {
													"type": "string",
													"enum": [
														"fdi",
														"universal",
														"palmer"
													]
												},
												"rail": {
													"type": "boolean"
												},
												"hoverChart": {
													"type": "object",
													"properties": {
														"on": {
															"type": "boolean"
														},
														"mode": {
															"type": "string",
															"enum": [
																"automated",
																"manual"
															]
														},
														"manual": {
															"type": "object",
															"properties": {
																"treatment": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"base": {
																	"maxItems": 10,
																	"type": "array",
																	"items": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "uuid",
																				"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																}
															},
															"additionalProperties": false
														},
														"automated": {
															"type": "object",
															"propertyNames": {
																"type": "string",
																"enum": [
																	"upper_incisor",
																	"upper_premolar",
																	"upper_molar",
																	"lower_incisor",
																	"lower_premolar",
																	"lower_molar",
																	"child",
																	"upper_incisor_base",
																	"upper_premolar_base",
																	"upper_molar_base",
																	"lower_incisor_base",
																	"lower_premolar_base",
																	"lower_molar_base",
																	"child_base"
																]
															},
															"additionalProperties": {
																"maxItems": 10,
																"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
												},
												"favouriteCodeIds": {
													"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)$"
													}
												},
												"favouriteTemplateIds": {
													"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)$"
													}
												},
												"sort": {
													"type": "string",
													"enum": [
														"code",
														"name"
													]
												},
												"pinFavourites": {
													"type": "boolean"
												},
												"category": {
													"type": "string",
													"minLength": 1,
													"maxLength": 64
												},
												"agePrediction": {
													"type": "string",
													"enum": [
														"ask",
														"auto"
													]
												},
												"imageSize": {
													"type": "string",
													"enum": [
														"small",
														"medium",
														"large"
													]
												},
												"quickButtons": {
													"maxItems": 12,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"codeId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"surfaces": {
																"maxItems": 6,
																"type": "array",
																"items": {
																	"type": "string",
																	"enum": [
																		"M",
																		"O",
																		"D",
																		"B",
																		"L",
																		"I"
																	]
																}
															}
														},
														"required": [
															"codeId",
															"surfaces"
														],
														"additionalProperties": false
													}
												}
											},
											"additionalProperties": false
										},
										"perio": {
											"type": "object",
											"properties": {
												"order": {
													"minItems": 4,
													"maxItems": 4,
													"type": "array",
													"items": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													}
												},
												"directions": {
													"type": "object",
													"propertyNames": {
														"type": "string",
														"enum": [
															"upper_palatal",
															"upper_buccal",
															"lower_buccal",
															"lower_lingual"
														]
													},
													"additionalProperties": {
														"type": "string",
														"enum": [
															"ltr",
															"rtl"
														]
													}
												},
												"entry": {
													"type": "string",
													"enum": [
														"row",
														"tooth"
													]
												},
												"auto": {
													"type": "boolean"
												}
											},
											"additionalProperties": false
										},
										"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": [
										"chart",
										"perio",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/me/goals": {
			"get": {
				"summary": "My targets, streaks, league and badges",
				"tags": [
					"goals"
				],
				"description": "The signed-in member's own targets and today's progress, streaks, this period's league among members with the same target on, badge levels and levels not yet shown, plus Before you go (for everyone). Session only.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MyGoals"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/me/goals/levels/seen": {
			"post": {
				"summary": "Mark badge levels as shown",
				"tags": [
					"goals"
				],
				"description": "After the Level up card appeared: the levels are no longer offered. Own levels only; unknown ids are ignored. Idempotent.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"ids": {
										"minItems": 1,
										"maxItems": 50,
										"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": {
										"seen": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"seen"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/me/goals/recaps": {
			"get": {
				"summary": "My monthly recaps",
				"tags": [
					"goals"
				],
				"description": "Every finished month with a target on, newest first, and which recaps it has.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"months": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"month": {
														"type": "string",
														"pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
													},
													"bookings": {
														"type": "boolean"
													},
													"closing": {
														"type": "boolean"
													}
												},
												"required": [
													"month",
													"bookings",
													"closing"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"months"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/me/goals/recaps/{month}": {
			"get": {
				"summary": "One month's recap",
				"tags": [
					"goals"
				],
				"description": "Numbers only, no patient details, worked out from the month's own records. 404 for a month without a target on.",
				"parameters": [
					{
						"name": "month",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MyRecap"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/me/widget": {
			"get": {
				"summary": "My phone widgets",
				"tags": [
					"goals"
				],
				"description": "The signed-in member's widget numbers and today's occasion for the staff iPhone app. Session only: API keys and OAuth are refused. Counts, times, sites and rooms only — never a patient's details. Each block is null when the member can't open that screen; `callsSeenAt` is the phone's own last look at Calls.",
				"parameters": [
					{
						"name": "callsSeenAt",
						"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))$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/MyWidget"
								}
							}
						}
					},
					"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
									},
									"expectedOrganizationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
										"description": "Canonical lowercase UUID organization identifier"
									}
								},
								"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/conversation": {
			"get": {
				"summary": "The assistant window's state",
				"tags": [
					"Assistant"
				],
				"description": "The person's current conversation (its latest 50 turns and their actions) and this month's allowance. Polled while a turn is queued or running.",
				"parameters": [
					{
						"name": "conversationId",
						"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": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/conversations": {
			"post": {
				"summary": "Start a new assistant conversation",
				"tags": [
					"Assistant"
				],
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/conversations/{conversationId}/messages": {
			"post": {
				"summary": "Ask the assistant",
				"tags": [
					"Assistant"
				],
				"description": "Admits the message as a turn that runs in the background (it waits behind the person's running turn). 402 ASSISTANT_ALLOWANCE_EXHAUSTED when a practice without the AI add-on used this month's free messages; 409 ASSISTANT_CONVERSATION_CLOSED when the conversation can no longer be used (start a new one); 403 ASSISTANT_SUPPORT_VISIT during a Smileline support visit. A resend with the same turnId answers the same state.",
				"parameters": [
					{
						"name": "conversationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"turnId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "string",
										"minLength": 1,
										"maxLength": 4000
									},
									"pageContext": {
										"$ref": "#/components/schemas/AssistantPageContext"
									}
								},
								"required": [
									"turnId",
									"message",
									"pageContext"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"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"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/turns/{id}/resume": {
			"post": {
				"summary": "Continue, resume or retry a parked turn",
				"tags": [
					"Assistant"
				],
				"description": "Starts a new run of the same turn from where it stopped: Continue after its rounds ran out, Resume after an interruption, Retry after an unreadable reply. Never billed again.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/turns/{id}/dismiss": {
			"post": {
				"summary": "Dismiss a turn whose reply could not be read",
				"tags": [
					"Assistant"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/turns/{id}/cancel": {
			"post": {
				"summary": "Stop a queued or running turn",
				"tags": [
					"Assistant"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/actions/{id}/confirm": {
			"post": {
				"summary": "Confirm a proposed change",
				"tags": [
					"Assistant"
				],
				"description": "Runs the action's frozen request once, as the person, through the ordinary API (its own permission checks and validation apply). 409 ASSISTANT_ACTION_STALE when a newer message superseded it or it was already decided.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/actions/{id}/reject": {
			"post": {
				"summary": "Decline a proposed change",
				"tags": [
					"Assistant"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/actions/{id}/resolve": {
			"post": {
				"summary": "Record the outcome of a change whose result was lost",
				"tags": [
					"Assistant"
				],
				"description": "Only for an action stuck applying past its wait: the person checks the page and marks it applied or failed. It is never retried 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": {
									"outcome": {
										"type": "string",
										"enum": [
											"applied",
											"failed"
										]
									}
								},
								"required": [
									"outcome"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conversation": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AssistantConversation"
												},
												{
													"type": "null"
												}
											]
										},
										"allowance": {
											"$ref": "#/components/schemas/AssistantAllowance"
										},
										"chartPlanning": {
											"type": "boolean"
										}
									},
									"required": [
										"conversation",
										"allowance",
										"chartPlanning"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/conversations/{conversationId}/displays/{displayId}": {
			"get": {
				"summary": "One dashboard the assistant drew",
				"tags": [
					"Assistant"
				],
				"description": "A dashboard from the person's own conversation, with the data its queries returned when the answer ran. Refused like the conversation itself: 404 for a conversation that is not the person's, 409 ASSISTANT_CONVERSATION_CLOSED once it can no longer be used.",
				"parameters": [
					{
						"name": "conversationId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "displayId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"heading": {
											"type": "string"
										},
										"asOf": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"panels": {
											"minItems": 1,
											"maxItems": 6,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AssistantDashboardPanel"
											}
										}
									},
									"required": [
										"id",
										"heading",
										"asOf",
										"currency",
										"panels"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/assistant/dictation": {
			"post": {
				"summary": "Turn one piece of dictation into text",
				"tags": [
					"Assistant"
				],
				"description": "The raw WAV body (16 kHz mono 16-bit PCM, at most 4 MiB, about 100 s of speech). Answers its text to the person who sent it; neither the audio nor the text is stored. 400 or 415 ASSISTANT_DICTATION_BAD_AUDIO for another format; 502 ASSISTANT_DICTATION_FAILED and 503 ASSISTANT_DICTATION_UNAVAILABLE are worth sending again.",
				"requestBody": {
					"required": true,
					"content": {
						"audio/wav": {
							"schema": {
								"type": "string",
								"description": "The piece's WAV bytes",
								"format": "binary"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"text": {
											"type": "string",
											"maxLength": 32000
										}
									},
									"required": [
										"text"
									],
									"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"
								}
							}
						}
					},
					"415": {
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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. 400 NOT_AN_IMAGE when a staged file is not a PNG, JPEG, GIF or WebP image; 409 UPLOAD_UNAVAILABLE when an upload id expired, was already used, or is not the caller's.",
				"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"
									},
									"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"
											]
										}
									}
								},
								"required": [
									"clientMessageId"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/attachments": {
			"post": {
				"summary": "Stage an image for a team chat message",
				"tags": [
					"Team chat"
				],
				"description": "multipart/form-data with a single `file` field (max 16 MiB). Returns an expiring, one-time upload id to include in the caller's next send.",
				"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/team-chat/threads/{threadId}/messages/{messageId}/attachments/{index}": {
			"get": {
				"summary": "Download an image sent in a thread",
				"tags": [
					"Team chat"
				],
				"description": "Streams the image privately (no-store) to a member of the thread; 404 for anyone else. A single `Range: bytes=` request answers 206 with Content-Range (416 past the end).",
				"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": "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"
								}
							}
						}
					},
					"206": {
						"description": "Partial Content",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"416": {
						"description": "Range Not Satisfiable"
					}
				}
			}
		},
		"/team-chat/threads/{threadId}/messages/{messageId}/reactions": {
			"post": {
				"summary": "Set the caller's reaction on a message",
				"tags": [
					"Team chat"
				],
				"description": "An idempotent set: the caller has (or no longer has) that emoji on the message afterwards. Answers the message's reactions and the revision they were read at. 404 when the caller is not a member or the message is not in the thread.",
				"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": "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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"emoji": {
										"type": "string",
										"description": "Exactly one RGI emoji"
									},
									"reacted": {
										"type": "boolean"
									}
								},
								"required": [
									"emoji",
									"reacted"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"reactions": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TeamReaction"
											}
										},
										"reactionsRev": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"reactions",
										"reactionsRev"
									],
									"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"
				],
				"description": "Answers the caller's read position and their team chat badge total after the mark, read in the same transaction.",
				"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
										},
										"unreadCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"unreadCountCapped": {
											"type": "boolean"
										}
									},
									"required": [
										"lastReadSeq",
										"unreadCount",
										"unreadCountCapped"
									],
									"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",
								"instagram",
								"messenger"
							]
						}
					},
					{
						"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",
													"instagram",
													"messenger"
												]
											},
											{
												"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",
				"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",
											"instagram",
											"messenger"
										]
									},
									"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",
													"instagram",
													"messenger"
												]
											},
											{
												"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 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
									}
								},
								"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"
								}
							}
						}
					}
				}
			}
		},
		"/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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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/invoices": {
			"get": {
				"summary": "List the organization's recent invoices and its card",
				"tags": [
					"billing"
				],
				"description": "The last 12 invoices and the card on file, read from Stripe with one short attempt each; either part is null when Stripe cannot be read, and the other still answers. Invoice links are never returned: the billing portal opens them. Owner/admin only.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"invoices": {
											"anyOf": [
												{
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"id": {
																"type": "string"
															},
															"number": {
																"type": [
																	"string",
																	"null"
																]
															},
															"status": {
																"type": [
																	"string",
																	"null"
																]
															},
															"total": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"amountDue": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"currency": {
																"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))$"
															},
															"periodStart": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															"periodEnd": {
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															}
														},
														"required": [
															"id",
															"number",
															"status",
															"total",
															"amountDue",
															"currency",
															"createdAt",
															"periodStart",
															"periodEnd"
														],
														"additionalProperties": false
													}
												},
												{
													"type": "null"
												}
											]
										},
										"paymentMethod": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"brand": {
															"type": "string"
														},
														"last4": {
															"type": "string"
														},
														"expMonth": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"expYear": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"brand",
														"last4",
														"expMonth",
														"expYear"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"invoices",
										"paymentMethod"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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",
											"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/voice": {
			"post": {
				"summary": "Turn on Smileline Voice on pay-as-you-go",
				"tags": [
					"billing"
				],
				"description": "On pay-as-you-go Voice bills by the minute, so every subscription in a Voice country is entitled to it; the practice turns it on here, and its calls then ring through Smileline Voice instead of forwarding. Brings back the numbers of a practice that had Voice. Idempotent. Refused before pay-as-you-go (409 VOICE_SETUP_NOT_ON_PRICE_BOOK: the Voice add-on turns it on there). Requires the Voice entitlement. 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/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"
										]
									},
									"plan": {
										"type": "string",
										"const": "seo_social"
									}
								},
								"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. A card must be on file, on the subscription or its customer (409 PAYMENT_METHOD_REQUIRED, nothing sent). The subscription stays paused while the resumption invoice's payment is pending. 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"
								}
							}
						}
					}
				}
			}
		},
		"/billing/price-book": {
			"post": {
				"summary": "Switch the subscription to pay-as-you-go",
				"tags": [
					"billing"
				],
				"description": "Moves a paying subscription to the current pay-as-you-go price list, one way and at once: add-ons end with a credit for their unused time, the platform fee and AI voice minutes change price, and every feature bills by use from then on. Refused while trialing, for a complimentary subscription, or when the practice is already on the current list. Needs a fresh password confirmation. 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"
								}
							}
						}
					}
				}
			}
		},
		"/billing/upgrade": {
			"post": {
				"summary": "Upgrade the SEO & Social plan to the full system",
				"tags": [
					"billing"
				],
				"description": "Adds the full system to the practice's SEO & Social subscription. A card must be on file (409 PAYMENT_METHOD_REQUIRED). A practice that never had the free trial gets it, its SEO & Social usage so far invoiced first; otherwise the platform fee starts today. 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"
							]
						}
					},
					{
						"name": "direction",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					}
				],
				"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"
															}
														]
													},
													"labelId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
														"type": [
															"string",
															"null"
														]
													},
													"patientInstruction": {
														"type": [
															"string",
															"null"
														]
													},
													"isFirstVisit": {
														"type": "boolean"
													},
													"bookedVia": {
														"type": "string",
														"enum": [
															"staff",
															"online",
															"api",
															"automation",
															"pms",
															"import"
														]
													},
													"sourceBookedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"sourceBookedOnline": {
														"type": "boolean"
													},
													"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"
															}
														]
													},
													"cancelledBy": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"patient",
																	"practice",
																	"system",
																	"unknown"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"cancellationKind": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"cancelled",
																	"rescheduled",
																	"hold_released",
																	"entered_in_error"
																]
															},
															{
																"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": {
														"type": [
															"string",
															"null"
														]
													},
													"idempotencyDigest": {
														"type": [
															"string",
															"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": {
														"type": [
															"string",
															"null"
														]
													},
													"createdByName": {
														"type": [
															"string",
															"null"
														]
													},
													"createdBySource": {
														"type": "string",
														"enum": [
															"user",
															"patient",
															"automation",
															"campaign",
															"ai",
															"api",
															"import",
															"system",
															"lab"
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													},
													"updatedAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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)$"
														}
													},
													"operatoryName": {
														"type": [
															"string",
															"null"
														]
													},
													"bookedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"pmsHeld": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"organizationId",
													"locationId",
													"uid",
													"patientId",
													"journeyId",
													"appointmentTypeId",
													"treatmentId",
													"labelId",
													"status",
													"version",
													"startsAt",
													"endsAt",
													"timezone",
													"note",
													"patientInstruction",
													"isFirstVisit",
													"bookedVia",
													"sourceBookedAt",
													"sourceBookedOnline",
													"cancellationReasonId",
													"cancelledBy",
													"cancellationKind",
													"rescheduledFromId",
													"idempotencyKey",
													"idempotencyDigest",
													"heldUntil",
													"confirmedAt",
													"arrivedAt",
													"seatedAt",
													"fulfilledAt",
													"cancelledAt",
													"noShowAt",
													"sourceCorrectionPendingAt",
													"reviewState",
													"customFields",
													"createdById",
													"createdByName",
													"createdBySource",
													"createdAt",
													"updatedAt",
													"practitionerIds",
													"operatoryName",
													"bookedAt",
													"pmsHeld"
												],
												"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. A treatment-plan visit, recall or waiting-list request named in the body is booked in the same command: 409 when it is already booked to a live appointment (VISIT_ALREADY_BOOKED, RECALL_ALREADY_BOOKED, WAITLIST_TRANSITION), and nothing is written. A site a practice management system covers books there instead (409 PMS_MANAGED_SITE).",
				"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)$"
									},
									"practitionerIds": {
										"minItems": 1,
										"maxItems": 10,
										"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": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
										"type": [
											"string",
											"null"
										]
									},
									"patientInstruction": {
										"type": [
											"string",
											"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)$"
									},
									"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)$"
									},
									"waitlistRequestId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"waitlistExpectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"requestId",
									"patientId",
									"startsAt",
									"endsAt"
								],
								"description": "endsAt must be after startsAt. locationId may be omitted only when the organization has exactly one location. practitionerIds (1–10) names every clinician on the visit, instead of practitionerId."
							}
						}
					}
				},
				"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. A visit a practice management system holds keeps its time, clinicians, room, site, type and treatment as the provider has them (409 PMS_MANAGED for a change to any of them; move it with POST /appointments/:id/pms-move); its label, note and lead still edit 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)$"
						}
					}
				],
				"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"
											}
										]
									},
									"practitionerIds": {
										"minItems": 1,
										"maxItems": 10,
										"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"
											}
										]
									},
									"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": {
										"type": [
											"string",
											"null"
										]
									},
									"patientInstruction": {
										"type": [
											"string",
											"null"
										]
									},
									"isFirstVisit": {
										"type": "boolean"
									},
									"labelId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"zoneOverride": {
										"type": "boolean",
										"const": true
									}
								},
								"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}/pms-move": {
			"post": {
				"summary": "Move a visit the practice management system holds",
				"tags": [
					"appointments"
				],
				"description": "Queues the move with the practice management system (Dentally and the others that take moves) and answers 202 with the operation; nothing changes in Smileline until the provider's own row says the move happened, when the sync applies it and the visit's attendance question follows. `practitionerIds`, when given, is the visit's whole clinician set; the room is always kept. Only a pending, booked or confirmed visit moves. 409: PMS_OPERATION_PENDING (a move is already on its way), VERSION_CONFLICT, VISIT_NOT_MOVABLE (not one the provider holds and can move now), VISIT_MOVE_UNSUPPORTED (a change the provider's move cannot make), PMS_BOOKING_NOT_YET_IN_PMS (the visit's own booking has not reached the provider yet), PMS_ROOM_CHANGE_UNSUPPORTED. Signed-in people 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": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"minimum": 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))$"
									},
									"practitionerIds": {
										"minItems": 1,
										"maxItems": 10,
										"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": [
									"expectedVersion",
									"startsAt",
									"endsAt"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsAppointmentOperation"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
				],
				"description": "Cancels with a cancellation reason, or without one when `enteredInError` is true: a visit booked by mistake, which reports and worklists never count as a cancellation. Either way the patient gets the practice's cancellation message and a connected PMS is told.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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)$"
									},
									"enteredInError": {
										"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}/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}/undo-arrival": {
			"post": {
				"summary": "Undo an appointment's arrival",
				"tags": [
					"appointments"
				],
				"description": "The one way back from arrived, before the patient is in the chair: restores confirmed (when the visit had been confirmed) or booked, clears arrivedAt and records the reason. A visit in any other status is 409 NOT_ARRIVED; a stale expectedVersion is 409 VERSION_CONFLICT. Not for appointments a practice management system manages (409 PMS_MANAGED).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"expectedVersion",
									"reason"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/appointments/{id}/booking-message": {
			"post": {
				"summary": "Send the booking message now",
				"tags": [
					"appointments"
				],
				"description": "Sends the visit's booking confirmation now, on every booking-confirmation rule switched on for it — the ones the automation would choose. When the automation already sent the visit's booking message or has it queued, nothing is sent and the answer is 409 BOOKING_MESSAGE_ALREADY_SENT with details { at, due }; resend: true sends another copy anyway. A patient without the channel's address, or a template that can't go, is listed in skipped. A visit that is past, cancelled, missed or attended is 400 APPOINTMENT_NOT_UPCOMING; no booking confirmation switched on is 400 NO_BOOKING_MESSAGE_ON.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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)$"
									},
									"resend": {
										"type": "boolean"
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"sent": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"channel": {
														"type": "string",
														"enum": [
															"email",
															"sms",
															"whatsapp"
														]
													}
												},
												"required": [
													"channel"
												],
												"additionalProperties": false
											}
										},
										"skipped": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"channel": {
														"type": "string",
														"enum": [
															"email",
															"sms",
															"whatsapp"
														]
													},
													"detail": {
														"type": "string"
													}
												},
												"required": [
													"channel",
													"detail"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"sent",
										"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"
								}
							}
						}
					},
					"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"contentType": {
											"type": [
												"string",
												"null"
											]
										},
										"payload": {
											"anyOf": [
												{
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {}
												},
												{
													"type": "null"
												}
											]
										},
										"body": {
											"type": [
												"string",
												"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, landing_url, capture_url, referrer, url_params, cookies, client_hints, screen_width, screen_height, timezone, consent, ga) — envelope values win, and an invalid envelope field is dropped on its own. `_sl.consent` carries ad_storage, analytics_storage, ad_user_data and ad_personalization as booleans or Consent Mode's \"granted\"/\"denied\", plus `advertising` as a shorthand for the three ad flags. Conversions are shared with the ad platform the lead came from unless one of the ad flags (or `advertising`) is false; leave them out when the visitor made no choice. `_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. Answers 201 as soon as the request is stored (after the token, rate limit and — for signed hooks — the signature, query-string and content-type checks); the lead is created moments later. A stored request that cannot become a lead (an unreadable body, no email or phone, an event_id reused with different content) is recorded in the hook's delivery history and kept for review. 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": {
													"type": [
														"string",
														"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": {
													"type": [
														"string",
														"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 — and every pool needs a live location. Where the pool's calls go is set on Call routing (PUT /voice/routing/pools/:poolId).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"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)$"
									},
									"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"
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"archived"
										]
									}
								},
								"required": [
									"name",
									"locationId",
									"defaultTreatmentId",
									"swapTargets",
									"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"
												}
											]
										},
										"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"
												}
											]
										},
										"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"
										},
										"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
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"routingConfigId",
										"defaultTreatmentId",
										"swapTargets",
										"swapAllNumbers",
										"status",
										"numberCount",
										"liveAssignmentCount",
										"unservedToday",
										"unservedWeek",
										"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"
				],
				"description": "Same body and rules as creating a pool. Where the pool's calls go is set on Call routing (PUT /voice/routing/pools/:poolId).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"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"
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"archived"
										]
									}
								},
								"required": [
									"name",
									"locationId",
									"defaultTreatmentId",
									"swapTargets",
									"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"
												}
											]
										},
										"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"
												}
											]
										},
										"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"
										},
										"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
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"routingConfigId",
										"defaultTreatmentId",
										"swapTargets",
										"swapAllNumbers",
										"status",
										"numberCount",
										"liveAssignmentCount",
										"unservedToday",
										"unservedWeek",
										"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-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": {
											"type": [
												"string",
												"null"
											]
										},
										"builderConfig": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/FormBuilderConfig"
												},
												{
													"type": "null"
												}
											]
										},
										"fingerprint": {
											"type": [
												"string",
												"null"
											]
										},
										"pageUrl": {
											"type": [
												"string",
												"null"
											]
										},
										"selector": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"hostedPageToken": {
											"type": [
												"string",
												"null"
											]
										},
										"hostedPageEnabled": {
											"type": "boolean"
										},
										"siteId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sitePageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"siteBlockId": {
											"type": [
												"string",
												"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))$"
										},
										"name": {
											"type": "string"
										},
										"token": {
											"type": "string"
										},
										"signingSecret": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"type",
										"status",
										"captureHookId",
										"domain",
										"builderConfig",
										"fingerprint",
										"pageUrl",
										"selector",
										"fieldInventory",
										"lastSeenAt",
										"proposedFieldMap",
										"proposalSource",
										"mappingConfirmedAt",
										"mappingConfirmedById",
										"hostedPageToken",
										"hostedPageEnabled",
										"siteId",
										"sitePageId",
										"siteBlockId",
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"builderConfig": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/FormBuilderConfig"
												},
												{
													"type": "null"
												}
											]
										},
										"fingerprint": {
											"type": [
												"string",
												"null"
											]
										},
										"pageUrl": {
											"type": [
												"string",
												"null"
											]
										},
										"selector": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"hostedPageToken": {
											"type": [
												"string",
												"null"
											]
										},
										"hostedPageEnabled": {
											"type": "boolean"
										},
										"siteId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"sitePageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"siteBlockId": {
											"type": [
												"string",
												"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))$"
										},
										"name": {
											"type": "string"
										},
										"token": {
											"type": "string"
										},
										"hook": {
											"$ref": "#/components/schemas/CaptureHook"
										},
										"coveredBy": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/CoveringEndpoint"
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"type",
										"status",
										"captureHookId",
										"domain",
										"builderConfig",
										"fingerprint",
										"pageUrl",
										"selector",
										"fieldInventory",
										"lastSeenAt",
										"proposedFieldMap",
										"proposalSource",
										"mappingConfirmedAt",
										"mappingConfirmedById",
										"hostedPageToken",
										"hostedPageEnabled",
										"siteId",
										"sitePageId",
										"siteBlockId",
										"archivedAt",
										"createdAt",
										"updatedAt",
										"name",
										"token",
										"hook",
										"coveredBy"
									],
									"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 and returns the swap instructions. The number stays with the visitor while their page keeps checking in (`intent: \"keepalive\"`, every 15 seconds) and frees the moment they leave (`intent: \"release\"`), or within a minute when a page vanishes without one; freed numbers go out longest-free first. When every number is held by someone on the site, the visitor shares the number of whoever was active least recently. A check-in only renews numbers the visitor still holds. 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": [
															{
																"anyOf": [
																	{
																		"type": "boolean"
																	},
																	{
																		"type": "string",
																		"enum": [
																			"granted",
																			"denied"
																		]
																	}
																]
															},
															{
																"type": "null"
															}
														]
													},
													"analytics_storage": {
														"anyOf": [
															{
																"anyOf": [
																	{
																		"type": "boolean"
																	},
																	{
																		"type": "string",
																		"enum": [
																			"granted",
																			"denied"
																		]
																	}
																]
															},
															{
																"type": "null"
															}
														]
													},
													"ad_user_data": {
														"anyOf": [
															{
																"anyOf": [
																	{
																		"type": "boolean"
																	},
																	{
																		"type": "string",
																		"enum": [
																			"granted",
																			"denied"
																		]
																	}
																]
															},
															{
																"type": "null"
															}
														]
													},
													"ad_personalization": {
														"anyOf": [
															{
																"anyOf": [
																	{
																		"type": "boolean"
																	},
																	{
																		"type": "string",
																		"enum": [
																			"granted",
																			"denied"
																		]
																	}
																]
															},
															{
																"type": "null"
															}
														]
													},
													"advertising": {
														"anyOf": [
															{
																"anyOf": [
																	{
																		"type": "boolean"
																	},
																	{
																		"type": "string",
																		"enum": [
																			"granted",
																			"denied"
																		]
																	}
																]
															},
															{
																"type": "null"
															}
														]
													}
												}
											},
											"ga": {
												"type": "object",
												"properties": {
													"client_id": {
														"type": "string",
														"minLength": 1,
														"maxLength": 64
													},
													"session_id": {
														"type": "string",
														"minLength": 1,
														"maxLength": 64
													}
												}
											}
										}
									},
									"intent": {
										"type": "string",
										"enum": [
											"keepalive",
											"release"
										]
									}
								},
								"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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/tracking/server-key": {
			"post": {
				"summary": "Create or rotate the Astro integration's server key",
				"tags": [
					"settings"
				],
				"description": "Mints a fresh server key and returns it once; only its hash is stored. The previous key stops being trusted within two minutes (cache window). With a valid key the API trusts the visitor facts the integration forwards from the practice's own domain.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"serverKey": {
											"type": "string"
										},
										"tracking": {
											"$ref": "#/components/schemas/WebsiteTracking"
										}
									},
									"required": [
										"serverKey",
										"tracking"
									],
									"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}/events": {
			"post": {
				"summary": "Public page-view and leave beacons",
				"tags": [
					"site"
				],
				"description": "Unauthenticated, keyed by the public site key (`pk_…`). The tracking script's page-view and leave beacons, sent as text/plain JSON. The raw body (≤ 32 KiB) is queued unparsed and stored per practice by the jobs Worker; failures park the original bytes in the ingress vault. Always 202 once accepted.",
				"security": [],
				"parameters": [
					{
						"name": "siteKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 80
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"text/plain": {
							"schema": {
								"type": "object",
								"properties": {
									"v": {
										"type": "number",
										"const": 1
									},
									"events": {
										"minItems": 1,
										"maxItems": 10,
										"type": "array",
										"items": {
											"oneOf": [
												{
													"type": "object",
													"properties": {
														"kind": {
															"type": "string",
															"const": "view"
														},
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"nav": {
															"type": "string",
															"enum": [
																"load",
																"soft"
															]
														},
														"host": {
															"type": "string",
															"minLength": 1,
															"maxLength": 253
														},
														"path": {
															"type": "string",
															"minLength": 1,
															"maxLength": 2048,
															"format": "starts_with",
															"pattern": "^\\/.*"
														},
														"ref_host": {
															"anyOf": [
																{
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 253
																},
																{
																	"type": "null"
																}
															]
														},
														"params": {
															"type": "object",
															"propertyNames": {
																"type": "string",
																"minLength": 1,
																"maxLength": 64
															},
															"additionalProperties": {
																"type": "string",
																"maxLength": 512
															}
														},
														"analytics_storage": {
															"type": [
																"boolean",
																"null"
															]
														},
														"visitor_id": {
															"type": "string",
															"minLength": 1,
															"maxLength": 200
														},
														"vid_cookie": {
															"type": "boolean"
														},
														"test": {
															"type": "object",
															"properties": {
																"id": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"variant": {
																	"type": "string",
																	"enum": [
																		"a",
																		"b"
																	]
																}
															},
															"required": [
																"id",
																"variant"
															],
															"additionalProperties": false
														}
													},
													"required": [
														"kind",
														"id",
														"nav",
														"host",
														"path",
														"ref_host",
														"analytics_storage"
													],
													"additionalProperties": false
												},
												{
													"type": "object",
													"properties": {
														"kind": {
															"type": "string",
															"const": "leave"
														},
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														"engaged_ms": {
															"type": "integer",
															"minimum": 0,
															"maximum": 2147483647
														}
													},
													"required": [
														"kind",
														"id",
														"engaged_ms"
													],
													"additionalProperties": false
												}
											]
										}
									}
								},
								"required": [
									"v",
									"events"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"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"
								}
							}
						}
					},
					"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}/server-config": {
			"get": {
				"summary": "Astro integration server configuration",
				"tags": [
					"site"
				],
				"description": "Called server-side by @smileline/astro with the X-Smileline-Server-Key header; never proxied to browsers. Returns the page tests to split and the consent posture, and records the integration heartbeat. A missing or invalid server key answers 401.",
				"security": [],
				"parameters": [
					{
						"name": "siteKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 80
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"consentPolicy": {
											"type": "string",
											"enum": [
												"auto",
												"always_required",
												"not_required"
											]
										},
										"tests": {
											"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)$"
													},
													"testedPath": {
														"type": "string"
													},
													"variantPath": {
														"type": "string"
													},
													"status": {
														"type": "string",
														"enum": [
															"running",
															"stopped"
														]
													},
													"winner": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"a",
																	"b"
																]
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"testedPath",
													"variantPath",
													"status",
													"winner"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"consentPolicy",
										"tests"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/site/{siteKey}/recording": {
			"post": {
				"summary": "Public heatmap / session-recording upload",
				"tags": [
					"site"
				],
				"description": "Unauthenticated, keyed by the public site key and an upload capability minted by the site config. The body is one Clarity upload (gzip or text per `enc`), stored durably before anything else; a pointer then queues its analysis. 202 once stored; 204 when the browser sends Global Privacy Control; 409 when a retry's binding differs from the stored part.",
				"security": [],
				"parameters": [
					{
						"name": "siteKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 80
						}
					},
					{
						"name": "cap",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2048
						}
					},
					{
						"name": "vid",
						"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": "rec",
						"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": "pv",
						"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": "path",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2048,
							"format": "starts_with",
							"pattern": "^\\/.*"
						}
					},
					{
						"name": "seq",
						"in": "query",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 129
						}
					},
					{
						"name": "enc",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"gzip",
								"text"
							]
						}
					},
					{
						"name": "host",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 253
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"text/plain": {
							"schema": {
								"type": "string"
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"204": {
						"description": "No Content"
					},
					"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/website/tracking/insights": {
			"patch": {
				"summary": "Switch heatmaps and session recordings on or off",
				"tags": [
					"settings"
				],
				"description": "Stored in the tracking config (`config.insights`; absent = on). Off stops new uploads within the hour (capability lifetime) and makes the tracking script stop recording on its next config read.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									}
								},
								"required": [
									"enabled"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/overview": {
			"get": {
				"summary": "Website analytics overview",
				"tags": [
					"website-analytics"
				],
				"description": "Visits, visitors, page views, time on page, top pages, channels, sources, devices, countries and active hours for the window, with CRM leads and bookings per page and channel, the previous window's totals and a visits/page-views series against it. Pages are per address and path, so the same path on two addresses stays two rows; `host` narrows everything to one address. A window past the reports' bucket cap at its automatic grain is a 400. Anonymous: no visitor is ever linked to a lead here.",
				"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": "host",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 253
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"$ref": "#/components/schemas/WebsiteOverview"
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/visitors": {
			"get": {
				"summary": "Anonymous website visitors",
				"tags": [
					"website-analytics"
				],
				"description": "Visitors whose browser stored a visitor id, most recent first. Visitors without stored consent appear only in the overview's totals.",
				"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 512
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "host",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 253
						}
					}
				],
				"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": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/WebsiteVisitorRow"
													}
												},
												"nextCursor": {
													"type": [
														"string",
														"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/visitors/{visitorId}": {
			"get": {
				"summary": "One anonymous visitor's visits",
				"tags": [
					"website-analytics"
				],
				"description": "Visits split on 30 idle minutes, with the pages seen in each. Within the 13-month retention only.",
				"parameters": [
					{
						"name": "visitorId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"$ref": "#/components/schemas/WebsiteVisitorDetail"
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/tests": {
			"get": {
				"summary": "List A/B page tests",
				"tags": [
					"website-analytics"
				],
				"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": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/WebsiteTest"
													}
												},
												"integrationLastSeenAt": {
													"anyOf": [
														{
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
												"items",
												"integrationLastSeenAt"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Start an A/B page test",
				"tags": [
					"website-analytics"
				],
				"description": "Starts splitting the tested path 50/50 with version B through the Astro integration. Neither path may be in use by another test that is not archived.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"testedPath": {
										"type": "string",
										"minLength": 1
									},
									"variantPath": {
										"type": "string",
										"minLength": 1
									}
								},
								"required": [
									"name",
									"testedPath",
									"variantPath"
								]
							}
						}
					}
				},
				"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)$"
										},
										"name": {
											"type": "string"
										},
										"testedPath": {
											"type": "string"
										},
										"variantPath": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"running",
												"stopped",
												"archived"
											]
										},
										"winner": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"a",
														"b"
													]
												},
												{
													"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))$"
										},
										"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"
												}
											]
										},
										"resultsFinalAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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))$"
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"results": {
											"$ref": "#/components/schemas/WebsiteTestResults"
										}
									},
									"required": [
										"id",
										"name",
										"testedPath",
										"variantPath",
										"status",
										"winner",
										"startedAt",
										"endedAt",
										"resultsFinalAt",
										"createdAt",
										"createdByName",
										"results"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/tests/{id}": {
			"get": {
				"summary": "Get one A/B page test with its results",
				"tags": [
					"website-analytics"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
											"$ref": "#/components/schemas/WebsiteTest"
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/tests/{id}/stop": {
			"post": {
				"summary": "Stop an A/B page test",
				"tags": [
					"website-analytics"
				],
				"description": "Stops splitting. With a winner, the integration serves that version to everyone until the test is archived. Results stay provisional for the booking 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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"winner": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"a",
													"b"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"winner"
								]
							}
						}
					}
				},
				"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"
										},
										"testedPath": {
											"type": "string"
										},
										"variantPath": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"running",
												"stopped",
												"archived"
											]
										},
										"winner": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"a",
														"b"
													]
												},
												{
													"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))$"
										},
										"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"
												}
											]
										},
										"resultsFinalAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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))$"
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"results": {
											"$ref": "#/components/schemas/WebsiteTestResults"
										}
									},
									"required": [
										"id",
										"name",
										"testedPath",
										"variantPath",
										"status",
										"winner",
										"startedAt",
										"endedAt",
										"resultsFinalAt",
										"createdAt",
										"createdByName",
										"results"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/tests/{id}/archive": {
			"post": {
				"summary": "Archive a stopped A/B page test",
				"tags": [
					"website-analytics"
				],
				"description": "Releases both paths for new tests; the integration stops serving the winner. Do this once the winning page is the real 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)$"
						}
					}
				],
				"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"
										},
										"testedPath": {
											"type": "string"
										},
										"variantPath": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"running",
												"stopped",
												"archived"
											]
										},
										"winner": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"a",
														"b"
													]
												},
												{
													"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))$"
										},
										"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"
												}
											]
										},
										"resultsFinalAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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))$"
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"results": {
											"$ref": "#/components/schemas/WebsiteTestResults"
										}
									},
									"required": [
										"id",
										"name",
										"testedPath",
										"variantPath",
										"status",
										"winner",
										"startedAt",
										"endedAt",
										"resultsFinalAt",
										"createdAt",
										"createdByName",
										"results"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/heatmaps/pages": {
			"get": {
				"summary": "Pages with recorded visits, for the heatmap picker",
				"tags": [
					"website-analytics"
				],
				"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 512
						}
					},
					{
						"name": "path",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 2048
						}
					},
					{
						"name": "host",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 253
						}
					}
				],
				"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": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"host": {
																"type": [
																	"string",
																	"null"
																]
															},
															"path": {
																"type": "string"
															},
															"recordings": {
																"type": "object",
																"properties": {
																	"mobile": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"tablet": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"desktop": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"mobile",
																	"tablet",
																	"desktop"
																],
																"additionalProperties": false
															}
														},
														"required": [
															"host",
															"path",
															"recordings"
														],
														"additionalProperties": false
													}
												},
												"nextCursor": {
													"type": [
														"string",
														"null"
													]
												},
												"insightsEnabled": {
													"type": "boolean"
												}
											},
											"required": [
												"items",
												"nextCursor",
												"insightsEnabled"
											],
											"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/heatmaps": {
			"get": {
				"summary": "Click and scroll heatmap for one page and device",
				"tags": [
					"website-analytics"
				],
				"parameters": [
					{
						"name": "path",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2048,
							"format": "starts_with",
							"pattern": "^\\/.*"
						}
					},
					{
						"name": "device",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"mobile",
								"tablet",
								"desktop"
							]
						}
					},
					{
						"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": "host",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 253
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"$ref": "#/components/schemas/WebsiteHeatmap"
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/website-analytics/recordings/{id}/play": {
			"post": {
				"summary": "Mint a short-lived read capability for one recording",
				"tags": [
					"website-analytics"
				],
				"description": "Anonymous: returns the recording's playable parts and a 15-minute read token; nothing identifies a lead or 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": {
									"type": "object",
									"properties": {
										"token": {
											"type": "string"
										},
										"mediaBase": {
											"type": "string",
											"format": "uri"
										},
										"parts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"seq": {
														"type": "integer",
														"minimum": 1,
														"maximum": 9007199254740991
													},
													"enc": {
														"type": "string",
														"enum": [
															"gzip",
															"text"
														]
													},
													"bytes": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"seq",
													"enc",
													"bytes"
												],
												"additionalProperties": false
											}
										},
										"storedBytes": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"durationMs": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"path": {
											"type": "string"
										},
										"complete": {
											"type": "boolean"
										}
									},
									"required": [
										"token",
										"mediaBase",
										"parts",
										"storedBytes",
										"durationMs",
										"path",
										"complete"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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",
								"automation-execution",
								"patient-form-draft"
							]
						}
					},
					{
						"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": {
											"type": [
												"string",
												"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
												},
												"automation-execution": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"patient-form-draft": {
													"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",
												"automation-execution",
												"patient-form-draft"
											],
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"bodyEncoding": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"utf8",
														"base64"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"body": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"resolutionNote": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"resolutionNote": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"resolvedById": {
											"type": [
												"string",
												"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-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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/connected-apps": {
			"get": {
				"summary": "List apps connected to this practice",
				"tags": [
					"settings",
					"connected-apps"
				],
				"description": "Newest first, one page at a time: follow `nextCursor` until it is null.",
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 512
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ConnectedApp"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"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"
								}
							}
						}
					},
					"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; status=all includes every status. 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",
								"all"
							]
						}
					},
					{
						"name": "channel",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"whatsapp",
								"sms",
								"email",
								"webchat",
								"messenger",
								"instagram",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments",
								"patient_app"
							]
						}
					},
					{
						"name": "assignee",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "unread",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "hidden",
						"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": {
											"type": [
												"string",
												"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",
													"call_permission_request"
												]
											},
											"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}/ai-replies": {
			"get": {
				"summary": "Get whether the AI is replying in a conversation",
				"tags": [
					"inbox"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"state": {
											"type": "string",
											"enum": [
												"off",
												"replying",
												"stopped"
											]
										},
										"reason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"staff",
														"handoff",
														"loop_cap",
														"person_replied",
														"answered_call",
														"spoken_to"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"at": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
										"state",
										"reason",
										"at"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/ai-replies/stop": {
			"post": {
				"summary": "Stop the AI replying in a conversation",
				"tags": [
					"inbox"
				],
				"description": "Until someone presses Let AI reply. A reply already on its way is cancelled before it is 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"state": {
											"type": "string",
											"enum": [
												"off",
												"replying",
												"stopped"
											]
										},
										"reason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"staff",
														"handoff",
														"loop_cap",
														"person_replied",
														"answered_call",
														"spoken_to"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"at": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
										"state",
										"reason",
										"at"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/ai-replies/resume": {
			"post": {
				"summary": "Let the AI reply in a conversation again",
				"tags": [
					"inbox"
				],
				"description": "Clears the stop. Only calls, team messages and spoken-to outcomes after this moment stop it again. When the patient's latest message is still unanswered, the AI answers it now.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"state": {
											"type": "string",
											"enum": [
												"off",
												"replying",
												"stopped"
											]
										},
										"reason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"staff",
														"handoff",
														"loop_cap",
														"person_replied",
														"answered_call",
														"spoken_to"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"at": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
										"state",
										"reason",
										"at"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/lead": {
			"post": {
				"summary": "Create a lead from a conversation",
				"tags": [
					"inbox"
				],
				"description": "Creates a patient and a journey for the chosen treatment and links this unlinked conversation to both, in one step; the creator takes the chat when their role can hold chats. Phone and email are optional here: the conversation is the way to reach this person. Needs conversation:update, patient:create and journey:create. 402 LEAD_LIMIT_REACHED on a full free plan; 409 CONVERSATION_ALREADY_LINKED when the conversation is linked, CONTACT_PARTY_SUBJECT_CONFLICT when its contact already represents a patient — link that patient instead; and DUPLICATE_CONTACT when the email or mobile already belongs to a patient — link them 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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"firstName": {
										"type": "string",
										"minLength": 1
									},
									"lastName": {
										"type": "string"
									},
									"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-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"phoneMobile": {
										"type": [
											"string",
											"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"
											}
										]
									},
									"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"
											}
										]
									},
									"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)$"
									},
									"potentialValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"firstName",
									"treatmentId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"conversation": {
											"$ref": "#/components/schemas/ConversationListItem"
										},
										"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)$"
										}
									},
									"required": [
										"conversation",
										"patientId",
										"journeyId"
									],
									"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"
								}
							}
						}
					},
					"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}/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}/interest/dismiss": {
			"post": {
				"summary": "Take a chat off Today's Reached out",
				"tags": [
					"inbox"
				],
				"description": "conversation:update, and the conversation must be one the caller may see. Dismisses the chat's interest check as of `messageId`, the message the Reached out row named: a newer message from the patient has re-armed it and answers 409 INTEREST_MESSAGE_CHANGED (refresh and decide again), so a stale screen never hides a newer message. Idempotent for the same message. 404 when there is no check for the chat.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"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)$"
									}
								},
								"required": [
									"messageId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"dismissed": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"dismissed"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/draft": {
			"get": {
				"summary": "Get my draft for a conversation",
				"tags": [
					"inbox"
				],
				"description": "The caller's own unsent text for this conversation; nobody else's draft is ever readable. 404 DRAFT_NOT_FOUND when there is none, with `details.current` naming the version a first save must replace (`{0, 0}`, or a deleted draft's tombstone). Attachments are never kept in a draft.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"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)$"
										},
										"generation": {
											"type": "integer",
											"minimum": 1,
											"maximum": 9007199254740991
										},
										"revision": {
											"type": "integer",
											"minimum": 1,
											"maximum": 9007199254740991
										},
										"mode": {
											"type": "string",
											"enum": [
												"reply",
												"note"
											]
										},
										"body": {
											"type": "string"
										},
										"subject": {
											"type": "string"
										},
										"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"
												}
											]
										},
										"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"
												}
											]
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"conversationId",
										"generation",
										"revision",
										"mode",
										"body",
										"subject",
										"endpointId",
										"subjectPatientId",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Save my draft for a conversation",
				"tags": [
					"inbox"
				],
				"description": "Compare-and-swap on `expected` ({generation, revision}): it must name the draft's current version, `{0, 0}` when none was ever saved. A stale version answers 409 VERSION_CONFLICT with `details.current`. The body holds at most 64 KiB and the subject 2 KiB (UTF-8).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"expected": {
										"$ref": "#/components/schemas/ConversationDraftVersion"
									},
									"mode": {
										"type": "string",
										"enum": [
											"reply",
											"note"
										]
									},
									"body": {
										"type": "string",
										"maxLength": 65536,
										"description": "At most 65536 UTF-8 bytes"
									},
									"subject": {
										"type": "string",
										"maxLength": 2048,
										"description": "At most 2048 UTF-8 bytes"
									},
									"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"
											}
										]
									},
									"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"
											}
										]
									}
								},
								"required": [
									"expected",
									"mode",
									"body",
									"subject",
									"endpointId",
									"subjectPatientId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"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)$"
										},
										"generation": {
											"type": "integer",
											"minimum": 1,
											"maximum": 9007199254740991
										},
										"revision": {
											"type": "integer",
											"minimum": 1,
											"maximum": 9007199254740991
										},
										"mode": {
											"type": "string",
											"enum": [
												"reply",
												"note"
											]
										},
										"body": {
											"type": "string"
										},
										"subject": {
											"type": "string"
										},
										"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"
												}
											]
										},
										"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"
												}
											]
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"conversationId",
										"generation",
										"revision",
										"mode",
										"body",
										"subject",
										"endpointId",
										"subjectPatientId",
										"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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete my draft for a conversation",
				"tags": [
					"inbox"
				],
				"description": "Deletes the draft only at exactly this version (a send deletes the text it sent, never what was typed since): a different live version answers 409 VERSION_CONFLICT with `details.current`. No draft is a no-op. Answers the version after the 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": "generation",
						"in": "query",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "revision",
						"in": "query",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"generation": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"revision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"generation",
										"revision"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": {
											"type": [
												"string",
												"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), the Messenger/Instagram 24h and TikTok 48h reply windows (400 REPLY_WINDOW_CLOSED; a person replying from the Smileline app or mobile app may answer on Messenger/Instagram up to 7 days after the last inbound once Meta approved the Human Agent feature — API-key and OAuth sends never get that extension), 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",
											"call_permission_request"
										]
									},
									"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). A Messenger/Instagram reply a person wrote in Smileline can only be retried by a person, never an API key or OAuth connection (403 HUMAN_RETRY_REQUIRED).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/messages/{messageId}/comment": {
			"post": {
				"summary": "Hide, unhide or delete a Facebook or Instagram comment",
				"tags": [
					"inbox"
				],
				"description": "Runs the action on Meta for a comment on a facebook_comments or instagram_comments thread. A person's comment can be hidden, unhidden or deleted; the practice's own public reply can only be deleted (Meta never hides a Page's own comments), and a private reply cannot be changed (409 COMMENT_ACTION_UNAVAILABLE). A deleted comment keeps its text in Smileline, marked by `metadata.commentDeletedAt`; `metadata.commentDeleteRequestedAt` means Meta has not confirmed the delete yet (502 META_COMMENT_ACTION_UNCONFIRMED) and the delete can be sent again. A missing or expired connection answers 409 META_RECONNECT_REQUIRED, a permission Meta refuses 409 META_PERMISSION_MISSING, any other refusal 502 META_COMMENT_ACTION_FAILED.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"action": {
										"type": "string",
										"enum": [
											"hide",
											"unhide",
											"delete"
										]
									}
								},
								"required": [
									"action"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Message"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/messages/{messageId}/comment-link": {
			"get": {
				"summary": "Get a Facebook or Instagram comment's link on the platform",
				"tags": [
					"inbox"
				],
				"description": "Asks Meta where a comment on a facebook_comments or instagram_comments thread is seen: on Facebook the comment's permalink (its post, scrolled to the comment); Instagram links no single comment, so the post's. A comment Meta has no link for (deleted there, or a private reply) answers 409 COMMENT_LINK_UNAVAILABLE, a missing or expired connection 409 META_RECONNECT_REQUIRED, and no answer from Meta 502 META_COMMENT_LINK_FAILED.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
									"type": "object",
									"properties": {
										"url": {
											"type": "string",
											"format": "uri"
										}
									},
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/messages/{messageId}/reaction": {
			"post": {
				"summary": "React to a patient's WhatsApp message",
				"tags": [
					"inbox"
				],
				"description": "Sends the practice's WhatsApp reaction on a patient's message, or removes it with an empty `emoji`. WhatsApp keeps one reaction per sender per message, so a new emoji replaces the old one. The reaction is no message of its own: it shows as `metadata.whatsappReaction` on the reacted message. Only inside the 24-hour window (409 WHATSAPP_WINDOW_CLOSED); a message that isn't a patient's WhatsApp message answers 409 REACTION_UNAVAILABLE, a disconnected number 409 CONNECTION_DISCONNECTED or WHATSAPP_RECONNECT_REQUIRED, a refusal from WhatsApp 502 WHATSAPP_REACTION_FAILED.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"emoji": {
										"anyOf": [
											{
												"type": "string",
												"description": "Exactly one RGI emoji"
											},
											{
												"type": "string",
												"const": ""
											}
										]
									}
								},
								"required": [
									"emoji"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Message"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/conversations/{id}/whatsapp-lead": {
			"get": {
				"summary": "WhatsApp qualified-lead status",
				"tags": [
					"inbox"
				],
				"description": "Whether the conversation's latest click-to-WhatsApp ad referral can be reported to Meta as a qualified lead, and the report once made.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"available": {
											"type": "boolean"
										},
										"reason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"country",
														"no_ad_referral",
														"reporting_off",
														"connection_changed",
														"restricted"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"event": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/WhatsappLeadEvent"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"available",
										"reason",
										"event"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Mark a WhatsApp ad conversation as a qualified lead",
				"tags": [
					"inbox"
				],
				"description": "A person (never an API key or OAuth connection) reports the conversation's latest click-to-WhatsApp referral to Meta as one QualifiedLead, sending only the WhatsApp Business Account id and Meta's click id. Repeating the call answers the same report. Not available to US practices (403 COUNTRY_UNAVAILABLE) or when the practice has not turned reporting on for that number (409 WHATSAPP_LEAD_UNAVAILABLE).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"retry": {
										"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)$"
											},
											"expectedGeneration": {
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											"confirmResend": {
												"type": "boolean"
											}
										},
										"required": [
											"eventId",
											"expectedGeneration"
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"available": {
											"type": "boolean"
										},
										"reason": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"country",
														"no_ad_referral",
														"reporting_off",
														"connection_changed",
														"restricted"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"event": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/WhatsappLeadEvent"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"available",
										"reason",
										"event"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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 privately (no-store) after the org check. Active and unknown formats are forced to a safe download. A single `Range: bytes=` request answers 206 with Content-Range (416 past the end), so audio and video can seek.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
								}
							}
						}
					},
					"206": {
						"description": "Partial Content",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"416": {
						"description": "Range Not Satisfiable"
					}
				}
			}
		},
		"/conversations/{id}/messages/{messageId}/attachments/{index}/transcript": {
			"post": {
				"summary": "Transcribe a voice recording again",
				"tags": [
					"inbox"
				],
				"description": "Starts a new transcript of a patient's voice recording whose transcript failed or could not be read, or of one received before transcripts existed, and answers the message with the attachment's transcript pending. 409 TRANSCRIPT_PENDING while one is being made, TRANSCRIPT_DONE once it has its text, TRANSCRIPT_UNAVAILABLE for anything but a patient's stored recording whose content is still there.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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/json": {
								"schema": {
									"$ref": "#/components/schemas/Message"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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. whatsappSync=true adds the WhatsApp sync status Settings → Templates shows.",
				"parameters": [
					{
						"name": "includeArchived",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "whatsappSync",
						"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"
											}
										},
										"whatsappSync": {
											"$ref": "#/components/schemas/WhatsappTemplateSync"
										}
									},
									"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",
													"patient_app"
												]
											},
											{
												"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"
											}
										]
									},
									"whatsappCallPermission": {
										"type": "boolean"
									},
									"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/whatsapp-activity": {
			"get": {
				"summary": "WhatsApp template activity",
				"tags": [
					"templates"
				],
				"description": "What happened with the organisation's WhatsApp templates at Meta — submissions, verdicts, retries, account problems — newest first, 50 per page. Pass templateId for one template's history and the previous page's nextCursor as before for older events.",
				"parameters": [
					{
						"name": "templateId",
						"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",
							"pattern": "^\\d{1,17}_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WhatsappTemplateEvent"
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"pattern": "^\\d{1,17}_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
												},
												{
													"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"
								}
							}
						}
					}
				}
			}
		},
		"/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",
													"patient_app"
												]
											},
											{
												"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"
											}
										]
									},
									"whatsappCallPermission": {
										"type": "boolean"
									},
									"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 accounts and every version of this template in each of them, newest first. An edit goes live once every account has approved 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": {
										"account": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"wabaId": {
															"type": "string"
														},
														"address": {
															"type": [
																"string",
																"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": {
															"type": [
																"string",
																"null"
															]
														},
														"state": {
															"type": "string",
															"enum": [
																"none",
																"verifying",
																"attention",
																"ready"
															]
														}
													},
													"required": [
														"wabaId",
														"address",
														"verifiedAt",
														"lastError",
														"state"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"accounts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"wabaId": {
														"type": "string"
													},
													"address": {
														"type": [
															"string",
															"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": {
														"type": [
															"string",
															"null"
														]
													},
													"state": {
														"type": "string",
														"enum": [
															"none",
															"verifying",
															"attention",
															"ready"
														]
													}
												},
												"required": [
													"wabaId",
													"address",
													"verifiedAt",
													"lastError",
													"state"
												],
												"additionalProperties": false
											}
										},
										"refusal": {
											"type": [
												"string",
												"null"
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/WhatsappTemplateRegistration"
											}
										}
									},
									"required": [
										"account",
										"accounts",
										"refusal",
										"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": "In every account that must approve the template, re-arms a rejected, paused, disabled 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"
								}
							}
						}
					}
				}
			}
		},
		"/templates/{id}/pause": {
			"post": {
				"summary": "Pause a message template's automatic sends",
				"tags": [
					"templates"
				],
				"description": "Sets pausedAt: every sequence step, booking reminder and review request that would send this template skips it, visibly, until it is resumed. Idempotent; never available to a Smileline support 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": {
									"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}/resume": {
			"post": {
				"summary": "Resume a paused message template",
				"tags": [
					"templates"
				],
				"description": "Clears pausedAt. 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. An enabled Transfer to a human must ring one of this practice's ring groups (422 VOICE_RING_GROUP_MISSING otherwise).",
				"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
									},
									"voicemailDropEnabled": {
										"type": "boolean"
									},
									"voicemailDropMessage": {
										"type": [
											"string",
											"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"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"
									}
								},
								"required": [
									"name",
									"enabled",
									"trigger",
									"stageId",
									"conditions",
									"scope",
									"locationId",
									"aiCallbackEnabled"
								]
							}
						}
					}
				},
				"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"
									}
								}
							}
						}
					}
				},
				"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 500 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": {
														"type": [
															"string",
															"null"
														]
													},
													"url": {
														"type": [
															"string",
															"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
									},
									"analyticsVisitorId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"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 privately (no-store). The message must belong to this visitor's webchat endpoint — no other channel and no other visitor. Images, video and audio are served inline; every other type is forced to a download. A single `Range: bytes=` request answers 206 with Content-Range (416 past the end), so audio and video can seek.",
				"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"
								}
							}
						}
					},
					"206": {
						"description": "Partial Content",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"416": {
						"description": "Range Not Satisfiable"
					},
					"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
									},
									"analyticsVisitorId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"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"
								}
							}
						}
					}
				}
			}
		},
		"/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 descriptions) and practitioners. Never contains PII — the logo and practitioner photos are images the practice published from its own library. 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"
											},
											"title": {
												"type": "string",
												"enum": [
													"Mr",
													"Mrs",
													"Miss",
													"Ms",
													"Dr",
													"Master",
													"Prof",
													"Hon",
													"Rev",
													"Sir",
													"Lady",
													"Lord",
													"Earl",
													"Judge",
													"Dame"
												]
											},
											"sex": {
												"type": "string",
												"enum": [
													"male",
													"female"
												]
											},
											"addressLine1": {
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											"postalCode": {
												"type": "string",
												"minLength": 1,
												"maxLength": 20
											}
										},
										"required": [
											"firstName",
											"lastName"
										]
									},
									"note": {
										"type": "string",
										"maxLength": 1000
									},
									"pageUrl": {
										"type": "string",
										"maxLength": 2048
									},
									"referralToken": {
										"type": "string",
										"maxLength": 64
									},
									"chatHandoffToken": {
										"type": "string",
										"maxLength": 2048
									},
									"visitorId": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"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. At a practice whose diary is its practice management system, a booking that system has not taken yet answers `received` — kept, and the practice confirms it (asking again answers the same). Deposit holds finalize via the payment webhook instead — this answers 402 DEPOSIT_UNPAID until then, and 409 DEPOSIT_FINALIZATION_PENDING once the deposit is paid while the booking is still being finalized (ask again shortly). 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",
												"received"
											]
										}
									},
									"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/view": {
			"post": {
				"summary": "Open a manage link",
				"tags": [
					"booking"
				],
				"description": "Authorization: Bearer <token> (the link's fragment). Patient-safe view of one booking — its time, site, type and clinician, never the patient's name — and what a change asks first. Read-only. An unknown, replaced or expired link answers 404. Rate limited.",
				"security": [],
				"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/verify": {
			"post": {
				"summary": "Check the date of birth on a manage link",
				"tags": [
					"booking"
				],
				"description": "Authorization: Bearer <token>. The right date of birth answers a proof that lets the page cancel or move the booking for 30 minutes. A wrong one answers 403 DATE_OF_BIRTH_MISMATCH with the checks left; the fifth locks the link (403 MANAGE_LINK_LOCKED) until the next reminder or a message from the practice brings a new one. With no date of birth on file it answers 409 DATE_OF_BIRTH_NOT_ON_FILE: the patient calls the practice. Rate limited.",
				"security": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"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])))$"
									}
								},
								"required": [
									"dateOfBirth"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"proof": {
											"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": [
										"proof",
										"expiresAt"
									],
									"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/cancel": {
			"post": {
				"summary": "Cancel a booking",
				"tags": [
					"booking"
				],
				"description": "Authorization: Bearer <token>.<proof>. Patient-initiated cancellation via the manage link, allowed until the appointment type's notice cutoff. Without a live proof it answers 401 PROOF_REQUIRED. Paid booking deposits follow the practice's refund policy.",
				"security": [],
				"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
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/reschedule": {
			"post": {
				"summary": "Reschedule a booking",
				"tags": [
					"booking"
				],
				"description": "Authorization: Bearer <token>.<proof>. Cancels the old appointment and books the new slot in one step (the paid deposit carries over), and answers the new appointment's manage-link token. Without a live proof it answers 401 PROOF_REQUIRED. A taken slot answers 409 SLOT_TAKEN.",
				"security": [],
				"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": {
										"manageToken": {
											"type": [
												"string",
												"null"
											]
										},
										"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": [
										"manageToken",
										"startsAt",
										"endsAt",
										"status"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/manage/{uid}/link": {
			"post": {
				"summary": "Open an older manage link",
				"tags": [
					"booking"
				],
				"description": "An older `?uid=` manage link, sent before the hashed manage link: it answers that booking's manage-link token, only until the appointment starts — after that the uid answers 404. A link locked by wrong dates of birth answers 403 MANAGE_LINK_LOCKED. Rate limited.",
				"security": [],
				"parameters": [
					{
						"name": "uid",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 8,
							"maxLength": 64
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"token": {
											"type": "string"
										}
									},
									"required": [
										"token"
									],
									"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"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/booking/{key}/checkout-outcome": {
			"get": {
				"summary": "A deposit checkout's outcome",
				"tags": [
					"booking"
				],
				"description": "Where Stripe Checkout returns after an online booking's deposit: whether the booking is confirmed, awaiting confirmation, paid and waiting for the practice's system (`received`), still awaiting the payment, or released, and when — by the Checkout Session id in the return URL. Nothing it answers can change a booking. Rate limited; an unknown Session answers 404.",
				"security": [],
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "session_id",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 255
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/BookingCheckoutOutcome"
								}
							}
						}
					},
					"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/recall/view": {
			"post": {
				"summary": "Open a one-tap recall booking link",
				"tags": [
					"booking"
				],
				"description": "Authorization: Bearer <token> (the link's fragment). The patient is recognised by the link and never named: the page learns the practice, the recalls due and what the link books — the recall's appointment type, its site and its clinician — or why it cannot (the link's own visit, another visit coming up, nothing due, or call the practice). Read-only. An unknown, closed or expired link, or one whose patient is no longer on the books, answers 404. Rate limited.",
				"security": [],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"state": {
											"type": "string",
											"enum": [
												"ready",
												"booked",
												"visit_booked",
												"nothing_due",
												"call_us"
											]
										},
										"practice": {
											"type": "object",
											"properties": {
												"name": {
													"type": "string"
												},
												"phone": {
													"type": [
														"string",
														"null"
													]
												},
												"brandColor": {
													"type": [
														"string",
														"null"
													]
												}
											},
											"required": [
												"name",
												"phone",
												"brandColor"
											],
											"additionalProperties": false
										},
										"dueTypes": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"booking": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"bookingKey": {
															"type": "string"
														},
														"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)$"
																},
																"name": {
																	"type": "string"
																},
																"durationMin": {
																	"type": "integer",
																	"minimum": -9007199254740991,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"id",
																"name",
																"durationMin"
															],
															"additionalProperties": false
														},
														"location": {
															"$ref": "#/components/schemas/BookingLocation"
														},
														"practitioner": {
															"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)$"
																		},
																		"displayName": {
																			"type": "string"
																		}
																	},
																	"required": [
																		"id",
																		"displayName"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"bookingKey",
														"appointmentType",
														"location",
														"practitioner"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"visit": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/RecallBookingVisit"
												},
												{
													"type": "null"
												}
											]
										},
										"visitOn": {
											"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": [
										"state",
										"practice",
										"dueTypes",
										"booking",
										"visit",
										"visitOn"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/booking/recall/book": {
			"post": {
				"summary": "Book a recall visit from its one-tap link",
				"tags": [
					"booking"
				],
				"description": "Authorization: Bearer <token>. Books the slot for the link's patient and recall, with exactly what the link offers (the appointment type, site and, when the recall names one, clinician from the view). An exact eventId retry answers the booking it made; the same eventId with other details answers 409 IDEMPOTENCY_KEY_REUSED. A taken slot answers 409 SLOT_TAKEN; a link that can no longer book (its own visit is booked, another visit is coming up, the recall moved on, or online booking stopped) answers 409 RECALL_ALREADY_BOOKED or RECALL_NOT_BOOKABLE — read the view again. Rate limited.",
				"security": [],
				"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))$"
									}
								},
								"required": [
									"eventId",
									"appointmentTypeId",
									"locationId",
									"practitionerId",
									"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))$"
										},
										"timezone": {
											"type": "string"
										}
									},
									"required": [
										"uid",
										"startsAt",
										"timezone"
									],
									"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"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"
											}
										},
										"chatAssignment": {
											"type": "object",
											"properties": {
												"rules": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"channel": {
																"anyOf": [
																	{
																		"type": "string",
																		"enum": [
																			"whatsapp",
																			"sms",
																			"email",
																			"webchat",
																			"messenger",
																			"instagram",
																			"telegram",
																			"tiktok",
																			"facebook_comments",
																			"instagram_comments",
																			"patient_app"
																		]
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"assigneeId": {
																"type": "string",
																"minLength": 1
															}
														},
														"required": [
															"channel",
															"assigneeId"
														],
														"additionalProperties": false
													}
												},
												"members": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"userId": {
																"type": "string",
																"minLength": 1
															},
															"name": {
																"type": "string"
															},
															"canTakeChats": {
																"type": "boolean"
															}
														},
														"required": [
															"userId",
															"name",
															"canTakeChats"
														],
														"additionalProperties": false
													}
												}
											},
											"required": [
												"rules",
												"members"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"items",
										"domains",
										"chatAssignment"
									],
									"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",
											"patient_app"
										]
									},
									"provider": {
										"type": "string",
										"enum": [
											"whatsapp_cloud",
											"twilio",
											"telnyx",
											"resend",
											"webchat",
											"meta_messaging",
											"telegram",
											"tiktok_messaging",
											"meta_comments",
											"gmail",
											"outlook",
											"patient_app"
										]
									}
								},
								"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": {
													"type": [
														"string",
														"null"
													]
												},
												"configId": {
													"type": [
														"string",
														"null"
													]
												},
												"callingSolutionId": {
													"type": [
														"string",
														"null"
													]
												}
											},
											"required": [
												"available",
												"appId",
												"configId",
												"callingSolutionId"
											],
											"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"
											]
										},
										"verificationApproved": {
											"type": "boolean"
										},
										"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": {
														"type": [
															"string",
															"null"
														]
													},
													"status": {
														"type": "string"
													},
													"purpose": {
														"type": "string"
													},
													"country": {
														"type": [
															"string",
															"null"
														]
													},
													"numberType": {
														"type": [
															"string",
															"null"
														]
													},
													"eligible": {
														"type": "boolean"
													},
													"reason": {
														"type": [
															"string",
															"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": {
														"type": [
															"string",
															"null"
														]
													},
													"setupMessage": {
														"type": [
															"string",
															"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": {
														"type": [
															"string",
															"null"
														]
													},
													"campaignStatus": {
														"type": [
															"string",
															"null"
														]
													},
													"feedback": {
														"type": [
															"string",
															"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": {
														"type": [
															"boolean",
															"null"
														]
													},
													"campaignRenewalDate": {
														"type": [
															"string",
															"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-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",
										"verificationApproved",
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"campaignStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"feedback": {
											"type": [
												"string",
												"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": {
											"type": [
												"boolean",
												"null"
											]
										},
										"campaignRenewalDate": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"campaignStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"feedback": {
											"type": [
												"string",
												"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": {
											"type": [
												"boolean",
												"null"
											]
										},
										"campaignRenewalDate": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"campaignStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"feedback": {
											"type": [
												"string",
												"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": {
											"type": [
												"boolean",
												"null"
											]
										},
										"campaignRenewalDate": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"campaignStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"feedback": {
											"type": [
												"string",
												"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": {
											"type": [
												"boolean",
												"null"
											]
										},
										"campaignRenewalDate": {
											"type": [
												"string",
												"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}/documents/{requirementId}": {
			"get": {
				"summary": "Download a document on the UK carrier review",
				"tags": [
					"Channel connections"
				],
				"description": "Streams the file behind one document row of this registration's review. The document is found from that review, never from a caller-supplied provider 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": "requirementId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 128
						}
					}
				],
				"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"
								}
							}
						}
					},
					"502": {
						"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": {
			"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": {
											"type": [
												"string",
												"null"
											]
										},
										"campaignStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"feedback": {
											"type": [
												"string",
												"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": {
											"type": [
												"boolean",
												"null"
											]
										},
										"campaignRenewalDate": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"campaignStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"feedback": {
											"type": [
												"string",
												"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": {
											"type": [
												"boolean",
												"null"
											]
										},
										"campaignRenewalDate": {
											"type": [
												"string",
												"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/registrations/from-verification": {
			"post": {
				"summary": "File the UK mobile registration from the approved UK verification",
				"tags": [
					"Channel connections"
				],
				"description": "A verified UK practice skips the mobile form: the evidence approved for UK calling verification is filed as the GB mobile registration and submitted to the carrier. Idempotent — an existing mobile registration is returned. 409 SMS_VERIFICATION_REQUIRED when the practice is not verified or the approval does not cover every mobile requirement.",
				"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": {
											"type": [
												"string",
												"null"
											]
										},
										"campaignStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"feedback": {
											"type": [
												"string",
												"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": {
											"type": [
												"boolean",
												"null"
											]
										},
										"campaignRenewalDate": {
											"type": [
												"string",
												"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"
								}
							}
						}
					},
					"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": {
											"type": [
												"string",
												"null"
											]
										},
										"status": {
											"type": "string"
										},
										"purpose": {
											"type": "string"
										},
										"country": {
											"type": [
												"string",
												"null"
											]
										},
										"numberType": {
											"type": [
												"string",
												"null"
											]
										},
										"eligible": {
											"type": "boolean"
										},
										"reason": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"setupMessage": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"status": {
											"type": "string"
										},
										"purpose": {
											"type": "string"
										},
										"country": {
											"type": [
												"string",
												"null"
											]
										},
										"numberType": {
											"type": [
												"string",
												"null"
											]
										},
										"eligible": {
											"type": "boolean"
										},
										"reason": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"setupMessage": {
											"type": [
												"string",
												"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": {
														"type": [
															"string",
															"null"
														]
													},
													"phoneNumberType": {
														"type": [
															"string",
															"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. The callback stores the grant awaiting the user's pick (metaStatus=choose); nothing is connected until they pick Pages.",
				"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/meta/page-choices": {
			"get": {
				"summary": "List the Facebook Pages a Messenger/Instagram connect can pick",
				"tags": [
					"settings"
				],
				"description": "One page of the session user's own grant awaiting a pick. 404 when nothing awaits.",
				"parameters": [
					{
						"name": "after",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2048
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"continuationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 1,
											"maximum": 9007199254740991
										},
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"name": {
														"type": [
															"string",
															"null"
														]
													},
													"instagramUsername": {
														"type": [
															"string",
															"null"
														]
													},
													"connectedHere": {
														"type": "boolean"
													},
													"ownedElsewhere": {
														"type": "boolean"
													},
													"manageable": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name",
													"instagramUsername",
													"connectedHere",
													"ownedElsewhere",
													"manageable"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"continuationId",
										"generation",
										"items",
										"nextCursor"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/meta/page-selection": {
			"post": {
				"summary": "Connect the picked Facebook Pages",
				"tags": [
					"settings"
				],
				"description": "Records the pick once (fenced on the grant's id and generation) and connects the picked Pages; `pending` = accepted, the rest is finished in the background.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"continuationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 1,
										"maximum": 9007199254740991
									},
									"pageIds": {
										"minItems": 1,
										"maxItems": 1000,
										"type": "array",
										"items": {
											"type": "string",
											"pattern": "^\\d{1,32}$"
										}
									}
								},
								"required": [
									"continuationId",
									"generation",
									"pageIds"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"connected",
												"partial",
												"pending",
												"error"
											]
										}
									},
									"required": [
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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 single-use code and saves the grant as a pending connection at once, then validates it, works out the account and number (posted hints only once the grant confirms them), and walks the onboarding (subscribe, verify, register, activate). Re-posting cannot resume — the code works once; after a failure the error names the saved connection (`details.connectionId`) and Continue setup (`POST /settings/channels/:id/whatsapp/resume`) resumes from its saved grant.",
				"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"
									},
									"calling": {
										"default": false,
										"type": "boolean"
									},
									"upgradeConnectionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"pin": {
										"type": "string",
										"pattern": "^\\d{6}$"
									}
								},
								"required": [
									"code"
								],
								"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/{id}/whatsapp/calling": {
			"post": {
				"summary": "Set up, retry or turn off WhatsApp calls",
				"tags": [
					"settings"
				],
				"description": "WhatsApp calls through Telnyx on one WhatsApp number. The connection's `externalMeta.calling` is pending, enabled, failed, needs_review or off, with `externalMeta.callingError` saying why. GB and US practices only (403 COUNTRY_UNAVAILABLE); 409 WHATSAPP_CALLS_NOT_SET_UP on a messages-only number, WHATSAPP_CALLS_BUSY while another setup run holds it; 502 WHATSAPP_CALLS_OFF_FAILED when Telnyx kept calling on.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"action": {
										"type": "string",
										"enum": [
											"check",
											"retry",
											"off",
											"on"
										]
									}
								},
								"required": [
									"action"
								],
								"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"
										]
									},
									"inboxLeadsOnly": {
										"type": "boolean"
									}
								}
							}
						}
					}
				},
				"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}/lead-reporting": {
			"get": {
				"summary": "WhatsApp qualified-lead reporting",
				"tags": [
					"settings"
				],
				"description": "Whether this WhatsApp number reports qualified leads from click-to-WhatsApp ads to Meta.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"enabled": {
											"type": "boolean"
										},
										"restricted": {
											"type": "boolean"
										}
									},
									"required": [
										"enabled",
										"restricted"
									],
									"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"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Turn WhatsApp qualified-lead reporting on or off",
				"tags": [
					"settings"
				],
				"description": "A person turns reporting on for one WhatsApp number, confirming the practice's lawful basis; Smileline checks the connection's Meta grant and sets up the account's dataset. Turning it off always wins. Not available to US practices.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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"
									}
								},
								"required": [
									"enabled"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"enabled": {
											"type": "boolean"
										},
										"restricted": {
											"type": "boolean"
										}
									},
									"required": [
										"enabled",
										"restricted"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/channels/{id}/marketing-upgrade": {
			"get": {
				"summary": "WhatsApp Marketing Messages API upgrade",
				"tags": [
					"settings"
				],
				"description": "Whether this WhatsApp number's account accepted Meta's Marketing Messages API terms, read live from Meta. Meta stops marketing templates on the Cloud API on 13 October 2027; until a number upgrades, Meta sends its marketing templates through the Cloud API.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": [
												"upgraded",
												"not_upgraded",
												"needs_payment_method",
												"setting_up",
												"business_app",
												"unavailable"
											]
										},
										"metaStatus": {
											"type": [
												"string",
												"null"
											]
										},
										"wabaId": {
											"type": "string"
										},
										"warnings": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"description": {
														"type": "string"
													},
													"solution": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"description",
													"solution"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"status",
										"metaStatus",
										"wabaId",
										"warnings"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": {
											"type": [
												"string",
												"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/chat-assignment": {
			"get": {
				"summary": "Who gets new chats",
				"tags": [
					"settings"
				],
				"description": "The practice's per-channel rules; channel null is \"Everything else\". A new message keeps its chat with the current assignee, then the owner of the patient's newest open journey, then the rule for its channel, then \"Everything else\", then the practice owner — whoever first can hold chats.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rules": {
											"maxItems": 12,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"channel": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"whatsapp",
																	"sms",
																	"email",
																	"webchat",
																	"messenger",
																	"instagram",
																	"telegram",
																	"tiktok",
																	"facebook_comments",
																	"instagram_comments",
																	"patient_app"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assigneeId": {
														"type": "string",
														"minLength": 1
													}
												},
												"required": [
													"channel",
													"assigneeId"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"rules"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Set who gets new chats",
				"tags": [
					"settings"
				],
				"description": "Replaces the practice's rules (an empty list clears them). Every assignee must be a live owner, manager, front desk or telesales member (400 INVALID_ASSIGNEE). Needs settings:update.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"rules": {
										"maxItems": 12,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"channel": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"whatsapp",
																"sms",
																"email",
																"webchat",
																"messenger",
																"instagram",
																"telegram",
																"tiktok",
																"facebook_comments",
																"instagram_comments",
																"patient_app"
															]
														},
														{
															"type": "null"
														}
													]
												},
												"assigneeId": {
													"type": "string",
													"minLength": 1
												}
											},
											"required": [
												"channel",
												"assigneeId"
											]
										}
									}
								},
								"required": [
									"rules"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rules": {
											"maxItems": 12,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"channel": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"whatsapp",
																	"sms",
																	"email",
																	"webchat",
																	"messenger",
																	"instagram",
																	"telegram",
																	"tiktok",
																	"facebook_comments",
																	"instagram_comments",
																	"patient_app"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"assigneeId": {
														"type": "string",
														"minLength": 1
													}
												},
												"required": [
													"channel",
													"assigneeId"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"rules"
									],
									"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/lead-assignment": {
			"get": {
				"summary": "Who gets new leads",
				"tags": [
					"settings"
				],
				"description": "The practice's lead assignment rules. A new lead with no owner given goes to the people of the first rule that matches it — its location, then its treatment, then its first-touch channel, then \"Everything else\" (all three null) — who take turns. With no matching rule it stays unowned until someone records its first outcome. A lead added by a person in the app is theirs, and a lead-ad form's owner is kept.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rules": {
											"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"
															}
														]
													},
													"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"
															}
														]
													},
													"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"
															}
														]
													},
													"userIds": {
														"maxItems": 1000,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1
														}
													}
												},
												"required": [
													"locationId",
													"treatmentId",
													"channel",
													"userIds"
												],
												"additionalProperties": false
											}
										},
										"members": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"userId": {
														"type": "string",
														"minLength": 1
													},
													"name": {
														"type": "string"
													},
													"canOwnLeads": {
														"type": "boolean"
													}
												},
												"required": [
													"userId",
													"name",
													"canOwnLeads"
												],
												"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)$"
													},
													"name": {
														"type": "string"
													},
													"archived": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name",
													"archived"
												],
												"additionalProperties": false
											}
										},
										"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"
													},
													"archived": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name",
													"archived"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"rules",
										"members",
										"locations",
										"treatments"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Set who gets new leads",
				"tags": [
					"settings"
				],
				"description": "Replaces the practice's rules (an empty list clears them); people who stay in a rule keep their place in its turns. A newly added person must be a live owner, manager, front desk or telesales member (400 INVALID_ASSIGNEE), and a newly named location or treatment must be active (400); a rule already saved is kept as it is. Needs settings:update.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"rules": {
										"maxItems": 1000,
										"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"
														}
													]
												},
												"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"
														}
													]
												},
												"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"
														}
													]
												},
												"userIds": {
													"maxItems": 1000,
													"type": "array",
													"items": {
														"type": "string",
														"minLength": 1
													}
												}
											},
											"required": [
												"locationId",
												"treatmentId",
												"channel",
												"userIds"
											]
										}
									}
								},
								"required": [
									"rules"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rules": {
											"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"
															}
														]
													},
													"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"
															}
														]
													},
													"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"
															}
														]
													},
													"userIds": {
														"maxItems": 1000,
														"type": "array",
														"items": {
															"type": "string",
															"minLength": 1
														}
													}
												},
												"required": [
													"locationId",
													"treatmentId",
													"channel",
													"userIds"
												],
												"additionalProperties": false
											}
										},
										"members": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"userId": {
														"type": "string",
														"minLength": 1
													},
													"name": {
														"type": "string"
													},
													"canOwnLeads": {
														"type": "boolean"
													}
												},
												"required": [
													"userId",
													"name",
													"canOwnLeads"
												],
												"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)$"
													},
													"name": {
														"type": "string"
													},
													"archived": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name",
													"archived"
												],
												"additionalProperties": false
											}
										},
										"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"
													},
													"archived": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name",
													"archived"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"rules",
										"members",
										"locations",
										"treatments"
									],
									"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/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, social, PMS, dialer and intraoral scanner 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",
															"linkedin",
															"microsoft",
															"other"
														]
													},
													"provider": {
														"type": "string"
													},
													"feature": {
														"type": "string"
													},
													"label": {
														"type": "string"
													},
													"account": {
														"type": [
															"string",
															"null"
														]
													},
													"health": {
														"type": "string",
														"enum": [
															"connected",
															"connecting",
															"expiring",
															"attention",
															"coming_soon",
															"disconnected"
														]
													},
													"detail": {
														"type": [
															"string",
															"null"
														]
													},
													"lastCheckedAt": {
														"type": [
															"string",
															"null"
														]
													},
													"expiresAt": {
														"type": [
															"string",
															"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": {
											"type": [
												"string",
												"null"
											]
										},
										"approvedByUserId": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"approvedByUserId": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"approvedByUserId": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"approvedByUserId": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"approvedByUserId": {
											"type": [
												"string",
												"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 (personal access token), Dentally NexGen, CareStack and Open Dental activate through the credentials endpoint; every other connectable provider records an integration request. 409 PMS_EXPORT_IMPORTED for Dentally or Dentally NexGen once a Switch from Dentally import has written the practice's records.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"enum": [
											"dentally",
											"dentally_nexgen",
											"aerona",
											"exact",
											"carestream_r4",
											"systems_for_dentists",
											"pearl",
											"dentrix",
											"eaglesoft",
											"open_dental",
											"denticon",
											"sensei",
											"curve_dental",
											"carestack",
											"tab32",
											"archy",
											"oryx",
											"other"
										]
									},
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 80
									}
								},
								"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}/sync": {
			"post": {
				"summary": "Sync a PMS connection now",
				"tags": [
					"settings"
				],
				"description": "Starts the connection's next sync now instead of at its next scheduled time, paced by the same provider allowance. A sync already under way carries on.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"sync": {
											"type": "string",
											"enum": [
												"started",
												"queued",
												"running"
											]
										}
									},
									"required": [
										"sync"
									],
									"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/{id}/credentials": {
			"post": {
				"summary": "Activate a PMS connection with its credentials",
				"tags": [
					"settings"
				],
				"description": "Providers that take practice-supplied keys: CareStack (the practice's CareStack address on the US or UK domain and its account key, plus either the account id for the documented header sign-in or the practice's own vendor key, client id and client secret for the UK token sign-in), Open Dental (customer key, optional eConnector workstation), Dentally (a personal access token; refused with 422 PMS_CONNECTION_SCOPES_MISSING when it lacks a required permission) and Dentally NexGen (client id, client secret and practice id; 422 PMS_CONNECTION_PRACTICE_REFUSED when the credentials cannot reach that practice). 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 and Dentally also register their live-update webhooks. CareStack and Dentally 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. A new Dentally or Dentally NexGen activation is refused with 409 PMS_EXPORT_IMPORTED once a Switch from Dentally import has written the practice's records; replacing the token of a running Dentally connection is 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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"oneOf": [
									{
										"type": "object",
										"properties": {
											"provider": {
												"type": "string",
												"const": "carestack"
											},
											"address": {
												"type": "string",
												"minLength": 1
											},
											"accountKey": {
												"type": "string",
												"minLength": 1
											},
											"accountId": {
												"type": "string",
												"minLength": 1
											},
											"vendorKey": {
												"type": "string",
												"minLength": 1
											},
											"clientId": {
												"type": "string",
												"minLength": 1
											},
											"clientSecret": {
												"type": "string",
												"minLength": 1
											},
											"expectedCredentialGeneration": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"provider",
											"address",
											"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"
										]
									},
									{
										"type": "object",
										"properties": {
											"provider": {
												"type": "string",
												"const": "dentally"
											},
											"accessToken": {
												"type": "string",
												"minLength": 1
											},
											"expectedCredentialGeneration": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"provider",
											"accessToken"
										]
									},
									{
										"type": "object",
										"properties": {
											"provider": {
												"type": "string",
												"const": "dentally_nexgen"
											},
											"clientId": {
												"type": "string",
												"minLength": 1
											},
											"clientSecret": {
												"type": "string",
												"minLength": 1
											},
											"practiceId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"expectedCredentialGeneration": {
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"provider",
											"clientId",
											"clientSecret",
											"practiceId"
										]
									}
								]
							}
						}
					}
				},
				"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": {
											"type": [
												"string",
												"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/connections/{id}/booking-issues": {
			"get": {
				"summary": "List bookings needing attention",
				"tags": [
					"settings"
				],
				"description": "Bookings and moves Smileline parked for a person on this connection (newest first), then the confirmations and cancellations it couldn't send, each with its visit, patient, a plain reason code and the actions safe now. `patientId` lists that patient's only (Today and the patient page fix a parked booking there: save the patient's missing details with PATCH /patients/:id, then retry — the resend reads the record afresh). Cursor-paginated; a patient under erasure is never listed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
							"default": 50,
							"type": "integer",
							"minimum": 1,
							"maximum": 50
						}
					},
					{
						"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/PmsBookingIssue"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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}/booking-issues/{issueId}/resolve": {
			"post": {
				"summary": "Resolve a booking needing attention",
				"tags": [
					"settings"
				],
				"description": "A booking: retry, keep_local (complete it in Smileline only; never sent) or cancel — the last two only while the PMS cannot hold it (409 PMS_MAY_ALREADY_HAVE_IT). A move: retry (only while the visit still stands where the move found it and no newer move is live), dismiss (the visit stays as it is) or cancel (the booking is cancelled the normal way and the PMS cancel queued). A change not sent: retry or dismiss. `expectedGeneration` is the row's as listed; a row that changed since 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)$"
						}
					},
					{
						"name": "issueId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": [
											"operation",
											"write",
											"note"
										]
									},
									"action": {
										"type": "string",
										"enum": [
											"retry",
											"keep_local",
											"cancel",
											"dismiss"
										]
									},
									"expectedGeneration": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"chartSex": {
										"type": "string",
										"enum": [
											"male",
											"female"
										]
									}
								},
								"required": [
									"kind",
									"action",
									"expectedGeneration"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"kind": {
											"type": "string",
											"enum": [
												"operation",
												"write",
												"note"
											]
										},
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
										},
										"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)$"
										}
									},
									"required": [
										"kind",
										"id",
										"status",
										"appointmentId"
									],
									"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/pms/connections/{id}/nexgen-reasons": {
			"get": {
				"summary": "List a Dentally NexGen practice's booking and cancellation reasons",
				"tags": [
					"settings"
				],
				"description": "Read live from Dentally: every active appointment reason (what Smileline books as) and every active cancellation reason of type cancelled (what it cancels as), with the connection's current choices. Dentally NexGen connections only (409 PMS_PROVIDER_MISMATCH otherwise).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"appointmentReasons": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										},
										"cancellationReasons": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"name": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"name"
												],
												"additionalProperties": false
											}
										},
										"bookingReasonId": {
											"type": [
												"string",
												"null"
											]
										},
										"cancellationReasonId": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"appointmentReasons",
										"cancellationReasons",
										"bookingReasonId",
										"cancellationReasonId"
									],
									"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"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Choose a Dentally NexGen practice's booking and cancellation reasons",
				"tags": [
					"settings"
				],
				"description": "Each id is checked against a fresh read of the practice's active reasons (422 PMS_REASON_UNKNOWN otherwise). Saved only if the connection is still the one that read came from (409 VERSION_CONFLICT after a reconnect or rotation); choosing the booking reason restarts bookings parked waiting for 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": {
									"bookingReasonId": {
										"type": "string",
										"minLength": 1
									},
									"cancellationReasonId": {
										"type": "string",
										"minLength": 1
									}
								}
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"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. The note opens with the patient's deposit block when there is one; a note that does not fit beside it answers 422 NOTE_TOO_LONG with details.overflowChars and books nothing, and a booking with no note gets the practice's booking-note template. A treatmentPlanVisitId is claimed with the pending appointment: a visit already booked or not ready answers 409 VISIT_ALREADY_BOOKED and books nothing.",
				"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"
											}
										]
									},
									"chartSex": {
										"type": "string",
										"enum": [
											"male",
											"female"
										]
									},
									"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)$"
									},
									"treatmentPlanVisitId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": [
									"eventId",
									"practitionerId",
									"startsAt",
									"endsAt"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsAppointmentOperation"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/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 flow (with steps, archived and retired included) plus the booking and recall message cards, when the practice moved to one selector per moment and to flows, and the missed-call text.",
				"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"
											}
										},
										"automationTimelineAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"flowsSwitchedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"missedCalls": {
											"type": "object",
											"properties": {
												"enabled": {
													"type": "boolean"
												},
												"openTemplateId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"closedTemplateId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"type": "null"
														}
													]
												},
												"available": {
													"type": "boolean"
												}
											},
											"required": [
												"enabled",
												"openTemplateId",
												"closedTemplateId",
												"available"
											],
											"additionalProperties": false
										},
										"bookingPageEnabled": {
											"type": "boolean"
										},
										"messageGaps": {
											"type": "object",
											"propertyNames": {
												"type": "string"
											},
											"additionalProperties": {
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"location.phone",
														"location.email",
														"location.address",
														"location.openingHours",
														"practice.website"
													]
												}
											}
										},
										"channelFaults": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"channel": {
														"type": "string",
														"enum": [
															"email",
															"sms",
															"whatsapp"
														]
													},
													"reason": {
														"type": "string"
													}
												},
												"required": [
													"channel",
													"reason"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"sequences",
										"reminderRules",
										"automationTimelineAt",
										"flowsSwitchedAt",
										"missedCalls",
										"bookingPageEnabled",
										"messageGaps",
										"channelFaults"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/sequences": {
			"post": {
				"summary": "Create a sequence",
				"tags": [
					"automations"
				],
				"description": "Optionally with its steps (as PUT …/steps takes them, without ids) and enabled, so one call makes the whole flow; without steps it starts empty. treatmentIds empty (or omitted) makes the fallback/default flow for its trigger×stage. journey_quiet takes quietDays (1–365) and quietLostReasonIds, the practice's own closed reasons that do not mark a lead junk (400 UNKNOWN_LOST_REASON). A move_stage step hands the lead over, so it must be the last step (400 MOVE_STAGE_NOT_LAST). A flow always stops on a reply, an answer and a stage change. 400 SEQUENCE_CONFLICT when another enabled flow already owns the trigger for one of the treatments. Once the practice has moved to one selector per moment (automationTimelineAt), journey_created, no-answer attempt 1 and stage_entered on a won stage are refused with 400 TRIGGER_RETIRED: New, First try and journey_won run those moments. Once it is on flows (flowsSwitchedAt), only the flow triggers are taken (isFlowSelector): stage_entered on a board's New or Contact attempted stage, ad_lead_created, call_outcome no_answer after the first try (an attempt, or any later one), journey_unreached and journey_quiet; every other selector is 400 TRIGGER_RETIRED. A move_stage step can only move leads on to a later stage of the board — a stage at the same position or earlier than the sequence's own is refused (400 MOVE_STAGE_BACKWARD).",
				"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",
											"call_outcome",
											"ad_lead_created",
											"journey_unreached",
											"journey_quiet"
										]
									},
									"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"
											}
										]
									},
									"callOutcome": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"no_answer",
													"considering",
													"callback_later"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"callAttempt": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 10
											},
											{
												"type": "null"
											}
										]
									},
									"quietDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 365
											},
											{
												"type": "null"
											}
										]
									},
									"quietLostReasonIds": {
										"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": {
										"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)$"
										}
									},
									"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"
																		}
																	]
																},
																"marketing": {
																	"type": "boolean"
																}
															},
															"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"
													]
												}
											]
										}
									},
									"enabled": {
										"type": "boolean"
									}
								},
								"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/quiet rule/treatments/enabled, checked on the merged row. Disabling freezes active enrollments in place (nothing sends, nobody is ejected); re-enabling resumes them. Edits apply to journeys currently mid-sequence. journey_quiet takes quietDays (1–365) and quietLostReasonIds, the practice's own closed reasons that do not mark a lead junk (400 UNKNOWN_LOST_REASON). A move_stage step hands the lead over, so it must be the last step (400 MOVE_STAGE_NOT_LAST). A flow always stops on a reply, an answer and a stage change. 400 SEQUENCE_CONFLICT when another enabled flow already owns the trigger for one of the treatments. Once the practice has moved to one selector per moment (automationTimelineAt), journey_created, no-answer attempt 1 and stage_entered on a won stage are refused with 400 TRIGGER_RETIRED: New, First try and journey_won run those moments. Once it is on flows (flowsSwitchedAt), only the flow triggers are taken (isFlowSelector): stage_entered on a board's New or Contact attempted stage, ad_lead_created, call_outcome no_answer after the first try (an attempt, or any later one), journey_unreached and journey_quiet; every other selector is 400 TRIGGER_RETIRED. A retired sequence (retiredAt) can still be edited but never starts anyone again.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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",
											"call_outcome",
											"ad_lead_created",
											"journey_unreached",
											"journey_quiet"
										]
									},
									"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"
											}
										]
									},
									"callOutcome": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"no_answer",
													"considering",
													"callback_later"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"callAttempt": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 10
											},
											{
												"type": "null"
											}
										]
									},
									"quietDays": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 365
											},
											{
												"type": "null"
											}
										]
									},
									"quietLostReasonIds": {
										"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": {
										"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)$"
										}
									},
									"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). A move_stage step hands the lead over, so it must be the last step (400 MOVE_STAGE_NOT_LAST). Automated stage moves only go forward: a move_stage step to a stage at the same position or earlier than the sequence's own is refused (400 MOVE_STAGE_BACKWARD), and one that would not move a lead on to a later stage when it runs is skipped and recorded.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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"
																		}
																	]
																},
																"marketing": {
																	"type": "boolean"
																}
															},
															"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. Once the practice has moved to one selector per moment (automationTimelineAt), journey_created, no-answer attempt 1 and stage_entered on a won stage are refused with 400 TRIGGER_RETIRED: New, First try and journey_won run those moments. Once it is on flows (flowsSwitchedAt), only the flow triggers are taken (isFlowSelector): stage_entered on a board's New or Contact attempted stage, ad_lead_created, call_outcome no_answer after the first try (an attempt, or any later one), journey_unreached and journey_quiet; every other selector is 400 TRIGGER_RETIRED. A retired sequence is restored without starting anyone.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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/defaults": {
			"post": {
				"summary": "Use the default flows",
				"tags": [
					"automations"
				],
				"description": "Installs Smileline's five default flows (New enquiry, New enquiry – Emergency where the practice has the emergency treatment, Couldn't reach them, After the last try and Long-term nurture) on the chosen channels. Flows only: booking messages, recalls and missed-call texts are never touched. A live flow on a moment a default takes is archived and its runs stopped; one identical to the default (moment, treatments, quiet rule and every step) is kept, so a second press with the same channels changes nothing; one that differs only in its templates takes the default's templates in place and its runs carry on (a WhatsApp step keeps an approved template until the default's is approved too). Templates are reused by name and channel, never changed or deleted; new WhatsApp templates are submitted to WhatsApp. Needs sequence:create, sequence:update and sequence:delete. 409 TIMELINE_REQUIRED before the practice is on the automations timeline; 400 BOARD_ARCHIVED.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"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)$"
									},
									"channels": {
										"minItems": 1,
										"maxItems": 3,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"email",
												"sms",
												"whatsapp"
											]
										}
									}
								},
								"required": [
									"pipelineId",
									"channels"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"created": {
											"type": "object",
											"properties": {
												"sequences": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"templates": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"sequences",
												"templates"
											],
											"additionalProperties": false
										},
										"archived": {
											"type": "object",
											"properties": {
												"sequences": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"sequences"
											],
											"additionalProperties": false
										},
										"skippedStages": {
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"created",
										"archived",
										"skippedStages"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/automations/flow-templates": {
			"get": {
				"summary": "List the Create flow gallery",
				"tags": [
					"automations"
				],
				"description": "The flows a practice can start from, in its language: the five defaults, Couldn't reach them – later try, Ad lead fast response (GB practices only) and a blank flow, each with what starts it and a preview of what it sends.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"templates": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"key": {
														"type": "string"
													},
													"name": {
														"type": "string"
													},
													"description": {
														"type": "string"
													},
													"trigger": {
														"type": "object",
														"properties": {
															"trigger": {
																"type": "string",
																"enum": [
																	"journey_created",
																	"stage_entered",
																	"journey_won",
																	"journey_lost",
																	"call_outcome",
																	"ad_lead_created",
																	"journey_unreached",
																	"journey_quiet"
																]
															},
															"stageKey": {
																"type": [
																	"string",
																	"null"
																]
															},
															"callOutcome": {
																"anyOf": [
																	{
																		"type": "string",
																		"enum": [
																			"no_answer",
																			"considering",
																			"callback_later"
																		]
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"quietDays": {
																"anyOf": [
																	{
																		"type": "integer",
																		"minimum": 1,
																		"maximum": 365
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"treatmentSlugs": {
																"type": "array",
																"items": {
																	"type": "string"
																}
															}
														},
														"required": [
															"trigger",
															"stageKey",
															"callOutcome",
															"quietDays",
															"treatmentSlugs"
														],
														"additionalProperties": false
													},
													"steps": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"day": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"channel": {
																	"type": "string",
																	"enum": [
																		"text",
																		"email"
																	]
																},
																"name": {
																	"type": "string"
																}
															},
															"required": [
																"day",
																"channel",
																"name"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"key",
													"name",
													"description",
													"trigger",
													"steps"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"templates"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/flows/from-template": {
			"post": {
				"summary": "Create a flow from the gallery",
				"tags": [
					"automations"
				],
				"description": "Creates one flow from a gallery template on the chosen channels, switched off, for the practice to edit and switch on. Its templates are reused by name and channel, else created (new WhatsApp templates are submitted to WhatsApp); a treatment it names that the practice lacks is left out. Needs sequence:create. 400 UNKNOWN_FLOW_TEMPLATE for a key the practice's gallery lacks; 400 STAGE_REQUIRED when the board has no stage for its trigger; 400 BOARD_ARCHIVED.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"key": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									},
									"channels": {
										"minItems": 1,
										"maxItems": 3,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"email",
												"sms",
												"whatsapp"
											]
										}
									},
									"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)$"
									}
								},
								"required": [
									"key",
									"channels",
									"pipelineId"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/automations/missed-calls": {
			"get": {
				"summary": "Get the missed-call text",
				"tags": [
					"automations"
				],
				"description": "Whether a caller whose call to a Smileline number went unanswered gets one text, and the SMS templates sent while the number's location is open and while it is closed. Needs sequence:read. UK and US practices only, where Smileline Voice numbers are (403 COUNTRY_UNAVAILABLE elsewhere).",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"enabled": {
											"type": "boolean"
										},
										"openTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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",
										"openTemplateId",
										"closedTemplateId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Change the missed-call text",
				"tags": [
					"automations"
				],
				"description": "Switches the missed-call text on or off and picks its two templates: each one of the practice's SMS (or channel-free) templates, not archived (400 MISSED_CALL_TEMPLATE_INVALID). Switching it on needs both (400 MISSED_CALL_TEMPLATES_REQUIRED). Needs sequence:update. UK and US practices only, where Smileline Voice numbers are (403 COUNTRY_UNAVAILABLE elsewhere).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"openTemplateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"closedTemplateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
										"enabled": {
											"type": "boolean"
										},
										"openTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"closedTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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",
										"openTemplateId",
										"closedTemplateId"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/automations/reminders": {
			"post": {
				"summary": "Create a reminder rule",
				"tags": [
					"automations"
				],
				"description": "Several pre_visit cards (48h + 24h) is the normal configuration. Scheduling applies to bookings made from then on. treatmentIds makes the rule a treatment's own version: for a booking of that treatment, the enabled rules of its kind bound to it replace the standard (unbound) ones. Rejects an unknown or archived treatment. A recall_due rule is a recall message: whole days from −365 to +730 around the recall due date, no treatments, and only where Smileline is the clinical system with the clinic workspace (else 409 RECALLS_UNAVAILABLE).",
				"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",
											"recall_due"
										]
									},
									"offsetMinutes": {
										"default": 0,
										"type": "integer",
										"minimum": -525600,
										"maximum": 1051200
									},
									"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"
									},
									"treatmentIds": {
										"default": [],
										"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": [
									"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/customise": {
			"post": {
				"summary": "Customise a reminder kind for treatments",
				"tags": [
					"automations"
				],
				"description": "Customise for a treatment: copies every live standard (unbound) rule of kind — its timing, channel, template and pinned template revision, on or off as it is — into new rules bound to exactly treatmentIds, in one transaction: all of them or none. An enabled copy takes an active-rule slot (409 REMINDER_RULE_LIMIT_REACHED at the limit). 409 ALREADY_CUSTOMISED when a live rule of the kind is already bound to one of the treatments, so a retry after a lost response changes nothing: reload instead. Like every rule-side edit, the copies apply to bookings made from then on. Rejects an unknown or archived treatment.",
				"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"
										]
									},
									"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": [
									"kind",
									"treatmentIds"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"reminderRules": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReminderRule"
											}
										}
									},
									"required": [
										"reminderRules"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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. treatmentIds, when sent, replaces the rule's treatments ([] = standard) and applies to bookings scheduled afterwards. offsetMinutes is judged against the rule's own kind (400 OFFSET_SIGN / OFFSET_RANGE). A recall_due rule takes no treatments, and editing or enabling one needs the clinic workspace with Smileline as the clinical system (else 409 RECALLS_UNAVAILABLE).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
										"type": "integer",
										"minimum": -525600,
										"maximum": 1051200
									},
									"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": {
										"type": "boolean"
									},
									"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)$"
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/automations/recall-defaults": {
			"post": {
				"summary": "Add the recommended recall schedule",
				"tags": [
					"automations"
				],
				"description": "Recall messages, the recommended long tail from 4 weeks before the recall due date to 18 months after: adds the recommended recall message templates the practice lacks (matched by name and channel) and every recommended recall_due rule it lacks (matched by offset and channel), all switched off. Idempotent — a retry or a second click adds nothing. Returns the rules it added. Only where Smileline is the clinical system with the clinic workspace (else 409 RECALLS_UNAVAILABLE).",
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"reminderRules": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReminderRule"
											}
										}
									},
									"required": [
										"reminderRules"
									],
									"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": {
			"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. An omitted replyHoldEnabled is unchanged. Shortening creates bounded progressive restamp work; extending a window never increases an already-materialized expiry or restores redacted data. minAttemptsBeforeGivingUp fits the retry window's three calling days: at most 3 × callbacksPerDay (the one sent, else the saved one), above it 400 TRIES_OVER_LIMIT (details.limit) with nothing saved; a saved value that a lower callbacksPerDay leaves above it reads as that limit.",
				"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"
											}
										]
									},
									"pdfShowLogo": {
										"type": "boolean"
									},
									"pdfFooterText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 1000
											},
											{
												"type": "null"
											}
										]
									},
									"prescriptionLayout": {
										"type": "string",
										"enum": [
											"form",
											"letterhead",
											"patient"
										]
									},
									"tillReviewRequired": {
										"type": "boolean"
									},
									"voiceNotesEnabled": {
										"type": "boolean"
									},
									"imageCheckEnabled": {
										"type": "boolean"
									},
									"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"
											}
										]
									},
									"replyHoldEnabled": {
										"type": "boolean"
									},
									"minAttemptsBeforeGivingUp": {
										"type": "integer",
										"minimum": 1,
										"maximum": 50
									},
									"callbacksPerDay": {
										"type": "integer",
										"minimum": 1,
										"maximum": 5
									},
									"leadReplyTargetMinutes": {
										"type": "integer",
										"minimum": 1,
										"maximum": 240
									},
									"bookingNoteTemplate": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 1000
											},
											{
												"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"
											}
										]
									},
									"toothNotation": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"fdi",
													"universal",
													"palmer"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"chartPlannedColour": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-f]{6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"chartExistingColour": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-f]{6}$"
											},
											{
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice/admin/profile": {
			"get": {
				"summary": "Read the non-patient practice business profile",
				"tags": [
					"settings"
				],
				"description": "Owners and managers only. Name, country, timezone, brand colour and public website origin; no patient data, fiscal identifiers, credentials or media links. Read-only, with settings.read for connected apps.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"name": {
											"type": "string"
										},
										"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"
											]
										},
										"timezone": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64
										},
										"brandColor": {
											"anyOf": [
												{
													"type": "string",
													"pattern": "^#[0-9a-f]{6}$"
												},
												{
													"type": "null"
												}
											]
										},
										"websiteOrigin": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"name",
										"country",
										"timezone",
										"brandColor",
										"websiteOrigin"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice/admin/setup": {
			"get": {
				"summary": "Read non-patient practice configuration status",
				"tags": [
					"settings"
				],
				"description": "Owners and managers only. Team and pending invitation counts, and whether active locations, practitioners, rooms and practitioner rota hours exist. No patient activity, invitation contents, payment setup or provider credentials are read. Read-only, with settings.read for connected apps.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"team": {
											"type": "object",
											"properties": {
												"members": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"pendingInvitations": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"members",
												"pendingInvitations"
											],
											"additionalProperties": false
										},
										"configured": {
											"type": "object",
											"properties": {
												"locations": {
													"type": "boolean"
												},
												"practitioners": {
													"type": "boolean"
												},
												"rooms": {
													"type": "boolean"
												},
												"rotas": {
													"type": "boolean"
												}
											},
											"required": [
												"locations",
												"practitioners",
												"rooms",
												"rotas"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"team",
										"configured"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/ai-replies": {
			"get": {
				"summary": "Get the AI replies settings",
				"tags": [
					"settings"
				],
				"description": "Whether and when the AI answers patients by itself on WhatsApp, SMS, Messenger, Instagram and email. Defaults (off) for a practice that never saved them. Replies need the AI add-on.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"enabled": {
											"type": "boolean"
										},
										"channels": {
											"maxItems": 5,
											"type": "array",
											"items": {
												"type": "string",
												"enum": [
													"whatsapp",
													"sms",
													"email",
													"messenger",
													"instagram"
												]
											}
										},
										"inHours": {
											"type": "string",
											"enum": [
												"now",
												"delay",
												"off"
											]
										},
										"delayMinutes": {
											"type": "number",
											"enum": [
												2,
												5,
												10,
												15,
												30
											]
										},
										"outOfHours": {
											"type": "string",
											"enum": [
												"now",
												"off"
											]
										},
										"audience": {
											"type": "string",
											"enum": [
												"leads",
												"everyone"
											]
										},
										"closing": {
											"type": "object",
											"properties": {
												"bookInChat": {
													"type": "boolean"
												},
												"bookingLink": {
													"type": "boolean"
												},
												"callBack": {
													"type": "boolean"
												}
											},
											"required": [
												"bookInChat",
												"bookingLink",
												"callBack"
											],
											"additionalProperties": false
										},
										"guidance": {
											"type": "string",
											"maxLength": 2000
										}
									},
									"required": [
										"enabled",
										"channels",
										"inHours",
										"delayMinutes",
										"outOfHours",
										"audience",
										"closing",
										"guidance"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Update the AI replies settings",
				"tags": [
					"settings"
				],
				"description": "Whole-write. Practice guidance is shared with patients through the replies, like the knowledge base. Turning replies on needs the AI add-on (403 AI_NOT_ENABLED).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									},
									"channels": {
										"maxItems": 5,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"whatsapp",
												"sms",
												"email",
												"messenger",
												"instagram"
											]
										}
									},
									"inHours": {
										"type": "string",
										"enum": [
											"now",
											"delay",
											"off"
										]
									},
									"delayMinutes": {
										"type": "number",
										"enum": [
											2,
											5,
											10,
											15,
											30
										]
									},
									"outOfHours": {
										"type": "string",
										"enum": [
											"now",
											"off"
										]
									},
									"audience": {
										"type": "string",
										"enum": [
											"leads",
											"everyone"
										]
									},
									"closing": {
										"type": "object",
										"properties": {
											"bookInChat": {
												"type": "boolean"
											},
											"bookingLink": {
												"type": "boolean"
											},
											"callBack": {
												"type": "boolean"
											}
										},
										"required": [
											"bookInChat",
											"bookingLink",
											"callBack"
										]
									},
									"guidance": {
										"type": "string",
										"maxLength": 2000
									}
								},
								"required": [
									"enabled",
									"channels",
									"inHours",
									"delayMinutes",
									"outOfHours",
									"audience",
									"closing",
									"guidance"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"enabled": {
											"type": "boolean"
										},
										"channels": {
											"maxItems": 5,
											"type": "array",
											"items": {
												"type": "string",
												"enum": [
													"whatsapp",
													"sms",
													"email",
													"messenger",
													"instagram"
												]
											}
										},
										"inHours": {
											"type": "string",
											"enum": [
												"now",
												"delay",
												"off"
											]
										},
										"delayMinutes": {
											"type": "number",
											"enum": [
												2,
												5,
												10,
												15,
												30
											]
										},
										"outOfHours": {
											"type": "string",
											"enum": [
												"now",
												"off"
											]
										},
										"audience": {
											"type": "string",
											"enum": [
												"leads",
												"everyone"
											]
										},
										"closing": {
											"type": "object",
											"properties": {
												"bookInChat": {
													"type": "boolean"
												},
												"bookingLink": {
													"type": "boolean"
												},
												"callBack": {
													"type": "boolean"
												}
											},
											"required": [
												"bookInChat",
												"bookingLink",
												"callBack"
											],
											"additionalProperties": false
										},
										"guidance": {
											"type": "string",
											"maxLength": 2000
										}
									},
									"required": [
										"enabled",
										"channels",
										"inHours",
										"delayMinutes",
										"outOfHours",
										"audience",
										"closing",
										"guidance"
									],
									"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/ai-replies/try": {
			"post": {
				"summary": "Try an AI reply",
				"tags": [
					"settings"
				],
				"description": "Writes the reply a patient's message would get, with the practice's live context and the saved settings. Nothing is sent, saved or acted on. Needs the AI add-on; counts against the practice's AI rate limit.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"message": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1000
									},
									"channel": {
										"type": "string",
										"enum": [
											"whatsapp",
											"sms",
											"email",
											"messenger",
											"instagram"
										]
									}
								},
								"required": [
									"message",
									"channel"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"outcome": {
											"type": "string",
											"enum": [
												"reply",
												"handoff",
												"no_reply",
												"held_back"
											]
										},
										"message": {
											"type": [
												"string",
												"null"
											]
										},
										"reason": {
											"type": [
												"string",
												"null"
											]
										},
										"actions": {
											"type": "array",
											"items": {
												"type": "string",
												"enum": [
													"save_details",
													"call_back",
													"alert_team"
												]
											}
										}
									},
									"required": [
										"outcome",
										"message",
										"reason",
										"actions"
									],
									"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"
								}
							}
						}
					},
					"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/production-goals": {
			"get": {
				"summary": "List production goals",
				"tags": [
					"settings"
				],
				"description": "Every production goal row (practice, site and clinician scopes), newest month first, one keyset page at a time: pass `nextCursor` back as `cursor` until it is null (an invalid cursor is 400 INVALID_CURSOR).",
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ProductionGoal"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Set a production goal",
				"tags": [
					"settings"
				],
				"description": "Sets the goal of one scope (the practice, a site or a clinician) from one month on. A month with no goal for the scope is created (`expectedUpdatedAt: null`); a month that has one is edited (`expectedUpdatedAt` its version). Anything else — an edit since, or a goal someone else just set — is 409 PRODUCTION_GOAL_STALE with the current goal in `details.current`. Needs settings:update; audited.",
				"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"
											}
										]
									},
									"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"
											}
										]
									},
									"effectiveMonth": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"amountCents": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"expectedUpdatedAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
									"locationId",
									"practitionerId",
									"effectiveMonth",
									"amountCents",
									"expectedUpdatedAt"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProductionGoal"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/production-goals/{id}": {
			"delete": {
				"summary": "Remove a production goal",
				"tags": [
					"settings"
				],
				"description": "Removes one month's goal row, naming the version the editor showed (409 PRODUCTION_GOAL_STALE when it changed since). The scope's earlier goal then applies again from that month. Needs settings:update; audited.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "expectedUpdatedAt",
						"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": {
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/billing-entities": {
			"get": {
				"summary": "The practice's legal entities",
				"tags": [
					"Settings"
				],
				"description": "Every legal entity of the practice, the primary first. A practice always has its primary entity: one the API before legal entities created is filled in from the practice's details on first read.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/BillingEntity"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/billing-entities/{id}": {
			"patch": {
				"summary": "Edit a legal entity",
				"tags": [
					"Settings"
				],
				"description": "Changes only the fields sent. The US billing identity (NPI, EIN, taxonomy, state) is a US practice's only, the company number a UK practice's and the codice fiscale an Italian practice's: a value for another country is refused with 422 BILLING_ENTITY_FIELD_COUNTRY (clearing one is always allowed), and a state that is not a US state with 422 BILLING_ENTITY_SUBDIVISION. Another practice's entity is 404.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"legalName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"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"
											}
										]
									},
									"subdivision": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 2,
												"maxLength": 2
											},
											{
												"type": "null"
											}
										]
									},
									"postalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"companyNumber": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^(?:[0-9A-Z]{8}|[0-9]{1,6})$"
											},
											{
												"type": "null"
											}
										]
									},
									"vatNumber": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 32
											},
											{
												"type": "null"
											}
										]
									},
									"fiscalCode": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 32
											},
											{
												"type": "null"
											}
										]
									},
									"npi": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9]{10}$"
											},
											{
												"type": "null"
											}
										]
									},
									"taxId": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9]{9}$"
											},
											{
												"type": "null"
											}
										]
									},
									"taxonomyCode": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9A-Z]{10}$"
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/BillingEntity"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practitioners/{id}/registration": {
			"get": {
				"summary": "A clinician's legal name and registration",
				"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": {
										"givenName": {
											"type": [
												"string",
												"null"
											]
										},
										"familyName": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSuffix": {
											"type": [
												"string",
												"null"
											]
										},
										"taxonomyCode": {
											"type": [
												"string",
												"null"
											]
										},
										"npi": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"givenName",
										"familyName",
										"nameSuffix",
										"taxonomyCode",
										"npi"
									],
									"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": "Set a clinician's legal name and registration",
				"tags": [
					"settings"
				],
				"description": "Sets the given name, family name, suffix and — in the US — the specialty (NUCC taxonomy) and NPI that claims are built from (null clears one; a null NPI closes the live registration). Records one credential revision for the change, none when nothing changed. A specialty or NPI outside the US is refused with 422 REGISTRATION_FIELD_COUNTRY. Needs practitioner:update.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"givenName": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"familyName": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"nameSuffix": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 10
											},
											{
												"type": "null"
											}
										]
									},
									"taxonomyCode": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9A-Z]{10}$"
											},
											{
												"type": "null"
											}
										]
									},
									"npi": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^[0-9]{10}$"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"givenName",
									"familyName",
									"nameSuffix",
									"taxonomyCode",
									"npi"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"givenName": {
											"type": [
												"string",
												"null"
											]
										},
										"familyName": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSuffix": {
											"type": [
												"string",
												"null"
											]
										},
										"taxonomyCode": {
											"type": [
												"string",
												"null"
											]
										},
										"npi": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"givenName",
										"familyName",
										"nameSuffix",
										"taxonomyCode",
										"npi"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practitioners/website-photos": {
			"post": {
				"summary": "Find practitioners' photos on the practice website's team page",
				"tags": [
					"settings"
				],
				"description": "Reads the team page through the safe egress fetcher and pairs its photos with the practice's active practitioners. `unreadable` means part of the AI's answer could not be read (the pairs it could read are still returned); `none` means it read the whole page and matched no one. Nothing fetched is stored. 422 when the page cannot be opened or is not HTML; 503 when website fetching or the AI is unavailable. Needs practitioner:update.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"url"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"matched",
												"none",
												"unreadable"
											]
										},
										"pairs": {
											"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)$"
													},
													"photoUrl": {
														"type": "string"
													}
												},
												"required": [
													"practitionerId",
													"photoUrl"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"status",
										"pairs"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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/practitioners/website-photos/crop": {
			"post": {
				"summary": "Download one website photo and crop it around the face",
				"tags": [
					"settings"
				],
				"description": "Downloads the photo through the safe egress fetcher (following redirects to other public hosts) and returns it as a 512 px square JPEG data URL centred on the face. Nothing is stored. 422 when the photo cannot be downloaded or read; 503 when cropping is unavailable. Needs practitioner:update.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"url"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"image": {
											"type": "string"
										}
									},
									"required": [
										"image"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/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"
								}
							}
						}
					}
				}
			}
		},
		"/settings/practice/setup-guide": {
			"get": {
				"summary": "Get the practice's setup guide",
				"tags": [
					"settings"
				],
				"description": "The new-practice checklist: which tasks are done (derived from the practice's stored data, never marked by hand), which optional tasks were skipped, the practice-management path chosen, and whether the guide was hidden. Owners and managers only; a connection needs only read access.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SetupGuide"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"patch": {
				"summary": "Update the practice's setup guide answers",
				"tags": [
					"settings"
				],
				"description": "Partial update of the stored answers only: the practice-management path, the skipped optional tasks and the hidden timestamp. Task completion cannot be patched because it is derived from the practice's data.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"pmsPath": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"external",
													"native"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"skipped": {
										"maxItems": 15,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"team",
												"pms-connect",
												"practitioners",
												"operatories",
												"rotas",
												"locations",
												"website",
												"payments",
												"voice-numbers",
												"channel-sms",
												"channel-whatsapp",
												"channel-meta",
												"sending-domain",
												"ads-google",
												"ads-meta"
											]
										}
									},
									"hiddenAt": {
										"anyOf": [
											{
												"type": "string",
												"format": "date-time",
												"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": {
									"$ref": "#/components/schemas/SetupGuide"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/practice/letterhead-preview": {
			"get": {
				"summary": "Preview the letterhead on a sample letter",
				"tags": [
					"settings"
				],
				"description": "A letter to a fictional patient under the practice's letterhead and first site, as HTML for a sandboxed frame; nothing is rendered or stored. For members who can change settings.",
				"parameters": [
					{
						"name": "showLogo",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"true",
								"false"
							]
						}
					},
					{
						"name": "logoUrl",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 500,
							"format": "uri"
						}
					},
					{
						"name": "footerText",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 1000
						}
					},
					{
						"name": "brandColor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^#[0-9a-fA-F]{6}$"
						}
					},
					{
						"name": "page",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"letter",
								"prescription"
							]
						}
					},
					{
						"name": "prescriptionLayout",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"form",
								"letterhead",
								"patient"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"html": {
											"type": "string"
										}
									},
									"required": [
										"html"
									],
									"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/practice/setup-status": {
			"get": {
				"summary": "Get the practice's setup status",
				"tags": [
					"settings"
				],
				"description": "The setup guide, the owner's invitation and whether the owner has joined, the team's size, the website checklist, ad connections and conversion setup, sending domains and the agreements still to accept, in one read. Each part matches its own endpoint, and reading changes nothing: unlike GET /settings/website/tracking/status it never creates the website tracking settings. It answers whenever the setup guide does: while a practice has no plan yet, it still returns the owner, team, website, ads and sending-domain parts, though their own endpoints answer 402 until it has one. owner.joined is true once the practice has an owner who is not on its agency's team (any owner when no agency holds it). Owners and managers only; a connection needs the read scope (a developer app's area scopes do not cover it). Agreements are accepted in the app, never through the API.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PracticeSetupStatus"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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"
										]
									},
									"cancelRefundHours": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 720
											},
											{
												"type": "null"
											}
										]
									},
									"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 payment link (its secret after a `#`, hashed at rest) and sends it on every selected channel; with no channels nothing is sent, for a practice taking the payment by card. Per-channel failures are reported in the response, not thrown. One live deposit per lead (per patient for a lead-less request): a pending one answers 409 DEPOSIT_PENDING_EXISTS, a paid, refunding or held one — or one collected at the practice for a consultation still to come — 409 DEPOSIT_LIVE_EXISTS. The request records the site its payment will post at — the journey's, else the patient's, else the practice's first live site; a practice with no site answers 409 LOCATION_MISSING.",
				"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": {
										"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"
				],
				"description": "Newest first, one page at a time: pass `nextCursor` back as `cursor` until it is null. An invalid cursor answers 400. Each row names its patient (with their date of birth), its site (an archived one included) and any unresolved refund of an extra payment. `locationId` keeps one site's requests.",
				"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": "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": "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
						}
					},
					{
						"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/DepositRequestListItem"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/held": {
			"get": {
				"summary": "Deposits held",
				"tags": [
					"deposits"
				],
				"description": "The booking-deposit money still on the ledger — each live deposit payment less its refunds and what it paid (a kept deposit) — summed over the requests the deposit list shows, with how many patients it is held for. The list's own `heldCents` add up to it. A deposit taken outside Smileline has no ledger payment and is not in it. `locationId` keeps one site's requests, as the list does.",
				"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": {
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"cents": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"patients": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"currency",
										"cents",
										"patients"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}": {
			"get": {
				"summary": "Get a deposit request",
				"tags": [
					"deposits"
				],
				"description": "As the patient record shows it: with its unexpected-payment refund state and its Dentally payment line, so a link to one request reaches its actions.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PatientDisplayDeposit"
								}
							}
						}
					},
					"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}/link": {
			"post": {
				"summary": "Copy the payment link",
				"tags": [
					"deposits"
				],
				"description": "The request's payment link, its secret after a `#`. A pending, unexpired request's link pays; a request made before hashed links gets a new link here, and its older link keeps working until the request expires. A paid request's same link opens its proof of payment (never a new link). Anything else, or a paid request with no saved link, answers 400 DEPOSIT_NOT_PENDING.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"link": {
											"type": "string"
										}
									},
									"required": [
										"link"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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}/card-payment": {
			"get": {
				"summary": "Card form settings for a deposit",
				"tags": [
					"deposits"
				],
				"description": "The publishable key and connected account the card form tokenises on. 503 CARD_PAYMENTS_NOT_CONFIGURED when the platform has no publishable key in the secret key's 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/DepositCardPaymentConfig"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Pay a deposit with a card taken over the phone",
				"tags": [
					"deposits"
				],
				"description": "Charges the card on the practice's account as a mail/telephone order (MOTO); when Stripe has not enabled MOTO for the account, or the bank asks for it, the same payment falls back to the patient approving it (clientSecret). One card payment at a time per request; a declined card can be replaced on it. Without paymentMethodId, checks the payment in progress with Stripe. 402 CARD_DECLINED carries the bank's 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": {
									"paymentMethodId": {
										"type": "string",
										"maxLength": 255,
										"pattern": "^pm_[A-Za-z0-9]+$"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositCardPaymentResult"
								}
							}
						}
					},
					"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}/card-payment/cancel": {
			"post": {
				"summary": "Stop a card payment in progress",
				"tags": [
					"deposits"
				],
				"description": "Cancels the card payment's PaymentIntent and frees the payment link once Stripe confirms nothing was taken. A payment Stripe already took is recorded 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositCardPaymentResult"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/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 and the review flag clears. In the same transaction a \"Deposit kept\" charge goes on the patient's ledger, paid from the deposit — what is left of it after its refunds — so anything the deposit had paid (bills, payment-plan instalments) is owed again. 409 DEPOSIT_NOT_ON_LEDGER while the deposit's payment is not on the ledger yet (it waits in the Review queue).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/deposit-requests/{id}/unforfeit": {
			"post": {
				"summary": "Undo a kept deposit",
				"tags": [
					"deposits"
				],
				"description": "Puts a forfeited deposit back to paid, held for review so it can be refunded or kept again. Its \"Deposit kept\" charge is reversed and the deposit pays again, oldest first, what it can; instalments it had settled stay open for staff to allocate. 400 DEPOSIT_NOT_KEPT when the deposit is not kept.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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}/pms-payment/retry": {
			"post": {
				"summary": "Retry a deposit's Dentally payment or note",
				"tags": [
					"deposits"
				],
				"description": "Sends a parked payment (or removal, or the deposit's note) to Dentally again, at the `actionVersion` the card showed. One already sent is only looked for again, never posted twice. 409 PMS_ACTION_CHANGED once the line moved, PMS_ACTION_BUSY while Smileline is working on it, PMS_ACTION_INVALID when Retry is not offered, PMS_AUTHORITY_FROZEN during a system-of-record handover.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"actionVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"part": {
										"default": "payment",
										"type": "string",
										"enum": [
											"payment",
											"note"
										]
									}
								},
								"required": [
									"actionVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositPmsPayment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/pms-payment/dismiss": {
			"post": {
				"summary": "Dismiss a deposit's Dentally payment or note",
				"tags": [
					"deposits"
				],
				"description": "Takes a parked Dentally payment, removal, note or by-hand adjustment off the card once staff have dealt with it in Dentally, at the `actionVersion` the card showed. A payment that was sent stays owed a removal if the deposit is refunded later.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"actionVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"part": {
										"default": "payment",
										"type": "string",
										"enum": [
											"payment",
											"note"
										]
									}
								},
								"required": [
									"actionVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositPmsPayment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/pms-payment/check-now": {
			"post": {
				"summary": "Check a waiting deposit payment with Dentally now",
				"tags": [
					"deposits"
				],
				"description": "A deposit's Dentally payment waiting on its connection, the patient's chart, the kept amount or a system-of-record handover is checked again at the next run, about a minute, instead of at the end of its wait, at the `actionVersion` the card showed. Nothing else changes, its version included. 409 PMS_ACTION_CHANGED once the line moved, PMS_ACTION_BUSY while Smileline is working on it, PMS_PAYMENT_NOT_WAITING when the payment is not waiting on one of those.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"actionVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"actionVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DepositPmsPayment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/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": {
														"type": [
															"string",
															"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. Refreshes pending number orders from the carrier before returning; repeated reads within a minute coalesce. 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, the default caller ID, double dial and the numbers ticked for rotation. `rotationNumberIds` replaces the ticked set: each must be the practice's own active Voice number that can place calls, so not one on a desk phone line (422 NUMBER_NOT_ROTATABLE, nothing saved). A number with no routing saved rotates too: a patient who rings it back takes its default route. 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"
											}
										]
									},
									"doubleDial": {
										"type": "boolean"
									},
									"rotationNumberIds": {
										"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)$"
										}
									}
								}
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"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 numbers",
				"tags": [
					"dialer"
				],
				"description": "Numbers are searched in the practice's own country — inventory follows the org's legal country. `type` picks local (geographic) or mobile numbers; mobile exists in GB only. A local search takes a `region` (a town, or an area code as digits); without one, `locationId` derives the region from that location — its landline area code, then its town, then the nearest town the provider lists — and the response's `region` says which was used. In the US a typed town is searched in the location's state first. `contains`, `startsWith` and `endsWith` match digits of the number (after the area code when one is searched). A US number's `region` names its state (`Austin, TX`). `sms` is true when the number can text.",
				"parameters": [
					{
						"name": "type",
						"in": "query",
						"required": false,
						"schema": {
							"default": "local",
							"type": "string",
							"enum": [
								"local",
								"mobile"
							]
						}
					},
					{
						"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": "region",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 80
						}
					},
					{
						"name": "contains",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^\\d{1,15}$"
						}
					},
					{
						"name": "startsWith",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^\\d{1,15}$"
						}
					},
					{
						"name": "endsWith",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^\\d{1,15}$"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 10,
							"type": "integer",
							"minimum": 1,
							"maximum": 50
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"numbers": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"e164": {
														"type": "string"
													},
													"region": {
														"type": [
															"string",
															"null"
														]
													},
													"phoneNumberType": {
														"type": [
															"string",
															"null"
														]
													},
													"sms": {
														"type": "boolean"
													}
												},
												"required": [
													"e164",
													"region",
													"phoneNumberType",
													"sms"
												],
												"additionalProperties": false
											}
										},
										"region": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"numbers",
										"region"
									],
									"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"
								}
							}
						}
					},
					"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}/retry": {
			"post": {
				"summary": "Order a failed number again",
				"tags": [
					"dialer"
				],
				"description": "For a number whose order the carrier refused. Re-checks what refused it first — a UK verification whose address the carrier never validated is repaired in place (409 DIALER_KYC_ADDRESS_REVALIDATING while the reviewers look at it again) — then orders the same number again for the same location or pool. The failed row is superseded; the new order is asynchronous like the 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": {
					"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
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/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)$"
											}
										},
										"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/kyc/documents/{requirementId}": {
			"get": {
				"summary": "Download a document submitted for UK verification",
				"tags": [
					"dialer"
				],
				"description": "Streams the file behind one document row of the practice's own review. The document is found from that review, never from a caller-supplied provider id.",
				"parameters": [
					{
						"name": "requirementId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 128
						}
					}
				],
				"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"
								}
							}
						}
					},
					"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": {
											"type": [
												"string",
												"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": {
														"type": [
															"string",
															"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/calls": {
			"get": {
				"summary": "List call logs",
				"tags": [
					"dialer"
				],
				"parameters": [
					{
						"name": "id",
						"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": "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": "unreturned",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "missed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "userId",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					},
					{
						"name": "result",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"answered",
								"not_answered",
								"voicemail"
							]
						}
					},
					{
						"name": "outcome",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"considering",
								"callback_later",
								"booked",
								"no_answer",
								"message_sent",
								"not_proceeding",
								"attended",
								"no_show",
								"going_ahead",
								"declined",
								"cancelled"
							]
						}
					},
					{
						"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": "longerThanSec",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 0,
							"maximum": 2147483647
						}
					},
					{
						"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}/dismiss": {
			"post": {
				"summary": "Dismiss one missed call",
				"tags": [
					"dialer"
				],
				"description": "dialer:use. Marks one of the practice's open missed calls as handled without a callback. `dismissed` is 0 when it was already returned, dismissed or answered, or is 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"dismissed": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"dismissed"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/missed-calls/dismiss": {
			"post": {
				"summary": "Dismiss every open missed call",
				"tags": [
					"dialer"
				],
				"description": "dialer:use. Closes every open missed call the Today page counted — or, with `fromNumber`, only that number's (a Reached out row's Dismiss). `asOf` is the `missedCalls.asOf` (or the row's `asOf`) the Today page returned; a miss that rang, ended or was imported after it stays open.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"asOf": {
										"type": "string",
										"format": "date-time",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
									},
									"fromNumber": {
										"type": "string",
										"minLength": 1,
										"maxLength": 64
									}
								},
								"required": [
									"asOf"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"dismissed": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"dismissed"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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
									},
									"worstMos": {
										"type": "number",
										"minimum": 1,
										"maximum": 5
									},
									"warnings": {
										"maxItems": 32,
										"type": "array",
										"items": {
											"type": "integer",
											"minimum": 30000,
											"maximum": 39999
										}
									},
									"endedBy": {
										"type": "string",
										"enum": [
											"agent",
											"page-left",
											"softphone-off",
											"other"
										]
									},
									"route": {
										"type": "string",
										"enum": [
											"direct-udp",
											"direct-tcp",
											"relay-udp",
											"relay-tcp",
											"relay-tls",
											"relay"
										]
									},
									"micLevelDb": {
										"type": "number",
										"minimum": -100,
										"maximum": 0
									},
									"micLabel": {
										"type": "string",
										"maxLength": 64
									}
								},
								"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}/result": {
			"put": {
				"summary": "Correct a specific call's result",
				"tags": [
					"dialer"
				],
				"description": "A signed-in person with dialer:use corrects a completed, answered outbound call linked to the exact patient supplied. Preserves the first provider verdict and time, writes the member's correction and audit evidence together, and prevents later AI/provider results from overriding it. An identical retry writes nothing. 409 CALL_RESULT_CHANGED when the displayed detector verdict is stale; refresh before retrying. Task/email/message outcomes are 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": {
									"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)$"
									},
									"result": {
										"type": "string",
										"enum": [
											"answered",
											"voicemail"
										]
									},
									"expectedMachineDetection": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 64
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"patientId",
									"result",
									"expectedMachineDetection"
								]
							}
						}
					}
				},
				"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)$"
										}
									},
									"required": [
										"id"
									],
									"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}/recording/link": {
			"post": {
				"summary": "Create a call recording play link",
				"tags": [
					"dialer"
				],
				"description": "Mints a private, Range-capable link to the stored MP3, valid for 15 minutes or twice the recording's length, whichever is longer. Requires the dialer:media permission; the listen is written to the audit log once, here — requests to the link itself are not audited again. 404 when there is no stored recording to link: not stored yet, deleted after the retention window, held by an external phone provider, or links not configured. Stream those from GET /dialer/calls/{id}/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": {
										"url": {
											"type": "string",
											"format": "uri"
										},
										"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": [
										"url",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls/{id}/transcript": {
			"get": {
				"summary": "The call's transcript",
				"tags": [
					"dialer"
				],
				"description": "Assembled post-call transcript (SmileLine Voice). Requires the dialer:use permission; every access is written to the audit log. Without a transcript the 404 names why in `code`: TRANSCRIPTION_PENDING (still being transcribed), TRANSCRIPTION_FAILED (retry with POST /dialer/calls/:id/transcript/retry), TRANSCRIPT_EXPIRED (it expired with its recording), TRANSCRIPTION_SKIPPED, or NOT_FOUND (the call was never transcribed).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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",
												"realtime"
											]
										},
										"language": {
											"type": [
												"string",
												"null"
											]
										},
										"text": {
											"type": "string"
										},
										"lines": {
											"anyOf": [
												{
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"speaker": {
																"type": "string",
																"enum": [
																	"patient",
																	"practice"
																]
															},
															"text": {
																"type": "string"
															},
															"atSec": {
																"anyOf": [
																	{
																		"type": "number",
																		"minimum": 0
																	},
																	{
																		"type": "null"
																	}
																]
															}
														},
														"required": [
															"speaker",
															"text",
															"atSec"
														],
														"additionalProperties": false
													}
												},
												{
													"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",
										"source",
										"language",
										"text",
										"lines",
										"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}/transcript/retry": {
			"post": {
				"summary": "Transcribe a call again",
				"tags": [
					"dialer"
				],
				"description": "For a call whose transcription failed (the transcript route answers 404 TRANSCRIPTION_FAILED). Starts one fresh transcription of the stored recording; requires the dialer:use permission and is written to the audit log. 409 when the transcription has not failed or the recording is no longer held.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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": {
										"ok": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"ok"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/dialer/calls/{id}/path": {
			"get": {
				"summary": "How the call went",
				"tags": [
					"dialer"
				],
				"description": "The call's recorded path, in order: menu choice, who rang, who answered, holds, transfers, forwards, voicemail and hang-up. Requires the dialer:use permission. `path` is null for calls made before the path was recorded, and while a call is still in progress. 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"path": {
											"anyOf": [
												{
													"type": "array",
													"items": {
														"oneOf": [
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "route"
																	},
																	"branch": {
																		"type": "string",
																		"enum": [
																			"open",
																			"closed",
																			"closure",
																			"no_routing",
																			"known_patient",
																			"withheld",
																			"porting",
																			"parked"
																		]
																	},
																	"tracking": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"branch",
																	"tracking"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "menu"
																	},
																	"digit": {
																		"anyOf": [
																			{
																				"type": "string",
																				"pattern": "^[0-9]$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"digit"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "ring"
																	},
																	"target": {
																		"type": "string",
																		"enum": [
																			"group",
																			"site",
																			"everyone",
																			"ai_handoff",
																			"transfer",
																			"ring_back"
																		]
																	},
																	"name": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 120
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"people": {
																		"maxItems": 25,
																		"type": "array",
																		"items": {
																			"type": "object",
																			"properties": {
																				"userId": {
																					"type": [
																						"string",
																						"null"
																					]
																				},
																				"sharedPhone": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 120
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"userId",
																				"sharedPhone"
																			],
																			"additionalProperties": false
																		}
																	},
																	"more": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"target",
																	"name",
																	"people",
																	"more"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "no_answer"
																	},
																	"declinedBy": {
																		"type": "object",
																		"properties": {
																			"userId": {
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"sharedPhone": {
																				"anyOf": [
																					{
																						"type": "string",
																						"maxLength": 120
																					},
																					{
																						"type": "null"
																					}
																				]
																			}
																		},
																		"required": [
																			"userId",
																			"sharedPhone"
																		],
																		"additionalProperties": false
																	}
																},
																"required": [
																	"at",
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "answered"
																	},
																	"party": {
																		"type": "object",
																		"properties": {
																			"userId": {
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"sharedPhone": {
																				"anyOf": [
																					{
																						"type": "string",
																						"maxLength": 120
																					},
																					{
																						"type": "null"
																					}
																				]
																			}
																		},
																		"required": [
																			"userId",
																			"sharedPhone"
																		],
																		"additionalProperties": false
																	},
																	"external": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 20
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"deviceKind": {
																		"anyOf": [
																			{
																				"type": "string",
																				"enum": [
																					"browser",
																					"desktop",
																					"mobile",
																					"extension",
																					"handset"
																				]
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"party",
																	"external",
																	"deviceKind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "dialed"
																	},
																	"to": {
																		"type": "string",
																		"maxLength": 20
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"to"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "forward"
																	},
																	"to": {
																		"type": "string",
																		"maxLength": 20
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"to"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "forward_voicemail"
																	},
																	"to": {
																		"type": "string",
																		"maxLength": 20
																	},
																	"result": {
																		"type": "string",
																		"maxLength": 64
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"to",
																	"result"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "hold"
																	},
																	"by": {
																		"type": "object",
																		"properties": {
																			"userId": {
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"sharedPhone": {
																				"anyOf": [
																					{
																						"type": "string",
																						"maxLength": 120
																					},
																					{
																						"type": "null"
																					}
																				]
																			}
																		},
																		"required": [
																			"userId",
																			"sharedPhone"
																		],
																		"additionalProperties": false
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"by"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "resume"
																	},
																	"by": {
																		"type": "object",
																		"properties": {
																			"userId": {
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"sharedPhone": {
																				"anyOf": [
																					{
																						"type": "string",
																						"maxLength": 120
																					},
																					{
																						"type": "null"
																					}
																				]
																			}
																		},
																		"required": [
																			"userId",
																			"sharedPhone"
																		],
																		"additionalProperties": false
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"by"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "transfer"
																	},
																	"mode": {
																		"type": "string",
																		"enum": [
																			"blind",
																			"attended"
																		]
																	},
																	"by": {
																		"type": "object",
																		"properties": {
																			"userId": {
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"sharedPhone": {
																				"anyOf": [
																					{
																						"type": "string",
																						"maxLength": 120
																					},
																					{
																						"type": "null"
																					}
																				]
																			}
																		},
																		"required": [
																			"userId",
																			"sharedPhone"
																		],
																		"additionalProperties": false
																	},
																	"to": {
																		"type": "object",
																		"properties": {
																			"userId": {
																				"type": [
																					"string",
																					"null"
																				]
																			},
																			"sharedPhone": {
																				"anyOf": [
																					{
																						"type": "string",
																						"maxLength": 120
																					},
																					{
																						"type": "null"
																					}
																				]
																			}
																		},
																		"required": [
																			"userId",
																			"sharedPhone"
																		],
																		"additionalProperties": false
																	},
																	"toNumber": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 20
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"mode",
																	"by",
																	"to",
																	"toNumber"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "transfer_failed"
																	},
																	"reason": {
																		"type": "string",
																		"maxLength": 40
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"reason"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "ai"
																	}
																},
																"required": [
																	"at",
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "ai_handoff"
																	}
																},
																"required": [
																	"at",
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "ai_handoff_failed"
																	}
																},
																"required": [
																	"at",
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "announce"
																	}
																},
																"required": [
																	"at",
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "notice"
																	}
																},
																"required": [
																	"at",
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "voicemail"
																	}
																},
																"required": [
																	"at",
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "declined"
																	},
																	"reason": {
																		"type": "string",
																		"enum": [
																			"blocked",
																			"voicemail_full",
																			"not_in_service",
																			"tracking_full"
																		]
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"reason"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "ended"
																	},
																	"by": {
																		"type": "string",
																		"enum": [
																			"caller",
																			"staff",
																			"system"
																		]
																	},
																	"cause": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 64
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"by",
																	"cause"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"at": {
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	"kind": {
																		"type": "string",
																		"const": "skipped"
																	},
																	"count": {
																		"type": "integer",
																		"minimum": 1,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"at",
																	"kind",
																	"count"
																],
																"additionalProperties": false
															}
														]
													}
												},
												{
													"type": "null"
												}
											]
										},
										"skipped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"path",
										"skipped"
									],
									"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}/analysis": {
			"get": {
				"summary": "The call's AI analysis",
				"tags": [
					"dialer"
				],
				"description": "Call AI's analysis of one call: summary, outcome, next step, email draft, next-call plan and the lead profile for anyone who can open the patient (patient:read; dialer:use for a call with no patient), plus the score and each objection with how it was handled for the call's handler and dialer:manage only — `coaching` is null for everyone else. Every read is written to the audit log. 403 COUNTRY_UNAVAILABLE or VOICE_NOT_ENABLED unless the practice holds Smileline Voice in a Call AI country; 404 when the call was never in scope for Call AI.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/CallAnalysis"
								}
							}
						}
					},
					"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}/analysis/retry": {
			"post": {
				"summary": "Analyse a call again",
				"tags": [
					"dialer"
				],
				"description": "Starts a fresh analysis of a call whose analysis was parked, or is out of date because transcript lines arrived after it. The call's handler (with dialer:use) or dialer:manage, at a practice holding Smileline Voice in a Call AI country — re-checked before the analysis starts (403 CALL_AI_UNAVAILABLE); written to the audit log. 409 when the analysis is neither parked nor out of date, or is already running.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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": {
										"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/calls/{id}/analysis/email-draft": {
			"post": {
				"summary": "Mark the call's email draft used or dismissed",
				"tags": [
					"dialer"
				],
				"description": "Records what a person did with the suggested follow-up email: `used` once they sent it from the composer, `dismissed` to hide it. Drafts are never sent automatically. Requires message:create, at a practice holding Smileline Voice in a Call AI country; 409 when there is no unsent draft.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"action": {
										"type": "string",
										"enum": [
											"used",
											"dismissed"
										]
									}
								},
								"required": [
									"action"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"emailDraftStatus": {
											"type": "string",
											"enum": [
												"none",
												"draft",
												"used",
												"dismissed"
											]
										}
									},
									"required": [
										"emailDraftStatus"
									],
									"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}/live-draft": {
			"get": {
				"summary": "The call's live suggestion",
				"tags": [
					"dialer"
				],
				"description": "Call AI's live suggestion for one call, read from the conversation while it is going on: the outcome, the day and time agreed, the WhatsApp template, the follow-up email Call AI wrote, the lost reason and the treatment — for anyone who can open the patient (patient:read). `status` is `listening` while the call is live with nothing suggested yet, `none` once it ended without a suggestion. Every read is written to the audit log. 403 COUNTRY_UNAVAILABLE or VOICE_NOT_ENABLED unless the practice holds Smileline Voice in a Call AI country; 404 when the call is not a Call AI call with a patient, or its conversation has 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": {
							"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)$"
										},
										"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": [
												"ready",
												"listening",
												"none"
											]
										},
										"suggestion": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"version": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"outcome": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"considering",
																		"callback_later",
																		"booked",
																		"not_proceeding",
																		"going_ahead"
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"agreedDate": {
															"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"
																}
															]
														},
														"agreedTime": {
															"anyOf": [
																{
																	"type": "string",
																	"pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
																},
																{
																	"type": "null"
																}
															]
														},
														"whatsappTemplate": {
															"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"
																}
															]
														},
														"writtenEmail": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"subject": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 150
																		},
																		"body": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 3000
																		}
																	},
																	"required": [
																		"subject",
																		"body"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"emailState": {
															"type": "string",
															"enum": [
																"none",
																"writing",
																"ready",
																"failed"
															]
														},
														"emailLeaseUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"lostReason": {
															"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)$"
																		},
																		"label": {
																			"type": "string"
																		},
																		"needsNote": {
																			"type": "boolean"
																		}
																	},
																	"required": [
																		"id",
																		"label",
																		"needsNote"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"treatment": {
															"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"
																		},
																		"priceCents": {
																			"anyOf": [
																				{
																					"type": "integer",
																					"minimum": 0,
																					"maximum": 9007199254740991
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"currency": {
																			"type": "string"
																		}
																	},
																	"required": [
																		"id",
																		"name",
																		"priceCents",
																		"currency"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"accepted": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"at": {
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		"byUserId": {
																			"anyOf": [
																				{
																					"type": "string",
																					"minLength": 1
																				},
																				{
																					"type": "null"
																				}
																			]
																		}
																	},
																	"required": [
																		"at",
																		"byUserId"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"updatedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														}
													},
													"required": [
														"version",
														"outcome",
														"agreedDate",
														"agreedTime",
														"whatsappTemplate",
														"writtenEmail",
														"emailState",
														"emailLeaseUntil",
														"lostReason",
														"treatment",
														"accepted",
														"updatedAt"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"sent": {
											"type": "object",
											"properties": {
												"whatsapp": {
													"anyOf": [
														{
															"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",
																	"enum": [
																		"queued",
																		"sent",
																		"delivered",
																		"read",
																		"failed"
																	]
																}
															},
															"required": [
																"messageId",
																"status"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"email": {
													"anyOf": [
														{
															"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",
																	"enum": [
																		"queued",
																		"sent",
																		"delivered",
																		"read",
																		"failed"
																	]
																}
															},
															"required": [
																"messageId",
																"status"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"whatsapp",
												"email"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"callLogId",
										"patientId",
										"status",
										"suggestion",
										"sent"
									],
									"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}/live-draft/accept": {
			"post": {
				"summary": "Send the live suggestion's messages",
				"tags": [
					"dialer"
				],
				"description": "The rep's OK on Call AI's live suggestion (2026-10-18): sends the chosen WhatsApp template and the email to the call's patient, each at most once per call, and freezes the suggestion. A repeat of the same command answers with the messages it already sent; a different one after it is 409 CALL_SUGGESTION_ACCEPTED. 409 CALL_SUGGESTION_CHANGED when the patient or version no longer match what the rep was shown. A refused send (403 OPTED_OUT, 422 CHANNEL_UNAVAILABLE or WHATSAPP_TEMPLATE_UNAVAILABLE, a template missing a value) refuses the whole command with its code and sends nothing. Requires patient:read, plus message:create when anything is sent; Smileline Voice in a Call AI country. Written to the audit log. The outcome itself is recorded by the task's own outcome endpoint.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"expectedPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 0,
										"maximum": 9007199254740991
									},
									"whatsappTemplateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"email": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"subject": {
														"type": "string",
														"minLength": 1,
														"maxLength": 150
													},
													"body": {
														"type": "string",
														"minLength": 1,
														"maxLength": 3000
													}
												},
												"required": [
													"subject",
													"body"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"expectedPatientId",
									"version",
									"whatsappTemplateId",
									"email"
								]
							}
						}
					}
				},
				"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)$"
										},
										"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": [
												"ready",
												"listening",
												"none"
											]
										},
										"suggestion": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"version": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"outcome": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"considering",
																		"callback_later",
																		"booked",
																		"not_proceeding",
																		"going_ahead"
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"agreedDate": {
															"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"
																}
															]
														},
														"agreedTime": {
															"anyOf": [
																{
																	"type": "string",
																	"pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
																},
																{
																	"type": "null"
																}
															]
														},
														"whatsappTemplate": {
															"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"
																}
															]
														},
														"writtenEmail": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"subject": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 150
																		},
																		"body": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 3000
																		}
																	},
																	"required": [
																		"subject",
																		"body"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"emailState": {
															"type": "string",
															"enum": [
																"none",
																"writing",
																"ready",
																"failed"
															]
														},
														"emailLeaseUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"lostReason": {
															"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)$"
																		},
																		"label": {
																			"type": "string"
																		},
																		"needsNote": {
																			"type": "boolean"
																		}
																	},
																	"required": [
																		"id",
																		"label",
																		"needsNote"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"treatment": {
															"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"
																		},
																		"priceCents": {
																			"anyOf": [
																				{
																					"type": "integer",
																					"minimum": 0,
																					"maximum": 9007199254740991
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"currency": {
																			"type": "string"
																		}
																	},
																	"required": [
																		"id",
																		"name",
																		"priceCents",
																		"currency"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"accepted": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"at": {
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		"byUserId": {
																			"anyOf": [
																				{
																					"type": "string",
																					"minLength": 1
																				},
																				{
																					"type": "null"
																				}
																			]
																		}
																	},
																	"required": [
																		"at",
																		"byUserId"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"updatedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														}
													},
													"required": [
														"version",
														"outcome",
														"agreedDate",
														"agreedTime",
														"whatsappTemplate",
														"writtenEmail",
														"emailState",
														"emailLeaseUntil",
														"lostReason",
														"treatment",
														"accepted",
														"updatedAt"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"sent": {
											"type": "object",
											"properties": {
												"whatsapp": {
													"anyOf": [
														{
															"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",
																	"enum": [
																		"queued",
																		"sent",
																		"delivered",
																		"read",
																		"failed"
																	]
																}
															},
															"required": [
																"messageId",
																"status"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"email": {
													"anyOf": [
														{
															"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",
																	"enum": [
																		"queued",
																		"sent",
																		"delivered",
																		"read",
																		"failed"
																	]
																}
															},
															"required": [
																"messageId",
																"status"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"whatsapp",
												"email"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"callLogId",
										"patientId",
										"status",
										"suggestion",
										"sent"
									],
									"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/calls/{id}/live-draft/email": {
			"post": {
				"summary": "Write the live suggestion's email again",
				"tags": [
					"dialer"
				],
				"description": "Asks Call AI to write the follow-up email for the suggestion's current version now, when it is missing or the last attempt failed; answers with the suggestion once the attempt settles. 409 CALL_SUGGESTION_CHANGED when the patient or version no longer match, or the suggestion was accepted; 409 CALL_EMAIL_WRITING while another attempt holds the lease; 409 CALL_EMAIL_NOT_DUE when no email is due (no settled outcome, no address, or email opted out). An attempt that fails answers 200 with `emailState: failed`. Requires patient:read and message:create; Smileline Voice in a Call AI country. Written to the audit log.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"expectedPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedPatientId",
									"version"
								]
							}
						}
					}
				},
				"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)$"
										},
										"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": [
												"ready",
												"listening",
												"none"
											]
										},
										"suggestion": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"version": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"outcome": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"considering",
																		"callback_later",
																		"booked",
																		"not_proceeding",
																		"going_ahead"
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"agreedDate": {
															"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"
																}
															]
														},
														"agreedTime": {
															"anyOf": [
																{
																	"type": "string",
																	"pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
																},
																{
																	"type": "null"
																}
															]
														},
														"whatsappTemplate": {
															"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"
																}
															]
														},
														"writtenEmail": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"subject": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 150
																		},
																		"body": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 3000
																		}
																	},
																	"required": [
																		"subject",
																		"body"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"emailState": {
															"type": "string",
															"enum": [
																"none",
																"writing",
																"ready",
																"failed"
															]
														},
														"emailLeaseUntil": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"lostReason": {
															"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)$"
																		},
																		"label": {
																			"type": "string"
																		},
																		"needsNote": {
																			"type": "boolean"
																		}
																	},
																	"required": [
																		"id",
																		"label",
																		"needsNote"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"treatment": {
															"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"
																		},
																		"priceCents": {
																			"anyOf": [
																				{
																					"type": "integer",
																					"minimum": 0,
																					"maximum": 9007199254740991
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"currency": {
																			"type": "string"
																		}
																	},
																	"required": [
																		"id",
																		"name",
																		"priceCents",
																		"currency"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"accepted": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"at": {
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		"byUserId": {
																			"anyOf": [
																				{
																					"type": "string",
																					"minLength": 1
																				},
																				{
																					"type": "null"
																				}
																			]
																		}
																	},
																	"required": [
																		"at",
																		"byUserId"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"updatedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														}
													},
													"required": [
														"version",
														"outcome",
														"agreedDate",
														"agreedTime",
														"whatsappTemplate",
														"writtenEmail",
														"emailState",
														"emailLeaseUntil",
														"lostReason",
														"treatment",
														"accepted",
														"updatedAt"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"sent": {
											"type": "object",
											"properties": {
												"whatsapp": {
													"anyOf": [
														{
															"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",
																	"enum": [
																		"queued",
																		"sent",
																		"delivered",
																		"read",
																		"failed"
																	]
																}
															},
															"required": [
																"messageId",
																"status"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"email": {
													"anyOf": [
														{
															"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",
																	"enum": [
																		"queued",
																		"sent",
																		"delivered",
																		"read",
																		"failed"
																	]
																}
															},
															"required": [
																"messageId",
																"status"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"whatsapp",
												"email"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"callLogId",
										"patientId",
										"status",
										"suggestion",
										"sent"
									],
									"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/calls/{id}/booking-draft": {
			"post": {
				"summary": "Draft the booking note from the call",
				"tags": [
					"dialer"
				],
				"description": "Call AI drafts the booking note and the caller's details from the call so far (2026-10-19): the practice's booking-note template (Settings → Call AI) with its empty `Label:` lines filled from the conversation and its tags filled by Smileline, after the deposit block when the patient has a deposit, plus the new patient's details as the caller gave them. Nothing is stored: the draft is answered only to the member who asked, and what they send with the booking is their own edit. `status: unreadable` when the model's answer could not be read: the note then holds only what Smileline fills, and every detail is null — ask again. 409 CALL_SUGGESTION_CHANGED when the call's patient is not `expectedPatientId`; 404 when the call is not a Call AI call, its conversation has expired, or its patient is erased; 503 AI_NOT_CONFIGURED. Requires patient:read and appointment:create; Smileline Voice in a Call AI country. Every draft is written to the audit log.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"expectedPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
											}
										]
									}
								},
								"required": [
									"expectedPatientId",
									"journeyId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"ready",
												"unreadable"
											]
										},
										"note": {
											"type": "string",
											"maxLength": 2000
										},
										"answers": {
											"type": "object",
											"propertyNames": {
												"type": "string"
											},
											"additionalProperties": {
												"type": "string",
												"maxLength": 300
											}
										},
										"patient": {
											"type": "object",
											"properties": {
												"title": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"Mr",
																"Mrs",
																"Miss",
																"Ms",
																"Dr",
																"Master",
																"Prof",
																"Hon",
																"Rev",
																"Sir",
																"Lady",
																"Lord",
																"Earl",
																"Judge",
																"Dame"
															]
														},
														{
															"type": "null"
														}
													]
												},
												"firstName": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 100
														},
														{
															"type": "null"
														}
													]
												},
												"lastName": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 100
														},
														{
															"type": "null"
														}
													]
												},
												"sex": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"male",
																"female"
															]
														},
														{
															"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"
														}
													]
												},
												"addressLine1": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 200
														},
														{
															"type": "null"
														}
													]
												},
												"postalCode": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 20
														},
														{
															"type": "null"
														}
													]
												},
												"phoneMobile": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 32
														},
														{
															"type": "null"
														}
													]
												},
												"email": {
													"anyOf": [
														{
															"type": "string",
															"maxLength": 254,
															"format": "email",
															"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"title",
												"firstName",
												"lastName",
												"sex",
												"dateOfBirth",
												"addressLine1",
												"postalCode",
												"phoneMobile",
												"email"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"status",
										"note",
										"answers",
										"patient"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/voice/calls/{id}/assist": {
			"get": {
				"summary": "The live suggestions of a call",
				"tags": [
					"voice"
				],
				"description": "The newest transcript lines and the suggestion cards of a live or recent call, for the desktop call window. Only the call's handler or dialer:manage; every read is written to the audit log. 404 for a call out of Call AI scope.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/CallAssistSnapshot"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/practice-facts": {
			"get": {
				"summary": "The practice facts Call AI answers callers from",
				"tags": [
					"voice"
				],
				"description": "The short answers and details Call AI's live suggestions show, where each came from, the build status, the knowledge sources they were built from, and the topics callers asked about with nothing on file. Requires dialer:use.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CallPracticeFacts"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Save the practice facts",
				"tags": [
					"voice"
				],
				"description": "Replaces the practice facts; a changed or new answer is marked as the practice's own and a rebuild never replaces it. Requires dialer:manage; written to the audit log. 400 when the facts would exceed the document size bound. 409 VERSION_CONFLICT when they changed since `version` (reload and reapply), or while a build is running.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"facts": {
										"type": "object",
										"properties": {
											"v": {
												"type": "number",
												"const": 2
											},
											"facts": {
												"type": "object",
												"propertyNames": {
													"type": "string",
													"pattern": "^[a-z][a-z_]{0,30}(:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?$"
												},
												"additionalProperties": {
													"oneOf": [
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "answer"
																},
																"topic": {
																	"type": "string",
																	"enum": [
																		"entrance",
																		"visits",
																		"treatment_time",
																		"consultation_fee",
																		"finance_eligibility",
																		"payment_methods",
																		"offers",
																		"membership",
																		"insurance_claims",
																		"what_is",
																		"pain",
																		"recovery",
																		"eating",
																		"longevity",
																		"suitability",
																		"temporary_teeth",
																		"materials",
																		"before_after",
																		"experience",
																		"accreditation",
																		"second_opinion",
																		"medical_form",
																		"confirmation",
																		"bring_someone",
																		"children",
																		"new_patients",
																		"video_consult"
																	]
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"headline": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 24
																				},
																				"line": {
																					"anyOf": [
																						{
																							"type": "string",
																							"minLength": 1,
																							"maxLength": 100
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"headline",
																				"line"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"topic",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "steps"
																},
																"topic": {
																	"type": "string",
																	"enum": [
																		"included",
																		"aftercare",
																		"consultation",
																		"what_to_bring"
																	]
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"items": {
																					"minItems": 1,
																					"maxItems": 4,
																					"type": "array",
																					"items": {
																						"type": "string",
																						"minLength": 1,
																						"maxLength": 60
																					}
																				}
																			},
																			"required": [
																				"items"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"topic",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "parking"
																},
																"value": {
																	"anyOf": [
																		{
																			"minItems": 1,
																			"maxItems": 3,
																			"type": "array",
																			"items": {
																				"type": "object",
																				"properties": {
																					"name": {
																						"type": "string",
																						"minLength": 1,
																						"maxLength": 60
																					},
																					"walkMinutes": {
																						"anyOf": [
																							{
																								"type": "integer",
																								"minimum": 0,
																								"maximum": 60
																							},
																							{
																								"type": "null"
																							}
																						]
																					},
																					"priceMinor": {
																						"anyOf": [
																							{
																								"type": "integer",
																								"minimum": 0,
																								"maximum": 100000
																							},
																							{
																								"type": "null"
																							}
																						]
																					},
																					"per": {
																						"anyOf": [
																							{
																								"type": "string",
																								"enum": [
																									"hour",
																									"day",
																									"visit"
																								]
																							},
																							{
																								"type": "null"
																							}
																						]
																					},
																					"free": {
																						"type": "boolean"
																					}
																				},
																				"required": [
																					"name",
																					"walkMinutes",
																					"priceMinor",
																					"per",
																					"free"
																				]
																			}
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "transport"
																},
																"value": {
																	"anyOf": [
																		{
																			"minItems": 1,
																			"maxItems": 6,
																			"type": "array",
																			"items": {
																				"type": "object",
																				"properties": {
																					"kind": {
																						"type": "string",
																						"enum": [
																							"rail",
																							"underground",
																							"tram",
																							"bus"
																						]
																					},
																					"name": {
																						"type": "string",
																						"minLength": 1,
																						"maxLength": 60
																					},
																					"lines": {
																						"anyOf": [
																							{
																								"type": "string",
																								"minLength": 1,
																								"maxLength": 60
																							},
																							{
																								"type": "null"
																							}
																						]
																					},
																					"walkMinutes": {
																						"anyOf": [
																							{
																								"type": "integer",
																								"minimum": 0,
																								"maximum": 60
																							},
																							{
																								"type": "null"
																							}
																						]
																					}
																				},
																				"required": [
																					"kind",
																					"name",
																					"lines",
																					"walkMinutes"
																				]
																			}
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "access"
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"stepFree": {
																					"type": [
																						"boolean",
																						"null"
																					]
																				},
																				"note": {
																					"anyOf": [
																						{
																							"type": "string",
																							"minLength": 1,
																							"maxLength": 100
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"stepFree",
																				"note"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "finance"
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"provider": {
																					"anyOf": [
																						{
																							"type": "string",
																							"minLength": 1,
																							"maxLength": 60
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"aprPercent": {
																					"anyOf": [
																						{
																							"type": "number",
																							"minimum": 0,
																							"maximum": 99.9
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"months": {
																					"maxItems": 6,
																					"type": "array",
																					"items": {
																						"type": "integer",
																						"minimum": 1,
																						"maximum": 120
																					}
																				},
																				"minDepositMinor": {
																					"anyOf": [
																						{
																							"type": "integer",
																							"minimum": 0,
																							"maximum": 9007199254740991
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"provider",
																				"aprPercent",
																				"months",
																				"minDepositMinor"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "cancellation"
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"noticeHours": {
																					"type": "integer",
																					"minimum": 0,
																					"maximum": 720
																				}
																			},
																			"required": [
																				"noticeHours"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "guarantee"
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"years": {
																					"type": "integer",
																					"minimum": 1,
																					"maximum": 50
																				}
																			},
																			"required": [
																				"years"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "languages"
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"names": {
																					"minItems": 1,
																					"maxItems": 12,
																					"type": "array",
																					"items": {
																						"type": "string",
																						"minLength": 1,
																						"maxLength": 30
																					}
																				}
																			},
																			"required": [
																				"names"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														},
														{
															"type": "object",
															"properties": {
																"kind": {
																	"type": "string",
																	"const": "dentist"
																},
																"value": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"headline": {
																					"anyOf": [
																						{
																							"type": "string",
																							"minLength": 1,
																							"maxLength": 80
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"years": {
																					"anyOf": [
																						{
																							"type": "integer",
																							"minimum": 0,
																							"maximum": 70
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"specialties": {
																					"maxItems": 6,
																					"type": "array",
																					"items": {
																						"type": "string",
																						"minLength": 1,
																						"maxLength": 40
																					}
																				}
																			},
																			"required": [
																				"headline",
																				"years",
																				"specialties"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"by": {
																	"type": "string",
																	"enum": [
																		"smileline",
																		"practice"
																	]
																},
																"source": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"kind": {
																					"type": "string",
																					"enum": [
																						"website",
																						"document",
																						"pitch",
																						"practice"
																					]
																				},
																				"label": {
																					"type": "string",
																					"minLength": 1,
																					"maxLength": 120
																				},
																				"url": {
																					"anyOf": [
																						{
																							"type": "string",
																							"maxLength": 2048,
																							"format": "uri"
																						},
																						{
																							"type": "null"
																						}
																					]
																				}
																			},
																			"required": [
																				"kind",
																				"label",
																				"url"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"at": {
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																}
															},
															"required": [
																"kind",
																"value",
																"by",
																"source",
																"at"
															]
														}
													]
												}
											}
										},
										"required": [
											"v",
											"facts"
										]
									}
								},
								"required": [
									"version",
									"facts"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CallPracticeFacts"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/voice/practice-facts/generate": {
			"post": {
				"summary": "Rebuild the practice facts",
				"tags": [
					"voice"
				],
				"description": "Starts one build of the practice facts from the practice's website and knowledge base and its sales pitch. The practice's own answers are kept. Requires dialer:manage; written to the audit log. 409 while one is already running.",
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CallPracticeFacts"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/call-objections": {
			"get": {
				"summary": "The practice's objection list",
				"tags": [
					"voice"
				],
				"description": "The practice's changes to Smileline's objection list, its reply to each objection, the facts build status, and the objections callers raised with no reply on file. Requires dialer:use.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CallObjections"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Save the practice's objection list",
				"tags": [
					"voice"
				],
				"description": "Replaces the practice's objection list; a changed or new reply is marked as the practice's own and a rebuild never replaces it. null restores Smileline's list. Requires dialer:manage; written to the audit log. 400 when the list is too large to save or to offer live on a call. 409 VERSION_CONFLICT when it changed since `version` (reload and reapply), or while a build is running.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"version": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"objections": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"v": {
														"type": "number",
														"const": 1
													},
													"entries": {
														"type": "object",
														"propertyNames": {
															"type": "string"
														},
														"additionalProperties": {
															"type": "object",
															"properties": {
																"name": {
																	"anyOf": [
																		{
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 40
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"hidden": {
																	"type": "boolean"
																},
																"reply": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"line": {
																					"anyOf": [
																						{
																							"type": "string",
																							"minLength": 1,
																							"maxLength": 120
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"by": {
																					"type": "string",
																					"enum": [
																						"smileline",
																						"practice"
																					]
																				},
																				"source": {
																					"anyOf": [
																						{
																							"type": "object",
																							"properties": {
																								"kind": {
																									"type": "string",
																									"enum": [
																										"website",
																										"document",
																										"pitch",
																										"practice"
																									]
																								},
																								"label": {
																									"type": "string",
																									"minLength": 1,
																									"maxLength": 120
																								},
																								"url": {
																									"anyOf": [
																										{
																											"type": "string",
																											"maxLength": 2048,
																											"format": "uri"
																										},
																										{
																											"type": "null"
																										}
																									]
																								}
																							},
																							"required": [
																								"kind",
																								"label",
																								"url"
																							]
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"at": {
																					"type": "string",
																					"format": "date-time",
																					"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																				}
																			},
																			"required": [
																				"line",
																				"by",
																				"source",
																				"at"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"required": [
																"name",
																"hidden",
																"reply"
															]
														}
													},
													"own": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"key": {
																	"type": "string",
																	"pattern": "^own_[a-z]{8}$"
																},
																"group": {
																	"type": "string",
																	"enum": [
																		"money",
																		"cover",
																		"timing",
																		"decision",
																		"fear",
																		"trust",
																		"treatment",
																		"getting_here",
																		"the_call"
																	]
																},
																"name": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 40
																},
																"reply": {
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"line": {
																					"anyOf": [
																						{
																							"type": "string",
																							"minLength": 1,
																							"maxLength": 120
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"by": {
																					"type": "string",
																					"enum": [
																						"smileline",
																						"practice"
																					]
																				},
																				"source": {
																					"anyOf": [
																						{
																							"type": "object",
																							"properties": {
																								"kind": {
																									"type": "string",
																									"enum": [
																										"website",
																										"document",
																										"pitch",
																										"practice"
																									]
																								},
																								"label": {
																									"type": "string",
																									"minLength": 1,
																									"maxLength": 120
																								},
																								"url": {
																									"anyOf": [
																										{
																											"type": "string",
																											"maxLength": 2048,
																											"format": "uri"
																										},
																										{
																											"type": "null"
																										}
																									]
																								}
																							},
																							"required": [
																								"kind",
																								"label",
																								"url"
																							]
																						},
																						{
																							"type": "null"
																						}
																					]
																				},
																				"at": {
																					"type": "string",
																					"format": "date-time",
																					"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																				}
																			},
																			"required": [
																				"line",
																				"by",
																				"source",
																				"at"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"required": [
																"key",
																"group",
																"name",
																"reply"
															]
														}
													}
												},
												"required": [
													"v",
													"entries",
													"own"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"version",
									"objections"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CallObjections"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/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. A `handset` (physical SIP desk phone) is added by a dialer:manage member for any member who can call, `userId` naming them (403 otherwise; 422 MEMBER_CANNOT_CALL when that member's role lacks dialer:use): it gets its own credential connection, revealed with GET /voice/endpoints/:id/credentials. A SHARED handset (a reception phone that belongs to no member) is added with `shared` instead: its name is the idempotency key while it is live (the same name returns the same phone; 409 SHARED_PHONE_NAME_TAKEN when that name is live at another location), it is placed at `shared.locationId` and gets the lowest free extension.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"deviceKind": {
										"type": "string",
										"enum": [
											"browser",
											"desktop",
											"mobile",
											"extension",
											"handset"
										]
									},
									"reenable": {
										"type": "boolean"
									},
									"userId": {
										"type": "string"
									},
									"shared": {
										"type": "object",
										"properties": {
											"name": {
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											"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": [
											"name",
											"locationId"
										]
									}
								},
								"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			},
			"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. A desk handset has no token (422 HANDSET_HAS_NO_TOKEN): it registers with its revealed SIP credentials.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
								}
							}
						}
					},
					"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/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; a dialer:manage member may also set a desk handset's. 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. For a handset it is also the location whose registered number the phone dials out as — moving the phone means changing this.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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/endpoints/{id}/extension": {
			"put": {
				"summary": "Set a shared desk phone's keypad extension",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. Shared desk phones only (a member's extension is set on the Team page). Three digits (100–999), unique across the practice's members and shared phones; null assigns the lowest free one (409 when none is free), an empty string clears it. 409 EXTENSION_TAKEN when it is in use.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"extension": {
										"anyOf": [
											{
												"anyOf": [
													{
														"type": "string",
														"pattern": "^[1-9][0-9]{2}$"
													},
													{
														"type": "null"
													}
												]
											},
											{
												"type": "string",
												"const": ""
											}
										]
									}
								},
								"required": [
									"extension"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/endpoints/{id}/credentials": {
			"get": {
				"summary": "Reveal a desk handset's SIP credentials",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. Returns the registration triple the phone needs (server, username, password) for an active handset endpoint, and `setupUrl`, the handset's permanent setup link a phone's Auto Provision fetches instead (it stops working when the handset is removed). Every reveal is audit-logged and rate-limited. 404 for any other endpoint.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
										},
										"setupUrl": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"server",
										"username",
										"password",
										"setupUrl"
									],
									"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"
								}
							}
						}
					},
					"429": {
						"description": "Too Many Requests",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/endpoints/{id}/registration": {
			"get": {
				"summary": "Whether a desk handset is currently registered",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. One live read of the handset's credential connection registration. `unknown` when the provider has not confirmed a state or the endpoint is not active.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/endpoints/{id}/outbound": {
			"post": {
				"summary": "Switch a desk handset's keypad dial-out back on",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. Dial-out is on from the moment a handset is added; this undoes a manager's switch-off. The caller ID is the emergency-registered number of the handset's location; `outboundAni` stays null (with `outboundSyncError` saying why) until that location has one. The carrier update is fenced and reconciled hourly.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Switch a desk handset's keypad dial-out off",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. The handset keeps receiving calls; its outbound profile and caller ID are detached at the carrier (fenced, reconciled hourly).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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}/outbound-number": {
			"post": {
				"summary": "Choose the number a desk handset dials out as",
				"tags": [
					"voice"
				],
				"description": "dialer:manage. The number must be registered for emergency calls at the handset's location (GET /voice/caller-ids `registeredLocationId`), since every keypad call presents it, 999/112/911 included; otherwise 409 NUMBER_NOT_REGISTERED_AT_LOCATION. If it later stops qualifying (moved, released, a desk-phone line) the handset falls back to the location's oldest registered number; moving the handset clears the choice. The carrier update is fenced and reconciled hourly.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"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)$"
									}
								},
								"required": [
									"numberId"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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, and the practice's active shared desk phones (listed under their endpoint id and name). 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. `closer` (team calling) says whether this device is Ready for hand-offs — while the team view is open on a computer and no outcome is owed; a beat without it (or with false) is not Ready; the switchboard keeps it in memory only and heals it within one beat. A closer flip skips the presence rate bucket like an availability flip (abuse worst case about $117 a month, memory only: no limiter). 403 when a member who is not a closer sends `closer: true`; 422 CLOSER_DEVICE_UNSUPPORTED from a device that cannot answer by itself (a phone or a desk handset).",
				"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"
									},
									"closer": {
										"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/calls/mine/active": {
			"get": {
				"summary": "The caller's live router-owned call, if any",
				"tags": [
					"voice"
				],
				"description": "dialer:use. What the handset call bar hydrates from on page load or reconnect: the call the caller is currently on (answered on any of their devices), whether it is held, whether the app may command it, and which device answered. Null when the caller is not on a call. For a dialer:manage caller, `sharedCalls` also lists the live calls held by the practice's shared desk phones, for the managers' shared-phone call bars (always empty otherwise).",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"call": {
											"anyOf": [
												{
													"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)$"
														},
														"held": {
															"type": "boolean"
														},
														"controllable": {
															"type": "boolean"
														},
														"winnerDeviceKind": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"browser",
																		"desktop",
																		"mobile",
																		"extension",
																		"handset"
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"fromNumber": {
															"type": [
																"string",
																"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"
																}
															]
														},
														"patientName": {
															"type": [
																"string",
																"null"
															]
														},
														"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"
																}
															]
														},
														"reachedVoicemail": {
															"type": "boolean"
														},
														"recording": {
															"type": "object",
															"properties": {
																"paused": {
																	"type": "boolean"
																},
																"resumesAt": {
																	"anyOf": [
																		{
																			"type": "string",
																			"format": "date-time",
																			"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"failed": {
																	"type": "boolean"
																},
																"rev": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"paused",
																"resumesAt",
																"failed",
																"rev"
															],
															"additionalProperties": false
														},
														"handoff": {
															"type": "object",
															"properties": {
																"seq": {
																	"type": "integer",
																	"exclusiveMinimum": 0,
																	"maximum": 9007199254740991
																},
																"fromUserId": {
																	"type": "string"
																},
																"note": {
																	"type": "string"
																}
															},
															"required": [
																"seq",
																"fromUserId",
																"note"
															],
															"additionalProperties": false
														}
													},
													"required": [
														"callLogId",
														"held",
														"controllable",
														"winnerDeviceKind",
														"fromNumber",
														"patientId",
														"patientName"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"sharedCalls": {
											"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)$"
													},
													"held": {
														"type": "boolean"
													},
													"controllable": {
														"type": "boolean"
													},
													"winnerDeviceKind": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"browser",
																	"desktop",
																	"mobile",
																	"extension",
																	"handset"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"fromNumber": {
														"type": [
															"string",
															"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"
															}
														]
													},
													"patientName": {
														"type": [
															"string",
															"null"
														]
													},
													"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"
															}
														]
													},
													"reachedVoicemail": {
														"type": "boolean"
													},
													"recording": {
														"type": "object",
														"properties": {
															"paused": {
																"type": "boolean"
															},
															"resumesAt": {
																"anyOf": [
																	{
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"failed": {
																"type": "boolean"
															},
															"rev": {
																"type": "integer",
																"minimum": 0,
																"maximum": 9007199254740991
															}
														},
														"required": [
															"paused",
															"resumesAt",
															"failed",
															"rev"
														],
														"additionalProperties": false
													},
													"handoff": {
														"type": "object",
														"properties": {
															"seq": {
																"type": "integer",
																"exclusiveMinimum": 0,
																"maximum": 9007199254740991
															},
															"fromUserId": {
																"type": "string"
															},
															"note": {
																"type": "string"
															}
														},
														"required": [
															"seq",
															"fromUserId",
															"note"
														],
														"additionalProperties": false
													},
													"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)$"
													},
													"endpointName": {
														"type": "string"
													}
												},
												"required": [
													"callLogId",
													"held",
													"controllable",
													"winnerDeviceKind",
													"fromNumber",
													"patientId",
													"patientName",
													"endpointId",
													"endpointName"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"call",
										"sharedCalls"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/occupancy": {
			"get": {
				"summary": "Who is on a call right now",
				"tags": [
					"voice"
				],
				"description": "The live activity strip's starting point (team calling): every member of the practice dialling or on a call now, and the patient of that call — read from the switchboard's own call occupancy, so a phone call that goes on while the app is in the background still shows. Read on load and reconnect; the `voice.call.*` events keep it current after. Write-free. For a member who may open Today.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"members": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/VoiceOccupancyMember"
											}
										}
									},
									"required": [
										"members"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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. Without `numberId` the call presents, in order: the ticked rotation number this patient saw least recently (never on an emergency, WhatsApp or no-patient call), the number routed to the caller's own location, the practice default. 409 ALL_LINES_BUSY when every line is in use or reserved; 409 ALREADY_PLACING while the caller's previous call is still being set up (their device or the far end ringing); 409 HANDOFF_INCOMING, with nothing rung or written, while a hand-off is on its way to the caller (an emergency call is still placed); 409 CALLING_PAUSED, with nothing read for the call, written or rung, for an Auto-call dial (`origin` auto) from a member with a team-calling role who is not Calling (on a break, stopped or clocked out) — a person's own dial and an emergency call are never refused for it; 409 NO_REGISTERED_ENDPOINT until the caller enables calling on a device; 409 STATE_CALL_LIMIT (`details`: stateCallLimitDetails) when the call would be the person's 4th dial inside 24 hours in a state whose law caps sales calls — only to a client that sent `stateLimitConfirm`, which resends with `confirmStateLimit` once the person confirms; a client that did not send it is never refused for it; 422 DESTINATION_NOT_ALLOWED outside the domestic policy; 422 PATIENT_OPTED_OUT, with nothing rung or billed, when the named patient asked not to be called (their record's phone opt-out or phone contact preference).",
				"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"
											}
										]
									},
									"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"
											}
										]
									},
									"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",
											"handset"
										]
									},
									"via": {
										"type": "string",
										"const": "whatsapp"
									},
									"stateLimitConfirm": {
										"type": "boolean",
										"const": true
									},
									"confirmStateLimit": {
										"type": "boolean",
										"const": true
									},
									"origin": {
										"type": "string",
										"const": "auto"
									}
								},
								"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)$"
										},
										"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"
												}
											]
										}
									},
									"required": [
										"callLogId",
										"numberId"
									],
									"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, hand off, 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. A blind transfer sent with `returnCapable: true` rings the sender again when the target does not answer, and then offers the caller voicemail. `handoff` (team calling) hands a patient's call to a free closer the switchboard picks — only a member whose Team role is closer now, never one whose role was removed since their last Ready beat; between calls first, then one still ringing out (that ring is cut, and is no try), the longest waiting first — whose computer answers by itself; the closer's open lead moves to them once it connects (`voice.call.handoff_connected`), and if every closer fails the call comes back to the sender, then voicemail, and the closers get a promised call-back. 409 NO_CLOSER_READY, with nothing written, when no closer is free (promise a call-back instead: POST /tasks/:id/outcome with `followUp.forClosers`). `transfer-voicemail` works on inbound and outbound calls. `decline` (a ringing inbound call, sent by a member it is ringing with the `stage` their device rang for) stops every device ringing and sends the call on as if nobody answered — the overflow step, else voicemail; 409 when the call was answered, moved on or ended meanwhile. The call recording pauses by itself while a card is read out (`voice.call.recording`); there is no command for 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": {
								"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"
												]
											},
											"returnCapable": {
												"type": "boolean"
											}
										},
										"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": "hangup"
											}
										},
										"required": [
											"kind"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "decline"
											},
											"stage": {
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											}
										},
										"required": [
											"kind",
											"stage"
										]
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "handoff"
											},
											"note": {
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											"returnCapable": {
												"type": "boolean"
											}
										},
										"required": [
											"kind",
											"note"
										]
									}
								]
							}
						}
					}
				},
				"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 message's own audio, 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": {
											"type": [
												"string",
												"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 — its own recording, or the call's when the call's recording IS the message (a call nobody answered) — gated like the inbox (calling access) rather than dialer:media, so every role that can see a message can hear it; a call's conversation never plays here, and 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/voicemails/{id}/audio/link": {
			"post": {
				"summary": "Create a voicemail play link",
				"tags": [
					"voice"
				],
				"description": "Mints a private, Range-capable link to the message's stored MP3, gated like GET /voice/voicemails/{id}/audio (calling access) and valid for 15 minutes or twice the message's length, whichever is longer. The listen is written to the audit log once, here — requests to the link itself are not audited again. 404 when there is no stored recording to link; stream those from the GET route.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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",
											"format": "uri"
										},
										"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": [
										"url",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/voice/routing": {
			"get": {
				"summary": "Routing overview: numbers, their configs, ring groups, closures, and where calls go",
				"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"
											}
										},
										"devices": {
											"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)$"
													},
													"userId": {
														"type": [
															"string",
															"null"
														]
													},
													"name": {
														"type": [
															"string",
															"null"
														]
													},
													"extension": {
														"type": [
															"string",
															"null"
														]
													},
													"deviceKind": {
														"type": "string",
														"enum": [
															"browser",
															"desktop",
															"mobile",
															"extension",
															"handset"
														]
													},
													"ring": {
														"type": "string",
														"enum": [
															"rings",
															"setting_up",
															"do_not_disturb",
															"mobile_idle"
														]
													}
												},
												"required": [
													"id",
													"userId",
													"name",
													"extension",
													"deviceKind",
													"ring"
												],
												"additionalProperties": false
											}
										},
										"tracking": {
											"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": [
															"pool",
															"static"
														]
													},
													"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"
															}
														]
													},
													"numbers": {
														"type": "array",
														"items": {
															"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"
																},
																"status": {
																	"type": "string",
																	"enum": [
																		"active",
																		"parked"
																	]
																}
															},
															"required": [
																"numberId",
																"e164",
																"status"
															],
															"additionalProperties": false
														}
													},
													"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"
															}
														]
													},
													"flow": {
														"oneOf": [
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "desk_line"
																	},
																	"status": {
																		"type": "string",
																		"enum": [
																			"provisioning",
																			"active",
																			"disabling"
																		]
																	}
																},
																"required": [
																	"kind",
																	"status"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "porting_unrouted"
																	}
																},
																"required": [
																	"kind"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "default"
																	},
																	"siteSkipped": {
																		"type": "boolean"
																	},
																	"siteRoster": {
																		"type": "array",
																		"items": {
																			"type": "string"
																		}
																	},
																	"steps": {
																		"type": "array",
																		"items": {
																			"oneOf": [
																				{
																					"type": "object",
																					"properties": {
																						"kind": {
																							"type": "string",
																							"const": "ring"
																						},
																						"target": {
																							"type": "string",
																							"enum": [
																								"group",
																								"site",
																								"everyone"
																							]
																						},
																						"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"
																								}
																							]
																						},
																						"groupName": {
																							"type": [
																								"string",
																								"null"
																							]
																						},
																						"timeoutSec": {
																							"type": "integer",
																							"minimum": -9007199254740991,
																							"maximum": 9007199254740991
																						},
																						"people": {
																							"type": "array",
																							"items": {
																								"type": "string"
																							}
																						},
																						"earlierEndpoints": {
																							"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",
																						"target",
																						"ringGroupId",
																						"groupName",
																						"timeoutSec",
																						"people",
																						"earlierEndpoints"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "object",
																					"properties": {
																						"kind": {
																							"type": "string",
																							"const": "forward"
																						},
																						"to": {
																							"type": "string"
																						},
																						"presentCallerId": {
																							"type": "string",
																							"enum": [
																								"caller",
																								"practice"
																							]
																						},
																						"timeoutSec": {
																							"type": "integer",
																							"minimum": -9007199254740991,
																							"maximum": 9007199254740991
																						},
																						"refused": {
																							"type": "boolean"
																						}
																					},
																					"required": [
																						"kind",
																						"to",
																						"presentCallerId",
																						"timeoutSec",
																						"refused"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "object",
																					"properties": {
																						"kind": {
																							"type": "string",
																							"const": "announce"
																						},
																						"text": {
																							"type": "string"
																						}
																					},
																					"required": [
																						"kind",
																						"text"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "object",
																					"properties": {
																						"kind": {
																							"type": "string",
																							"const": "voicemail"
																						}
																					},
																					"required": [
																						"kind"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "object",
																					"properties": {
																						"kind": {
																							"type": "string",
																							"const": "notice"
																						}
																					},
																					"required": [
																						"kind"
																					],
																					"additionalProperties": false
																				}
																			]
																		}
																	}
																},
																"required": [
																	"kind",
																	"siteSkipped",
																	"siteRoster",
																	"steps"
																],
																"additionalProperties": false
															},
															{
																"type": "object",
																"properties": {
																	"kind": {
																		"type": "string",
																		"const": "routed"
																	},
																	"hours": {
																		"type": "object",
																		"properties": {
																			"mode": {
																				"type": "string",
																				"enum": [
																					"location",
																					"always_open",
																					"custom"
																				]
																			},
																			"openNow": {
																				"type": "boolean"
																			},
																			"noHours": {
																				"type": "boolean"
																			},
																			"locationName": {
																				"type": [
																					"string",
																					"null"
																				]
																			}
																		},
																		"required": [
																			"mode",
																			"openNow",
																			"noHours",
																			"locationName"
																		],
																		"additionalProperties": false
																	},
																	"blocked": {
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	},
																	"withheldToVoicemail": {
																		"type": "boolean"
																	},
																	"open": {
																		"oneOf": [
																			{
																				"type": "object",
																				"properties": {
																					"kind": {
																						"type": "string",
																						"const": "steps"
																					},
																					"steps": {
																						"type": "array",
																						"items": {
																							"oneOf": [
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "ring"
																										},
																										"target": {
																											"type": "string",
																											"enum": [
																												"group",
																												"site",
																												"everyone"
																											]
																										},
																										"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"
																												}
																											]
																										},
																										"groupName": {
																											"type": [
																												"string",
																												"null"
																											]
																										},
																										"timeoutSec": {
																											"type": "integer",
																											"minimum": -9007199254740991,
																											"maximum": 9007199254740991
																										},
																										"people": {
																											"type": "array",
																											"items": {
																												"type": "string"
																											}
																										},
																										"earlierEndpoints": {
																											"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",
																										"target",
																										"ringGroupId",
																										"groupName",
																										"timeoutSec",
																										"people",
																										"earlierEndpoints"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "forward"
																										},
																										"to": {
																											"type": "string"
																										},
																										"presentCallerId": {
																											"type": "string",
																											"enum": [
																												"caller",
																												"practice"
																											]
																										},
																										"timeoutSec": {
																											"type": "integer",
																											"minimum": -9007199254740991,
																											"maximum": 9007199254740991
																										},
																										"refused": {
																											"type": "boolean"
																										}
																									},
																									"required": [
																										"kind",
																										"to",
																										"presentCallerId",
																										"timeoutSec",
																										"refused"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "announce"
																										},
																										"text": {
																											"type": "string"
																										}
																									},
																									"required": [
																										"kind",
																										"text"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "voicemail"
																										}
																									},
																									"required": [
																										"kind"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "notice"
																										}
																									},
																									"required": [
																										"kind"
																									],
																									"additionalProperties": false
																								}
																							]
																						}
																					}
																				},
																				"required": [
																					"kind",
																					"steps"
																				],
																				"additionalProperties": false
																			},
																			{
																				"type": "object",
																				"properties": {
																					"kind": {
																						"type": "string",
																						"const": "menu"
																					},
																					"prompt": {
																						"type": "string"
																					},
																					"attempts": {
																						"type": "integer",
																						"minimum": -9007199254740991,
																						"maximum": 9007199254740991
																					},
																					"options": {
																						"type": "array",
																						"items": {
																							"type": "object",
																							"properties": {
																								"digit": {
																									"type": "string"
																								},
																								"leadPath": {
																									"type": "boolean"
																								},
																								"steps": {
																									"type": "array",
																									"items": {
																										"oneOf": [
																											{
																												"type": "object",
																												"properties": {
																													"kind": {
																														"type": "string",
																														"const": "ring"
																													},
																													"target": {
																														"type": "string",
																														"enum": [
																															"group",
																															"site",
																															"everyone"
																														]
																													},
																													"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"
																															}
																														]
																													},
																													"groupName": {
																														"type": [
																															"string",
																															"null"
																														]
																													},
																													"timeoutSec": {
																														"type": "integer",
																														"minimum": -9007199254740991,
																														"maximum": 9007199254740991
																													},
																													"people": {
																														"type": "array",
																														"items": {
																															"type": "string"
																														}
																													},
																													"earlierEndpoints": {
																														"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",
																													"target",
																													"ringGroupId",
																													"groupName",
																													"timeoutSec",
																													"people",
																													"earlierEndpoints"
																												],
																												"additionalProperties": false
																											},
																											{
																												"type": "object",
																												"properties": {
																													"kind": {
																														"type": "string",
																														"const": "forward"
																													},
																													"to": {
																														"type": "string"
																													},
																													"presentCallerId": {
																														"type": "string",
																														"enum": [
																															"caller",
																															"practice"
																														]
																													},
																													"timeoutSec": {
																														"type": "integer",
																														"minimum": -9007199254740991,
																														"maximum": 9007199254740991
																													},
																													"refused": {
																														"type": "boolean"
																													}
																												},
																												"required": [
																													"kind",
																													"to",
																													"presentCallerId",
																													"timeoutSec",
																													"refused"
																												],
																												"additionalProperties": false
																											},
																											{
																												"type": "object",
																												"properties": {
																													"kind": {
																														"type": "string",
																														"const": "announce"
																													},
																													"text": {
																														"type": "string"
																													}
																												},
																												"required": [
																													"kind",
																													"text"
																												],
																												"additionalProperties": false
																											},
																											{
																												"type": "object",
																												"properties": {
																													"kind": {
																														"type": "string",
																														"const": "voicemail"
																													}
																												},
																												"required": [
																													"kind"
																												],
																												"additionalProperties": false
																											},
																											{
																												"type": "object",
																												"properties": {
																													"kind": {
																														"type": "string",
																														"const": "notice"
																													}
																												},
																												"required": [
																													"kind"
																												],
																												"additionalProperties": false
																											}
																										]
																									}
																								}
																							},
																							"required": [
																								"digit",
																								"leadPath",
																								"steps"
																							],
																							"additionalProperties": false
																						}
																					},
																					"noChoice": {
																						"type": "array",
																						"items": {
																							"oneOf": [
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "ring"
																										},
																										"target": {
																											"type": "string",
																											"enum": [
																												"group",
																												"site",
																												"everyone"
																											]
																										},
																										"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"
																												}
																											]
																										},
																										"groupName": {
																											"type": [
																												"string",
																												"null"
																											]
																										},
																										"timeoutSec": {
																											"type": "integer",
																											"minimum": -9007199254740991,
																											"maximum": 9007199254740991
																										},
																										"people": {
																											"type": "array",
																											"items": {
																												"type": "string"
																											}
																										},
																										"earlierEndpoints": {
																											"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",
																										"target",
																										"ringGroupId",
																										"groupName",
																										"timeoutSec",
																										"people",
																										"earlierEndpoints"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "forward"
																										},
																										"to": {
																											"type": "string"
																										},
																										"presentCallerId": {
																											"type": "string",
																											"enum": [
																												"caller",
																												"practice"
																											]
																										},
																										"timeoutSec": {
																											"type": "integer",
																											"minimum": -9007199254740991,
																											"maximum": 9007199254740991
																										},
																										"refused": {
																											"type": "boolean"
																										}
																									},
																									"required": [
																										"kind",
																										"to",
																										"presentCallerId",
																										"timeoutSec",
																										"refused"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "announce"
																										},
																										"text": {
																											"type": "string"
																										}
																									},
																									"required": [
																										"kind",
																										"text"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "voicemail"
																										}
																									},
																									"required": [
																										"kind"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "notice"
																										}
																									},
																									"required": [
																										"kind"
																									],
																									"additionalProperties": false
																								}
																							]
																						}
																					},
																					"knownPatient": {
																						"anyOf": [
																							{
																								"type": "array",
																								"items": {
																									"oneOf": [
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "ring"
																												},
																												"target": {
																													"type": "string",
																													"enum": [
																														"group",
																														"site",
																														"everyone"
																													]
																												},
																												"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"
																														}
																													]
																												},
																												"groupName": {
																													"type": [
																														"string",
																														"null"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"people": {
																													"type": "array",
																													"items": {
																														"type": "string"
																													}
																												},
																												"earlierEndpoints": {
																													"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",
																												"target",
																												"ringGroupId",
																												"groupName",
																												"timeoutSec",
																												"people",
																												"earlierEndpoints"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "forward"
																												},
																												"to": {
																													"type": "string"
																												},
																												"presentCallerId": {
																													"type": "string",
																													"enum": [
																														"caller",
																														"practice"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"refused": {
																													"type": "boolean"
																												}
																											},
																											"required": [
																												"kind",
																												"to",
																												"presentCallerId",
																												"timeoutSec",
																												"refused"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "announce"
																												},
																												"text": {
																													"type": "string"
																												}
																											},
																											"required": [
																												"kind",
																												"text"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "voicemail"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "notice"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										}
																									]
																								}
																							},
																							{
																								"type": "null"
																							}
																						]
																					}
																				},
																				"required": [
																					"kind",
																					"prompt",
																					"attempts",
																					"options",
																					"noChoice",
																					"knownPatient"
																				],
																				"additionalProperties": false
																			},
																			{
																				"type": "object",
																				"properties": {
																					"kind": {
																						"type": "string",
																						"const": "ai"
																					},
																					"on": {
																						"type": "boolean"
																					},
																					"handoff": {
																						"anyOf": [
																							{
																								"type": "object",
																								"properties": {
																									"kind": {
																										"type": "string",
																										"const": "ring"
																									},
																									"target": {
																										"type": "string",
																										"enum": [
																											"group",
																											"site",
																											"everyone"
																										]
																									},
																									"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"
																											}
																										]
																									},
																									"groupName": {
																										"type": [
																											"string",
																											"null"
																										]
																									},
																									"timeoutSec": {
																										"type": "integer",
																										"minimum": -9007199254740991,
																										"maximum": 9007199254740991
																									},
																									"people": {
																										"type": "array",
																										"items": {
																											"type": "string"
																										}
																									},
																									"earlierEndpoints": {
																										"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",
																									"target",
																									"ringGroupId",
																									"groupName",
																									"timeoutSec",
																									"people",
																									"earlierEndpoints"
																								],
																								"additionalProperties": false
																							},
																							{
																								"type": "null"
																							}
																						]
																					},
																					"fallback": {
																						"type": "array",
																						"items": {
																							"oneOf": [
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "ring"
																										},
																										"target": {
																											"type": "string",
																											"enum": [
																												"group",
																												"site",
																												"everyone"
																											]
																										},
																										"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"
																												}
																											]
																										},
																										"groupName": {
																											"type": [
																												"string",
																												"null"
																											]
																										},
																										"timeoutSec": {
																											"type": "integer",
																											"minimum": -9007199254740991,
																											"maximum": 9007199254740991
																										},
																										"people": {
																											"type": "array",
																											"items": {
																												"type": "string"
																											}
																										},
																										"earlierEndpoints": {
																											"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",
																										"target",
																										"ringGroupId",
																										"groupName",
																										"timeoutSec",
																										"people",
																										"earlierEndpoints"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "forward"
																										},
																										"to": {
																											"type": "string"
																										},
																										"presentCallerId": {
																											"type": "string",
																											"enum": [
																												"caller",
																												"practice"
																											]
																										},
																										"timeoutSec": {
																											"type": "integer",
																											"minimum": -9007199254740991,
																											"maximum": 9007199254740991
																										},
																										"refused": {
																											"type": "boolean"
																										}
																									},
																									"required": [
																										"kind",
																										"to",
																										"presentCallerId",
																										"timeoutSec",
																										"refused"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "announce"
																										},
																										"text": {
																											"type": "string"
																										}
																									},
																									"required": [
																										"kind",
																										"text"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "voicemail"
																										}
																									},
																									"required": [
																										"kind"
																									],
																									"additionalProperties": false
																								},
																								{
																									"type": "object",
																									"properties": {
																										"kind": {
																											"type": "string",
																											"const": "notice"
																										}
																									},
																									"required": [
																										"kind"
																									],
																									"additionalProperties": false
																								}
																							]
																						}
																					}
																				},
																				"required": [
																					"kind",
																					"on",
																					"handoff",
																					"fallback"
																				],
																				"additionalProperties": false
																			}
																		]
																	},
																	"closed": {
																		"anyOf": [
																			{
																				"oneOf": [
																					{
																						"type": "object",
																						"properties": {
																							"kind": {
																								"type": "string",
																								"const": "steps"
																							},
																							"steps": {
																								"type": "array",
																								"items": {
																									"oneOf": [
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "ring"
																												},
																												"target": {
																													"type": "string",
																													"enum": [
																														"group",
																														"site",
																														"everyone"
																													]
																												},
																												"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"
																														}
																													]
																												},
																												"groupName": {
																													"type": [
																														"string",
																														"null"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"people": {
																													"type": "array",
																													"items": {
																														"type": "string"
																													}
																												},
																												"earlierEndpoints": {
																													"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",
																												"target",
																												"ringGroupId",
																												"groupName",
																												"timeoutSec",
																												"people",
																												"earlierEndpoints"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "forward"
																												},
																												"to": {
																													"type": "string"
																												},
																												"presentCallerId": {
																													"type": "string",
																													"enum": [
																														"caller",
																														"practice"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"refused": {
																													"type": "boolean"
																												}
																											},
																											"required": [
																												"kind",
																												"to",
																												"presentCallerId",
																												"timeoutSec",
																												"refused"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "announce"
																												},
																												"text": {
																													"type": "string"
																												}
																											},
																											"required": [
																												"kind",
																												"text"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "voicemail"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "notice"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										}
																									]
																								}
																							}
																						},
																						"required": [
																							"kind",
																							"steps"
																						],
																						"additionalProperties": false
																					},
																					{
																						"type": "object",
																						"properties": {
																							"kind": {
																								"type": "string",
																								"const": "menu"
																							},
																							"prompt": {
																								"type": "string"
																							},
																							"attempts": {
																								"type": "integer",
																								"minimum": -9007199254740991,
																								"maximum": 9007199254740991
																							},
																							"options": {
																								"type": "array",
																								"items": {
																									"type": "object",
																									"properties": {
																										"digit": {
																											"type": "string"
																										},
																										"leadPath": {
																											"type": "boolean"
																										},
																										"steps": {
																											"type": "array",
																											"items": {
																												"oneOf": [
																													{
																														"type": "object",
																														"properties": {
																															"kind": {
																																"type": "string",
																																"const": "ring"
																															},
																															"target": {
																																"type": "string",
																																"enum": [
																																	"group",
																																	"site",
																																	"everyone"
																																]
																															},
																															"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"
																																	}
																																]
																															},
																															"groupName": {
																																"type": [
																																	"string",
																																	"null"
																																]
																															},
																															"timeoutSec": {
																																"type": "integer",
																																"minimum": -9007199254740991,
																																"maximum": 9007199254740991
																															},
																															"people": {
																																"type": "array",
																																"items": {
																																	"type": "string"
																																}
																															},
																															"earlierEndpoints": {
																																"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",
																															"target",
																															"ringGroupId",
																															"groupName",
																															"timeoutSec",
																															"people",
																															"earlierEndpoints"
																														],
																														"additionalProperties": false
																													},
																													{
																														"type": "object",
																														"properties": {
																															"kind": {
																																"type": "string",
																																"const": "forward"
																															},
																															"to": {
																																"type": "string"
																															},
																															"presentCallerId": {
																																"type": "string",
																																"enum": [
																																	"caller",
																																	"practice"
																																]
																															},
																															"timeoutSec": {
																																"type": "integer",
																																"minimum": -9007199254740991,
																																"maximum": 9007199254740991
																															},
																															"refused": {
																																"type": "boolean"
																															}
																														},
																														"required": [
																															"kind",
																															"to",
																															"presentCallerId",
																															"timeoutSec",
																															"refused"
																														],
																														"additionalProperties": false
																													},
																													{
																														"type": "object",
																														"properties": {
																															"kind": {
																																"type": "string",
																																"const": "announce"
																															},
																															"text": {
																																"type": "string"
																															}
																														},
																														"required": [
																															"kind",
																															"text"
																														],
																														"additionalProperties": false
																													},
																													{
																														"type": "object",
																														"properties": {
																															"kind": {
																																"type": "string",
																																"const": "voicemail"
																															}
																														},
																														"required": [
																															"kind"
																														],
																														"additionalProperties": false
																													},
																													{
																														"type": "object",
																														"properties": {
																															"kind": {
																																"type": "string",
																																"const": "notice"
																															}
																														},
																														"required": [
																															"kind"
																														],
																														"additionalProperties": false
																													}
																												]
																											}
																										}
																									},
																									"required": [
																										"digit",
																										"leadPath",
																										"steps"
																									],
																									"additionalProperties": false
																								}
																							},
																							"noChoice": {
																								"type": "array",
																								"items": {
																									"oneOf": [
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "ring"
																												},
																												"target": {
																													"type": "string",
																													"enum": [
																														"group",
																														"site",
																														"everyone"
																													]
																												},
																												"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"
																														}
																													]
																												},
																												"groupName": {
																													"type": [
																														"string",
																														"null"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"people": {
																													"type": "array",
																													"items": {
																														"type": "string"
																													}
																												},
																												"earlierEndpoints": {
																													"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",
																												"target",
																												"ringGroupId",
																												"groupName",
																												"timeoutSec",
																												"people",
																												"earlierEndpoints"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "forward"
																												},
																												"to": {
																													"type": "string"
																												},
																												"presentCallerId": {
																													"type": "string",
																													"enum": [
																														"caller",
																														"practice"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"refused": {
																													"type": "boolean"
																												}
																											},
																											"required": [
																												"kind",
																												"to",
																												"presentCallerId",
																												"timeoutSec",
																												"refused"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "announce"
																												},
																												"text": {
																													"type": "string"
																												}
																											},
																											"required": [
																												"kind",
																												"text"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "voicemail"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "notice"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										}
																									]
																								}
																							},
																							"knownPatient": {
																								"anyOf": [
																									{
																										"type": "array",
																										"items": {
																											"oneOf": [
																												{
																													"type": "object",
																													"properties": {
																														"kind": {
																															"type": "string",
																															"const": "ring"
																														},
																														"target": {
																															"type": "string",
																															"enum": [
																																"group",
																																"site",
																																"everyone"
																															]
																														},
																														"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"
																																}
																															]
																														},
																														"groupName": {
																															"type": [
																																"string",
																																"null"
																															]
																														},
																														"timeoutSec": {
																															"type": "integer",
																															"minimum": -9007199254740991,
																															"maximum": 9007199254740991
																														},
																														"people": {
																															"type": "array",
																															"items": {
																																"type": "string"
																															}
																														},
																														"earlierEndpoints": {
																															"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",
																														"target",
																														"ringGroupId",
																														"groupName",
																														"timeoutSec",
																														"people",
																														"earlierEndpoints"
																													],
																													"additionalProperties": false
																												},
																												{
																													"type": "object",
																													"properties": {
																														"kind": {
																															"type": "string",
																															"const": "forward"
																														},
																														"to": {
																															"type": "string"
																														},
																														"presentCallerId": {
																															"type": "string",
																															"enum": [
																																"caller",
																																"practice"
																															]
																														},
																														"timeoutSec": {
																															"type": "integer",
																															"minimum": -9007199254740991,
																															"maximum": 9007199254740991
																														},
																														"refused": {
																															"type": "boolean"
																														}
																													},
																													"required": [
																														"kind",
																														"to",
																														"presentCallerId",
																														"timeoutSec",
																														"refused"
																													],
																													"additionalProperties": false
																												},
																												{
																													"type": "object",
																													"properties": {
																														"kind": {
																															"type": "string",
																															"const": "announce"
																														},
																														"text": {
																															"type": "string"
																														}
																													},
																													"required": [
																														"kind",
																														"text"
																													],
																													"additionalProperties": false
																												},
																												{
																													"type": "object",
																													"properties": {
																														"kind": {
																															"type": "string",
																															"const": "voicemail"
																														}
																													},
																													"required": [
																														"kind"
																													],
																													"additionalProperties": false
																												},
																												{
																													"type": "object",
																													"properties": {
																														"kind": {
																															"type": "string",
																															"const": "notice"
																														}
																													},
																													"required": [
																														"kind"
																													],
																													"additionalProperties": false
																												}
																											]
																										}
																									},
																									{
																										"type": "null"
																									}
																								]
																							}
																						},
																						"required": [
																							"kind",
																							"prompt",
																							"attempts",
																							"options",
																							"noChoice",
																							"knownPatient"
																						],
																						"additionalProperties": false
																					},
																					{
																						"type": "object",
																						"properties": {
																							"kind": {
																								"type": "string",
																								"const": "ai"
																							},
																							"on": {
																								"type": "boolean"
																							},
																							"handoff": {
																								"anyOf": [
																									{
																										"type": "object",
																										"properties": {
																											"kind": {
																												"type": "string",
																												"const": "ring"
																											},
																											"target": {
																												"type": "string",
																												"enum": [
																													"group",
																													"site",
																													"everyone"
																												]
																											},
																											"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"
																													}
																												]
																											},
																											"groupName": {
																												"type": [
																													"string",
																													"null"
																												]
																											},
																											"timeoutSec": {
																												"type": "integer",
																												"minimum": -9007199254740991,
																												"maximum": 9007199254740991
																											},
																											"people": {
																												"type": "array",
																												"items": {
																													"type": "string"
																												}
																											},
																											"earlierEndpoints": {
																												"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",
																											"target",
																											"ringGroupId",
																											"groupName",
																											"timeoutSec",
																											"people",
																											"earlierEndpoints"
																										],
																										"additionalProperties": false
																									},
																									{
																										"type": "null"
																									}
																								]
																							},
																							"fallback": {
																								"type": "array",
																								"items": {
																									"oneOf": [
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "ring"
																												},
																												"target": {
																													"type": "string",
																													"enum": [
																														"group",
																														"site",
																														"everyone"
																													]
																												},
																												"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"
																														}
																													]
																												},
																												"groupName": {
																													"type": [
																														"string",
																														"null"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"people": {
																													"type": "array",
																													"items": {
																														"type": "string"
																													}
																												},
																												"earlierEndpoints": {
																													"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",
																												"target",
																												"ringGroupId",
																												"groupName",
																												"timeoutSec",
																												"people",
																												"earlierEndpoints"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "forward"
																												},
																												"to": {
																													"type": "string"
																												},
																												"presentCallerId": {
																													"type": "string",
																													"enum": [
																														"caller",
																														"practice"
																													]
																												},
																												"timeoutSec": {
																													"type": "integer",
																													"minimum": -9007199254740991,
																													"maximum": 9007199254740991
																												},
																												"refused": {
																													"type": "boolean"
																												}
																											},
																											"required": [
																												"kind",
																												"to",
																												"presentCallerId",
																												"timeoutSec",
																												"refused"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "announce"
																												},
																												"text": {
																													"type": "string"
																												}
																											},
																											"required": [
																												"kind",
																												"text"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "voicemail"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										},
																										{
																											"type": "object",
																											"properties": {
																												"kind": {
																													"type": "string",
																													"const": "notice"
																												}
																											},
																											"required": [
																												"kind"
																											],
																											"additionalProperties": false
																										}
																									]
																								}
																							}
																						},
																						"required": [
																							"kind",
																							"on",
																							"handoff",
																							"fallback"
																						],
																						"additionalProperties": false
																					}
																				]
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"kind",
																	"hours",
																	"blocked",
																	"withheldToVoicemail",
																	"open",
																	"closed"
																],
																"additionalProperties": false
															}
														]
													}
												},
												"required": [
													"id",
													"kind",
													"name",
													"locationId",
													"numbers",
													"routingConfigId",
													"flow"
												],
												"additionalProperties": false
											}
										},
										"asOf": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"numbers",
										"configs",
										"ringGroups",
										"closures",
										"devices",
										"tracking",
										"asOf"
									],
									"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). Voice numbers and static tracking numbers save here; a number that belongs to a tracking pool is refused (404) because its pool's routing applies (PUT /voice/routing/pools/:poolId). Without Smileline Voice a Voice number is refused, and a static tracking number may not ring ring groups, hand calls to the AI agent or take voicemail (403 VOICE_NOT_ENABLED). 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"
															]
														}
													},
													"noChoice": {
														"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",
													"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"
															]
														}
													},
													"noChoice": {
														"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",
													"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/pools/{poolId}": {
			"put": {
				"summary": "Set how calls to a tracking pool route",
				"tags": [
					"voice"
				],
				"description": "Upserts one routing config shared by every number in the pool: they rotate on the website, so they are interchangeable. Same body and rules as PUT /voice/routing/numbers/:numberId. Call tracking is a core feature: without Smileline Voice, routing that rings ring groups, hands calls to the AI agent or takes voicemail is refused (403 VOICE_NOT_ENABLED).",
				"parameters": [
					{
						"name": "poolId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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"
															]
														}
													},
													"noChoice": {
														"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",
													"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"
															]
														}
													},
													"noChoice": {
														"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",
													"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"
								}
							}
						}
					},
					"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}/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/hold-music": {
			"get": {
				"summary": "Whether the practice has its own hold music",
				"tags": [
					"voice"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoiceGreetingAudio"
								}
							}
						}
					},
					"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 the practice's hold music",
				"tags": [
					"voice"
				],
				"description": "multipart/form-data with one `file` field: an MP3 or WAV of at most 5 MiB (a memory/body bound — about five minutes of 128 kbit/s MP3). Replaces any earlier upload; callers on hold hear it from their next hold. The practice must have Smileline Voice set up (404 VOICE_NOT_CONFIGURED otherwise). Only upload music the practice is licensed to play to callers on hold.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoiceGreetingAudio"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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 practice's hold music",
				"tags": [
					"voice"
				],
				"description": "Callers on hold go back to Smileline's default hold music. When a concurrent upload replaced the music first, the response reports that upload (present: true) and nothing is removed.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/VoiceGreetingAudio"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/hold-music/audio": {
			"get": {
				"summary": "Play the practice's hold music",
				"tags": [
					"voice"
				],
				"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) and `setupUrl`, the line's permanent setup link a phone's Auto Provision fetches instead (it stops working when the line's password is reset or the line is disabled). 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"
										},
										"setupUrl": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"server",
										"username",
										"password",
										"setupUrl"
									],
									"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": "Set the site where a Voice number's phones are and register it for emergency calling",
				"tags": [
					"voice"
				],
				"description": "Records the site where the number's phones are and, for an active number on SmileLine, stages the carrier's emergency-address registration from that location's address (sending the same location again files its address anew — after a rejection or an address edit). Moving the number to another site resets its registration: a live number re-registers at the new site, and 999/112/911 cannot use it until the carrier confirms. A pending order or port registers automatically when the number goes live; a number on a desk-phone line only records a move. The location's street address, town and postcode must be complete; US locations also need a state. 202 — poll the returned operation; 200 when only the site was recorded. 409 codes: NUMBER_PARKED (a parked number cannot move), NUMBER_PRESENTED_BY_HANDSETS (desk phones at the old site still dial out as it), EMERGENCY_REGISTRATION_PENDING (a registration is already running), DIALER_NUMBER_RAW_LINE (the number is on a desk-phone line, which registers its own address).",
				"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"
										}
									},
									"memberEndpointIds": {
										"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",
									"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/voice/ring-groups/{id}": {
			"delete": {
				"summary": "Delete a ring group",
				"tags": [
					"voice"
				],
				"description": "409 VOICE_RING_GROUP_IN_USE while a number's routing (any step: the ring, If nobody answers, a menu option, an AI fallback, the known-patient shortcut) or the AI voice agent's enabled Transfer to a human still uses it; the message names each place.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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. VoiceStack: mints both capability tokens; the two plaintexts in this response are the only copies — Smileline keeps keyed digests. JustCall and Aircall (username = API key / API ID, password = API secret / API token): Smileline registers its webhook with the vendor itself and the URL fields are null. 422 when the vendor rejects the credentials; 502 when it cannot be reached or refuses the webhook registration (the connection then waits; connect again retries); 409 while another management action holds the connection.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"provider": {
										"type": "string",
										"enum": [
											"voicestack",
											"justcall",
											"aircall"
										]
									},
									"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",
												"null"
											]
										},
										"leadApiUrl": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"connection",
										"webhookUrl",
										"leadApiUrl"
									],
									"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"
								}
							}
						}
					},
					"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; for JustCall and Aircall it also removes Smileline's webhook from the vendor, and setting the connection live again registers it afresh. 409 while another management action holds the connection.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": "VoiceStack only: 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. 409 for JustCall and Aircall, whose webhook Smileline manages itself — disconnect and set live again to rotate.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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"
								}
							}
						}
					}
				}
			}
		},
		"/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. `subjectPatientId` narrows the feed to the rows about one patient — the patient record's history.",
				"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": {
											"type": [
												"string",
												"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/parked-imports": {
			"get": {
				"summary": "CSV uploads kept for a person",
				"tags": [
					"data-transfer"
				],
				"description": "Uploaded CSV files that could not become an import — unreadable, an unknown entity, or the database unavailable — kept with their bytes until a person retries or discards them. Oldest first.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ParkedUpload"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/parked-imports/{id}/retry": {
			"post": {
				"summary": "Read a kept CSV again",
				"tags": [
					"data-transfer"
				],
				"description": "Re-reads the kept file and creates its import job, exactly as the upload would — one job per kept file: a job the upload itself already made is the one answered. The upload is settled once, in the same transaction. A file still unreadable answers 400 and stays kept.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/parked-imports/{id}/discard": {
			"post": {
				"summary": "Discard a kept CSV",
				"tags": [
					"data-transfer"
				],
				"description": "A person's decision, with why: the kept file is deleted and the upload settled as discarded. Audited. 409 PARKED_UPLOAD_IMPORTED once an import job took the file.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": [
												"resolved",
												"discarded"
											]
										}
									},
									"required": [
										"id",
										"state"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": "matchedOn",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 200,
							"pattern": "^[a-z_]+(,[a-z_]+)*$"
						}
					},
					{
						"name": "score",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 0,
							"maximum": 100
						}
					},
					{
						"name": "dobConflict",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "afterRow",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"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
										},
										"groups": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"matchedOn": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"score": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"dobConflict": {
														"type": "boolean"
													},
													"count": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"matchedOn",
													"score",
													"dobConflict",
													"count"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"items",
										"total",
										"groups"
									],
									"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 adopts the matching Smileline lead or creates the journey, with its 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/imports/{id}/candidates/resolve": {
			"post": {
				"summary": "Resolve match candidates in bulk",
				"tags": [
					"data-transfer"
				],
				"description": "Accepts or rejects one slice of up to 25 match candidates, each on its own, as the single accept and reject do; a client resolving a whole group sends it slice by slice. Bulk accept refuses a candidate whose date of birth differs from the patient's. Every candidate that cannot be resolved is listed in `failed` with the reason; the rest still resolve.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"action": {
										"type": "string",
										"enum": [
											"accept",
											"reject"
										]
									},
									"candidateIds": {
										"minItems": 1,
										"maxItems": 25,
										"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": [
									"action",
									"candidateIds"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"job": {
											"$ref": "#/components/schemas/ImportJob"
										},
										"resolved": {
											"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)$"
											}
										},
										"failed": {
											"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)$"
													},
													"message": {
														"type": "string"
													}
												},
												"required": [
													"id",
													"message"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"job",
										"resolved",
										"failed"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/imports/{id}/stock-groups": {
			"get": {
				"summary": "A stock import's items",
				"tags": [
					"data-transfer"
				],
				"description": "A stock spreadsheet import's items in file order, each the rows naming one item at one site: those waiting for a person (`view=review`); before the import runs, those matched to an item of their site by name alone (`view=name_matches`), to confirm, and those it will leave for a person (`view=planned_park`). Each with its first 20 rows and the live items of its site with its name or barcode. 404 for any other import.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "view",
						"in": "query",
						"required": false,
						"schema": {
							"default": "review",
							"type": "string",
							"enum": [
								"review",
								"name_matches",
								"planned_park"
							]
						}
					},
					{
						"name": "after",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"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/StockImportGroup"
											}
										},
										"total": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"nextAfter": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"total",
										"nextAfter"
									],
									"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}/stock-groups/{groupId}/rows": {
			"get": {
				"summary": "A stock import item's rows",
				"tags": [
					"data-transfer"
				],
				"description": "Every row of one item of a stock spreadsheet import, a page at a time in file order: each as read, with its cells as the file gave them (beside the file's headers) and every problem the check recorded for it. 404 for any other import.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "groupId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "after",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					},
					{
						"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": {
										"headers": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"rowNumber": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"name": {
														"type": [
															"string",
															"null"
														]
													},
													"quantity": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"lot": {
														"type": [
															"string",
															"null"
														]
													},
													"expiryOn": {
														"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"
															}
														]
													},
													"unitCostMicros": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"problem": {
														"type": [
															"string",
															"null"
														]
													},
													"cells": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"issues": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"field": {
																	"type": [
																		"string",
																		"null"
																	]
																},
																"code": {
																	"type": "string"
																},
																"message": {
																	"type": "string"
																}
															},
															"required": [
																"field",
																"code",
																"message"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"rowNumber",
													"name",
													"quantity",
													"lot",
													"expiryOn",
													"unitCostMicros",
													"problem",
													"cells",
													"issues"
												],
												"additionalProperties": false
											}
										},
										"nextAfter": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"headers",
										"items",
										"nextAfter"
									],
									"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}/stock-groups/{groupId}/resolve": {
			"post": {
				"summary": "Settle a stock import's waiting item",
				"tags": [
					"data-transfer"
				],
				"description": "A person's decision on an item a stock import could not settle itself. `apply` recounts the live item of the item's site named by `itemId` to the item's rows — with `otherLots` saying whether its live lots the rows do not name are kept or counted at zero, when the rows name lots — or creates it as a new item (its opening balance) when `itemId` is null; rows with a problem are left out, and the movements name the person. A row that names no item at one site can only be discarded (409 STOCK_IMPORT_UNIDENTIFIED). `discard` imports nothing for it. Audited. 400/409 with the stock writer's reason when the item cannot be applied; it keeps waiting. The last item settled completes an import 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)$"
						}
					},
					{
						"name": "groupId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": "apply"
											},
											"itemId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"otherLots": {
												"type": "string",
												"enum": [
													"keep",
													"zero"
												]
											}
										},
										"required": [
											"action",
											"itemId"
										]
									},
									{
										"type": "object",
										"properties": {
											"action": {
												"type": "string",
												"const": "discard"
											}
										},
										"required": [
											"action"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ImportJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/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 because it is built in memory — larger sets return EXPORT_TOO_LARGE and should use an async export job, which has no row limit. Money cells carry the locked uppercase ISO accounting-currency code so a later import cannot reinterpret them in another currency. Patients export the patients list's default columns, without archived or merged records; GET /patients/export adds the list's filters and column picker.",
				"parameters": [
					{
						"name": "entity",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"patients",
								"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, with no row limit. Money cells carry the locked uppercase ISO accounting-currency code. With `patientQuery`, a patients export runs GET /patients/export's query — the same rows, order and columns — and answers 400 for a query that endpoint would refuse. The artifact expires after 7 days.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"entity": {
										"type": "string",
										"enum": [
											"patients",
											"journeys",
											"appointments",
											"tasks",
											"treatments",
											"tags",
											"lead_sources",
											"lost_reasons",
											"cancellation_reasons",
											"contact_methods",
											"appointment_types"
										]
									},
									"patientQuery": {
										"type": "object",
										"properties": {
											"q": {
												"type": "string",
												"minLength": 1
											},
											"filters": {
												"type": "string",
												"maxLength": 4000
											},
											"sort": {
												"default": "createdAt",
												"type": "string",
												"enum": [
													"createdAt",
													"updatedAt",
													"lastName",
													"firstName",
													"status",
													"dateOfBirth",
													"city",
													"email",
													"nextVisit",
													"lastVisit",
													"relevance"
												]
											},
											"direction": {
												"default": "desc",
												"type": "string",
												"enum": [
													"asc",
													"desc"
												]
											},
											"columns": {
												"type": "string",
												"pattern": "^[a-zA-Z]+(,[a-zA-Z]+)*$"
											},
											"ids": {
												"type": "string",
												"pattern": "^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36})*$"
											}
										}
									}
								},
								"required": [
									"entity"
								],
								"description": "Creates a background CSV export for an entity that exceeds the synchronous row limit. `patientQuery` carries a Patients page export (search, filters, sort, columns, selection)."
							}
						}
					}
				},
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports": {
			"post": {
				"summary": "Start uploading a practice-management export",
				"tags": [
					"data-transfer"
				],
				"description": "Owner only. Creates the import and answers the part size and count: PUT each part to /transfer/pms-exports/:id/parts/:n, then POST /transfer/pms-exports/:id/complete. 409 IMPORT_ALREADY_ACTIVE while another import of the practice is uploading, being checked, awaiting its start or importing (a completed one holds nothing: the final export uploads beside an early one). A Dentally connection may be live: the Check stops the job when one is not the export's practice's (or is NexGen), and beside the practice's own the import brings in history only.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"vendor": {
										"type": "string",
										"enum": [
											"dentally"
										]
									},
									"fileName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 255,
										"pattern": "\\.zip$"
									},
									"bytes": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"expectedOrganizationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
										"description": "Canonical lowercase UUID organization identifier"
									}
								},
								"required": [
									"vendor",
									"fileName",
									"bytes",
									"expectedOrganizationId"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"job": {
											"$ref": "#/components/schemas/PmsExportJob"
										},
										"partSize": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"partCount": {
											"type": "integer",
											"minimum": 1,
											"maximum": 10000
										}
									},
									"required": [
										"job",
										"partSize",
										"partCount"
									],
									"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"
								}
							}
						}
					}
				}
			},
			"get": {
				"summary": "List practice-management export imports",
				"tags": [
					"data-transfer"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsExportJob"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports/{id}/parts/{n}": {
			"put": {
				"summary": "Upload one part of a practice-management export",
				"tags": [
					"data-transfer"
				],
				"description": "Streams one part: Content-Length must be the part's exact size (partSize, the remainder for the last part). Sending a part again replaces it. 409 PMS_EXPORT_UPLOAD_EXPIRED once the upload has expired or completed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "n",
						"in": "path",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 10000
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/octet-stream": {
							"schema": {
								"type": "string",
								"description": "The part's bytes",
								"format": "binary"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"partNumber": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"etag": {
											"type": "string"
										}
									},
									"required": [
										"partNumber",
										"etag"
									],
									"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/pms-exports/{id}/complete": {
			"post": {
				"summary": "Finish uploading a practice-management export",
				"tags": [
					"data-transfer"
				],
				"description": "Assembles the parts and hands the export to the background, where its file list is read, each CSV unpacked and checked (nothing is imported yet). A file that is not a complete Dentally zip fails the job with its reason, keeping the bytes until Discard. 422 PMS_EXPORT_INVALID when the assembled size differs from the declared one. Completing a finished upload again answers the job.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"parts": {
										"minItems": 1,
										"maxItems": 10000,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"partNumber": {
													"type": "integer",
													"minimum": 1,
													"maximum": 10000
												},
												"etag": {
													"type": "string",
													"minLength": 1,
													"maxLength": 256
												}
											},
											"required": [
												"partNumber",
												"etag"
											],
											"additionalProperties": false
										}
									}
								},
								"required": [
									"parts"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports/{id}": {
			"get": {
				"summary": "One practice-management export import, with its Check report",
				"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/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports/{id}/resume": {
			"post": {
				"summary": "Resume a stopped practice-management export import",
				"tags": [
					"data-transfer"
				],
				"description": "Continues a failed job from where it stopped, with a fresh step budget for the work left. 409 INVALID_STATE when the job is not resumable.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/discard": {
			"post": {
				"summary": "Discard a practice-management export before it is imported",
				"tags": [
					"data-transfer"
				],
				"description": "Stops the job and deletes the uploaded export and everything unpacked from it. Allowed while uploading, checking, after the Check, or once failed; never while importing. 409 INVALID_STATE otherwise.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/errors": {
			"get": {
				"summary": "Rows of a practice-management export that could not be read",
				"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					},
					{
						"name": "state",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"retried",
								"resolved",
								"discarded"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PmsExportRowError"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"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/pms-exports/{id}/errors/{errorId}": {
			"get": {
				"summary": "Inspect a parked row of a practice-management export",
				"tags": [
					"data-transfer"
				],
				"description": "The row re-read from the export's own bytes, and — for a refund — its account's payments. 409 PMS_EXPORT_ARCHIVE_GONE once the export is deleted (Finish or Discard).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "errorId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportParkedRow"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/errors/discard": {
			"post": {
				"summary": "Discard parked rows of a practice-management export",
				"tags": [
					"data-transfer"
				],
				"description": "The owner's decision that these rows are not imported: each named row — by its park, or every row parked for one reason in one table — is discarded with all its parks, and stays so when the import runs again. 409 INVALID_STATE once finished.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
											"ids": {
												"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": [
											"ids"
										],
										"additionalProperties": false
									},
									{
										"type": "object",
										"properties": {
											"table": {
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											},
											"code": {
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											}
										},
										"required": [
											"table",
											"code"
										],
										"additionalProperties": false
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"discarded": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"discarded"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports/{id}/errors/{errorId}/refund": {
			"put": {
				"summary": "Say which payment a parked refund refunds",
				"tags": [
					"data-transfer"
				],
				"description": "One of its account's payments, or kept as a refund made in Dentally of none. The import applies it when it runs again — or a newer export of the practice, which carries it by Dentally's id — still checking the payment has that much left. 422 PMS_EXPORT_REFUND_INVALID when the row is not a refund or the payment not one of its account's; 409 once finished or discarded; 409 PMS_EXPORT_SUPERSEDED once a newer export took 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": "errorId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": "legacy"
											}
										},
										"required": [
											"kind"
										],
										"additionalProperties": false
									},
									{
										"type": "object",
										"properties": {
											"kind": {
												"type": "string",
												"const": "link"
											},
											"paymentId": {
												"type": "string",
												"minLength": 1,
												"maxLength": 64
											}
										},
										"required": [
											"kind",
											"paymentId"
										],
										"additionalProperties": false
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportParkedRow"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports/{id}/errors/{errorId}/keep": {
			"put": {
				"summary": "Keep Smileline's copy of a payment staff refunded",
				"tags": [
					"data-transfer"
				],
				"description": "For a payment Dentally's sync brought in that staff then refunded in Smileline (parked native_refund): Smileline's copy stays and the import posts none of its own when it runs again. 422 PMS_EXPORT_KEEP_INVALID for any other row; 409 once finished, discarded or resolved.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "errorId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportParkedRow"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports/{id}/sites/{siteId}": {
			"put": {
				"summary": "Choose the location a site's records import into",
				"tags": [
					"data-transfer"
				],
				"description": "The location must be one of the practice's active locations. Allowed before the import starts, or while it waits for review; 409 INVALID_STATE otherwise.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
							"minLength": 1,
							"maxLength": 64
						}
					}
				],
				"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"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/practitioners/{practitionerId}": {
			"put": {
				"summary": "Choose who a practitioner becomes",
				"tags": [
					"data-transfer"
				],
				"description": "A practitioner already in the team, or a new one. Allowed before the import starts, or while it waits for review; 409 INVALID_STATE otherwise.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 64
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"decision": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "match"
													},
													"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": [
													"kind",
													"practitionerId"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "create"
													}
												},
												"required": [
													"kind"
												],
												"additionalProperties": false
											}
										]
									}
								},
								"required": [
									"decision"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportJob"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/tax-rates/{rateId}": {
			"put": {
				"summary": "Say what one of the export's tax rates is",
				"tags": [
					"data-transfer"
				],
				"description": "Dentally's export names each tax rate without its rate: the owner says whether it is standard-rated, zero-rated, exempt or outside the scope of VAT. Allowed before the import starts, or while it waits for review; 409 INVALID_STATE otherwise.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "rateId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 64
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"treatment": {
										"type": "string",
										"enum": [
											"exempt",
											"standard",
											"zero",
											"none"
										]
									}
								},
								"required": [
									"treatment"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/channels/{channel}": {
			"put": {
				"summary": "Choose the connection Dentally's texts or emails go on",
				"tags": [
					"data-transfer"
				],
				"description": "Asked when the practice has more than one live SMS or email connection; with one it is used, with none the messages wait until one is connected and the import runs again. A connection the import has written on stays (409 INVALID_STATE). Allowed before the import starts, or while it waits for review; 409 INVALID_STATE otherwise.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
							]
						}
					}
				],
				"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)$"
									}
								},
								"required": [
									"connectionId"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/addresses": {
			"get": {
				"summary": "Numbers and addresses Dentally used for more than one patient",
				"tags": [
					"data-transfer"
				],
				"description": "Each has one conversation in Smileline: the owner says whose it is, and the others' messages join it, linked to that contact as family.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportSharedAddress"
											}
										}
									},
									"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": "Say whose each shared number or address is",
				"tags": [
					"data-transfer"
				],
				"description": "The owner's choices (each one of that address's own patients), or every suggestion accepted at once for those not chosen yet. 422 PMS_EXPORT_ADDRESS_INVALID for a patient the address never had. Allowed before the import starts, or while it waits for review; 409 INVALID_STATE otherwise.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
											"acceptSuggestions": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"acceptSuggestions"
										],
										"additionalProperties": false
									},
									{
										"type": "object",
										"properties": {
											"owners": {
												"minItems": 1,
												"maxItems": 20000,
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"address": {
															"type": "string",
															"minLength": 3,
															"maxLength": 400
														},
														"patientId": {
															"type": "string",
															"minLength": 1,
															"maxLength": 64
														}
													},
													"required": [
														"address",
														"patientId"
													],
													"additionalProperties": false
												}
											}
										},
										"required": [
											"owners"
										],
										"additionalProperties": false
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/transfer/pms-exports/{id}/candidates": {
			"get": {
				"summary": "Patients the import held for review",
				"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": "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/PmsExportCandidate"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"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/pms-exports/{id}/candidates/{candidateId}": {
			"post": {
				"summary": "Decide who a held patient is",
				"tags": [
					"data-transfer"
				],
				"description": "merge imports them into the Smileline patient they resemble — or the one patientId names (Smileline's details win; Dentally's only fill blanks); create imports them as a new patient. A decision can be changed until the import reaches the patient. 409 PMS_EXPORT_MATCH_GONE when the chosen patient was erased or merged. Allowed before the import starts, or while it waits for review; 409 INVALID_STATE otherwise.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"decision": {
										"type": "string",
										"enum": [
											"merge",
											"create"
										]
									},
									"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": [
									"decision"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportCandidate"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/import": {
			"post": {
				"summary": "Import a checked practice-management export",
				"tags": [
					"data-transfer"
				],
				"description": "Starts the import once every site has a location, every practitioner a decision and every held patient a decision — and continues one that stopped for review. Imported history stays inert (no reminders, recalls or marketing) until Go live. While a Dentally connection of the export's practice operates the import brings in history only (`historyOnly`), for good. The practice's earlier imports give way (`superseded`): their waiting rows move here as this import reads the same records, the owner's decisions with them. 409 PMS_EXPORT_REVIEW_INCOMPLETE says what is undecided; 409 IMPORT_ALREADY_ACTIVE as when uploading; 409 PMS_CONNECTION_ACTIVE while a Dentally connection that is not the export's practice's (or is NexGen) operates.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/live": {
			"post": {
				"summary": "Go live from an imported practice-management export",
				"tags": [
					"data-transfer"
				],
				"description": "Once the import is complete: imported visits still ahead get their pre-visit reminders and the paused recalls resume (each when chosen), and the opt-ins Dentally recorded apply. Once. The practice's disconnected Dentally connections are handed over: their synced visits become Smileline's own (no longer PMS-managed). 409 INVALID_STATE before the import is complete or after going live; 409 PMS_EXPORT_HISTORY_ONLY from an import that ran while Dentally was connected (the practice goes live from its final export); 409 PMS_EXPORT_SUPERSEDED from one a newer export took over; 409 PMS_CONNECTION_ACTIVE while any Dentally connection of the practice is not disconnected.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"appointmentReminders": {
										"type": "boolean"
									},
									"recallReminders": {
										"type": "boolean"
									}
								},
								"required": [
									"appointmentReminders",
									"recallReminders"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/rerun": {
			"post": {
				"summary": "Run a practice-management export import again",
				"tags": [
					"data-transfer"
				],
				"description": "Walks the whole export again — the Check, the import and, once live, Go live — adding only what is missing; nothing imported changes. A parked row it parks again waits again; the others are resolved. 409 INVALID_STATE unless the import is complete (or stopped once it had imported); A history-only import stays history-only. 409 PMS_EXPORT_SUPERSEDED once a newer export took over; 409 PMS_EXPORT_REVIEW_INCOMPLETE when a connection must be chosen first; 409 IMPORT_ALREADY_ACTIVE and PMS_CONNECTION_ACTIVE as when starting.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/pms-exports/{id}/finish": {
			"post": {
				"summary": "Finish a practice-management export import",
				"tags": [
					"data-transfer"
				],
				"description": "Once the practice is live from it — or, for a history-only import or one a newer export took over, at any time — and no parked row or held patient waits: the job closes and the uploaded export, with everything unpacked from it, is deleted; so are the earlier imports this one took over that nothing waits on. 409 INVALID_STATE before Go live; 409 PMS_EXPORT_ROWS_WAITING while rows wait.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/PmsExportJob"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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": {
			"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); the Overview's numbers are GET /ads/overview. Credentials, provider cursors and raw provider payloads are never returned.",
				"parameters": [
					{
						"name": "embed",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"openAlerts"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadAdsOverview"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"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"
											}
										]
									},
									"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/meta/asset-choices": {
			"get": {
				"summary": "List the Facebook Pages or ad accounts the Meta grant can add",
				"tags": [
					"lead-ads"
				],
				"description": "Reads one page of the connector's live Meta grant. Only the person who connected Facebook may list it: the grant is theirs and can include other practices' assets, which are flagged and never stored.",
				"parameters": [
					{
						"name": "kind",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"pages",
								"ad_accounts"
							]
						}
					},
					{
						"name": "after",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2048
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"name": {
														"type": [
															"string",
															"null"
														]
													},
													"added": {
														"type": "boolean"
													},
													"ownedElsewhere": {
														"type": "boolean"
													}
												},
												"required": [
													"id",
													"name",
													"added",
													"ownedElsewhere"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"items",
										"nextCursor"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/meta/assets": {
			"post": {
				"summary": "Add and switch on Facebook Pages or ad accounts",
				"tags": [
					"lead-ads"
				],
				"description": "Adds the picked Pages and ad accounts to this practice and switches each on. Every id must be in the connector's live grant; one another practice owns is reported, not added. Removal is switching an account off.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"pageIds": {
										"maxItems": 1000,
										"type": "array",
										"items": {
											"type": "string",
											"pattern": "^(?:act_)?\\d{1,32}$"
										}
									},
									"adAccountIds": {
										"maxItems": 1000,
										"type": "array",
										"items": {
											"type": "string",
											"pattern": "^(?:act_)?\\d{1,32}$"
										}
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"results": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"kind": {
														"type": "string",
														"enum": [
															"pages",
															"ad_accounts"
														]
													},
													"outcome": {
														"type": "string",
														"enum": [
															"added",
															"owned_elsewhere",
															"failed"
														]
													},
													"code": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"kind",
													"outcome",
													"code"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"results"
									],
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/forms/{id}/mapping": {
			"put": {
				"summary": "Switch a lead form on/off, customise it or reset it to automatic",
				"tags": [
					"lead-ads"
				],
				"description": "Sends only what changed. A mapping object is validated (question ids, tenant-owned overrides, treatment answer mappings, explicit per-channel consent evidence) and saved as a staff customisation; \"automatic\" resets the form to the rules. Switching a form off is recorded as a staff decision that automation never overrides.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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"
									},
									"mapping": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/LeadAdFormMapping"
											},
											{
												"type": "string",
												"const": "automatic"
											}
										]
									}
								}
							}
						}
					}
				},
				"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"
						}
					},
					{
						"name": "attention",
						"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)$"
						}
					}
				],
				"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 (Dismiss)",
				"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. Create/attach apply to identity conflicts; ignore (Dismiss) applies to any unresolved submission and is the only way an unresolved lead is discarded.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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 live account or one live form within the provider's retention window. Answers 409 LEAD_AD_BACKFILL_NO_FORMS when nothing is live to import. 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/backfills/{id}/resume": {
			"post": {
				"summary": "Resume a failed lead-ad import from its checkpoint",
				"tags": [
					"lead-ads"
				],
				"description": "Continues a failed import from its checkpoint in a NEW import job (same window, cumulative counts) and returns that new job; the failed job is marked cancelled. A job that is not failed 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)$"
						}
					}
				],
				"responses": {
					"202": {
						"description": "Accepted",
						"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": "Omitted fields keep their stored values. First enable stamps the backfill fence. Without resourceSelection, setup picks resources automatically: Google adopts only Smileline-named compatible goals or creates new ones, Meta uses its one linked CRM dataset, TikTok resolves the Pixel and CRM Event Set separately; anything ambiguous asks for a choice. resourceSelection records explicit account-bound reuse/create choices. Provider permissions, category review and restricted resources may require action in the platform. Enabling without the required scopes keeps the setup held until the provider is reconnected (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"
															}
														]
													},
													"call_lead": {
														"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"
									},
									"leadValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"bookedValueCents": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"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)$"
									}
								}
							}
						}
					}
				},
				"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",
															"call_lead",
															"dataset",
															"pixel",
															"crm"
														]
													},
													"selectedId": {
														"type": [
															"string",
															"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"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/{provider}/conversions/provisioning": {
			"post": {
				"summary": "Try conversion setup again",
				"tags": [
					"lead-ads"
				],
				"description": "Restarts failed or parked automatic setup with a fresh provisioning generation. Never changes tracking, value sharing, the test-event code or resource choices. 409 CONVERSION_SETUP_STALE when setup changed since expectedProvisionGeneration was read.",
				"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": {
									"expectedProvisionGeneration": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedProvisionGeneration"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/{provider}/conversions/uploads": {
			"get": {
				"summary": "List conversion uploads",
				"tags": [
					"lead-ads"
				],
				"description": "The conversion log for one ad platform, newest first: each Lead/Booked/Won upload with its state, the reason it was skipped or held, and the platform's latest response (codes, counts and request ids only). Filter by state, stage, patient name and date with `filters` (URL-encoded JSON). Keyset-paginated with no total ceiling; held work older than 30 days stays listed.",
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"description": "URL-encoded JSON; every key is optional and keys are AND-ed. `state` and `stage` take `{\"in\": [...]}`, `patientName` takes `{\"contains\": \"...\"}`, and `occurredAt` takes `{\"from\": ISO datetime, \"to\": ISO datetime}` or `{\"preset\": \"last30days\"}` (resolved in the practice timezone). Example: `{\"state\":{\"in\":[\"held\",\"failed\"]},\"stage\":{\"in\":[\"booked\"]}}`.",
							"type": "string",
							"maxLength": 4000
						}
					},
					{
						"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/ConversionUploadLogEntry"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/{provider}/conversions/summary": {
			"get": {
				"summary": "Summarize conversion uploads",
				"tags": [
					"lead-ads"
				],
				"description": "The conversion log for one ad platform, counted by stage (Lead, Booked, Going ahead): received from the platform's own ad, received with contact details only, still sending, held, failed, and skipped with the reason. Counts the same rows the log lists, dated by when each event happened; filter the window with `filters` (URL-encoded JSON).",
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"description": "URL-encoded JSON. `occurredAt` takes `{\"from\": ISO datetime, \"to\": ISO datetime}` or `{\"preset\": \"last30days\"}` (resolved in the practice timezone); omit it for all time.",
							"type": "string",
							"maxLength": 4000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"stages": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ConversionUploadSummaryStage"
											}
										}
									},
									"required": [
										"stages"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/conversions/uploads": {
			"get": {
				"summary": "List a patient's conversion uploads",
				"tags": [
					"lead-ads"
				],
				"description": "One patient's conversion log across every ad platform, newest first: each Lead/Booked/Won upload with its platform, state, the reason it was skipped or held, and the platform's latest response (codes, counts and request ids only). Rows whose personal data was redacted are not listed. Keyset-paginated with no total ceiling.",
				"parameters": [
					{
						"name": "patientId",
						"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": "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": "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/ConversionUploadLogEntry"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/lead-ads/{provider}/conversions/uploads/{id}/raw": {
			"get": {
				"summary": "Get a conversion upload's raw data",
				"tags": [
					"lead-ads"
				],
				"description": "One conversion log row's request as sent to the ad platform and the platform's reply, verbatim, kept for 90 days from capture. A batched request shows only this row's event, and other patients' values in the shared reply are replaced by `[other event]`; credentials are never recorded. Google rows also carry the latest status check. Visible exactly when the row is visible in the conversion log.",
				"parameters": [
					{
						"name": "provider",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"meta",
								"google_ads",
								"tiktok",
								"chatgpt"
							]
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"state": {
											"type": "string",
											"enum": [
												"recorded",
												"not_recorded",
												"removed"
											]
										},
										"removedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"sent": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"at": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"body": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"text": {
																			"type": "string"
																		},
																		"truncated": {
																			"type": "boolean"
																		}
																	},
																	"required": [
																		"text",
																		"truncated"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "object",
																	"properties": {
																		"base64": {
																			"type": "string"
																		},
																		"truncated": {
																			"type": "boolean"
																		}
																	},
																	"required": [
																		"base64",
																		"truncated"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "object",
																	"properties": {
																		"omitted": {
																			"type": "boolean",
																			"const": true
																		}
																	},
																	"required": [
																		"omitted"
																	],
																	"additionalProperties": false
																}
															]
														},
														"batchSize": {
															"type": "integer",
															"exclusiveMinimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"at",
														"body",
														"batchSize"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"received": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"at": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 100,
																	"maximum": 599
																},
																{
																	"type": "null"
																}
															]
														},
														"body": {
															"anyOf": [
																{
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"text": {
																					"type": "string"
																				},
																				"truncated": {
																					"type": "boolean"
																				}
																			},
																			"required": [
																				"text",
																				"truncated"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"base64": {
																					"type": "string"
																				},
																				"truncated": {
																					"type": "boolean"
																				}
																			},
																			"required": [
																				"base64",
																				"truncated"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"omitted": {
																					"type": "boolean",
																					"const": true
																				}
																			},
																			"required": [
																				"omitted"
																			],
																			"additionalProperties": false
																		}
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"failure": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"network",
																		"read"
																	]
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"at",
														"status",
														"body",
														"failure"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"statusCheck": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"at": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 100,
																	"maximum": 599
																},
																{
																	"type": "null"
																}
															]
														},
														"body": {
															"anyOf": [
																{
																	"anyOf": [
																		{
																			"type": "object",
																			"properties": {
																				"text": {
																					"type": "string"
																				},
																				"truncated": {
																					"type": "boolean"
																				}
																			},
																			"required": [
																				"text",
																				"truncated"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"base64": {
																					"type": "string"
																				},
																				"truncated": {
																					"type": "boolean"
																				}
																			},
																			"required": [
																				"base64",
																				"truncated"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "object",
																			"properties": {
																				"omitted": {
																					"type": "boolean",
																					"const": true
																				}
																			},
																			"required": [
																				"omitted"
																			],
																			"additionalProperties": false
																		}
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"failure": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"network",
																		"read"
																	]
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"at",
														"status",
														"body",
														"failure"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"state",
										"removedAt",
										"sent",
										"received",
										"statusCheck"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": {
										"type": [
											"string",
											"null"
										]
									},
									"category": {
										"type": [
											"string",
											"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"
											}
										]
									},
									"appointmentTypeId": {
										"description": "The appointment type its consultations are booked as; must be an active type of the organization. A Dentally booking sends its name as the appointment's reason when it is one of that connection's synced reasons.",
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
										"type": [
											"string",
											"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": {
										"type": [
											"string",
											"null"
										]
									},
									"category": {
										"type": [
											"string",
											"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"
											}
										]
									},
									"appointmentTypeId": {
										"description": "The appointment type its consultations are booked as; must be an active type of the organization. A Dentally booking sends its name as the appointment's reason when it is one of that connection's synced reasons.",
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
										"type": [
											"string",
											"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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"
										]
									},
									"initiator": {
										"type": "string",
										"enum": [
											"patient",
											"practice"
										]
									},
									"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"
										]
									},
									"initiator": {
										"type": "string",
										"enum": [
											"patient",
											"practice"
										]
									},
									"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
										"type": [
											"string",
											"null"
										]
									},
									"showInDiary": {
										"type": "boolean"
									},
									"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": {
										"type": [
											"string",
											"null"
										]
									},
									"showInDiary": {
										"type": "boolean"
									},
									"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
										"type": [
											"string",
											"null"
										]
									},
									"description": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"requiresConfirmation": {
										"type": "boolean"
									},
									"isOnlineBookable": {
										"type": "boolean"
									},
									"onlineAudience": {
										"type": "string",
										"enum": [
											"any",
											"new",
											"existing"
										]
									},
									"countsAsBooking": {
										"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": {
										"type": [
											"string",
											"null"
										]
									},
									"description": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000
											},
											{
												"type": "null"
											}
										]
									},
									"requiresConfirmation": {
										"type": "boolean"
									},
									"isOnlineBookable": {
										"type": "boolean"
									},
									"onlineAudience": {
										"type": "string",
										"enum": [
											"any",
											"new",
											"existing"
										]
									},
									"countsAsBooking": {
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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/appointment-labels": {
			"get": {
				"summary": "List appointment labels",
				"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/AppointmentLabel"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a appointment label",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1,
										"maxLength": 40
									},
									"color": {
										"type": [
											"string",
											"null"
										]
									},
									"showsWhile": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"booked",
													"confirmed",
													"arrived",
													"in_chair"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"label"
								]
							}
						}
					}
				},
				"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"
										},
										"label": {
											"type": "string"
										},
										"color": {
											"type": [
												"string",
												"null"
											]
										},
										"showsWhile": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"booked",
														"confirmed",
														"arrived",
														"in_chair"
													]
												},
												{
													"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",
										"showsWhile",
										"position",
										"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/appointment-labels/{id}": {
			"patch": {
				"summary": "Update a appointment label",
				"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,
										"maxLength": 40
									},
									"color": {
										"type": [
											"string",
											"null"
										]
									},
									"showsWhile": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"booked",
													"confirmed",
													"arrived",
													"in_chair"
												]
											},
											{
												"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"
										},
										"label": {
											"type": "string"
										},
										"color": {
											"type": [
												"string",
												"null"
											]
										},
										"showsWhile": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"booked",
														"confirmed",
														"arrived",
														"in_chair"
													]
												},
												{
													"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",
										"showsWhile",
										"position",
										"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/appointment-labels/{id}/archive": {
			"post": {
				"summary": "Archive a appointment label",
				"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"
										},
										"label": {
											"type": "string"
										},
										"color": {
											"type": [
												"string",
												"null"
											]
										},
										"showsWhile": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"booked",
														"confirmed",
														"arrived",
														"in_chair"
													]
												},
												{
													"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",
										"showsWhile",
										"position",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/appointment-labels/{id}/restore": {
			"post": {
				"summary": "Restore an archived appointment label",
				"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"
										},
										"label": {
											"type": "string"
										},
										"color": {
											"type": [
												"string",
												"null"
											]
										},
										"showsWhile": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"booked",
														"confirmed",
														"arrived",
														"in_chair"
													]
												},
												{
													"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",
										"showsWhile",
										"position",
										"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/appointment-labels/reorder": {
			"post": {
				"summary": "Reorder appointment labels",
				"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/AppointmentLabel"
											}
										}
									},
									"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/security": {
			"get": {
				"summary": "The practice's session rules and Smileline support access",
				"tags": [
					"settings"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"sessionRules": {
											"$ref": "#/components/schemas/SessionRules"
										},
										"grant": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/SupportGrant"
												},
												{
													"type": "null"
												}
											]
										},
										"visits": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SupportVisit"
											}
										},
										"supportChanged": {
											"type": "object",
											"properties": {
												"automations": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/SupportChangedAutomation"
													}
												},
												"templates": {
													"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"
															},
															"version": {
																"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"
																	}
																]
															}
														},
														"required": [
															"id",
															"name",
															"version",
															"pausedAt"
														],
														"additionalProperties": false
													}
												}
											},
											"required": [
												"automations",
												"templates"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"sessionRules",
										"grant",
										"visits",
										"supportChanged"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/security/session-rules": {
			"patch": {
				"summary": "Change the session rules",
				"tags": [
					"settings"
				],
				"description": "Owners and managers (organization:update). Both rules are off (null) until set. They cover people's own sessions on the web, desktop and phone apps; API keys, connections and Smileline support visits are not covered.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"idleSignoutMinutes": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 15,
												"maximum": 720
											},
											{
												"type": "null"
											}
										]
									},
									"maxSessionHours": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 720
											},
											{
												"type": "null"
											}
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"idleSignoutMinutes": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 15,
													"maximum": 720
												},
												{
													"type": "null"
												}
											]
										},
										"maxSessionHours": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 1,
													"maximum": 720
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"idleSignoutMinutes",
										"maxSessionHours"
									],
									"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/security/support-grants": {
			"post": {
				"summary": "Let Smileline support see this practice",
				"tags": [
					"settings"
				],
				"description": "Look only: anyone with organization:update. Look and change settings: owners and managers only. A new grant ends any live one and its visits.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"mode": {
										"type": "string",
										"enum": [
											"look",
											"change"
										]
									},
									"durationHours": {
										"type": "number",
										"enum": [
											1,
											24,
											168
										]
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"mode",
									"durationHours",
									"reason"
								]
							}
						}
					}
				},
				"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)$"
										},
										"mode": {
											"type": "string",
											"enum": [
												"look",
												"change"
											]
										},
										"reason": {
											"type": "string"
										},
										"grantedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"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))$"
										},
										"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"
												}
											]
										},
										"revokedByName": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"id",
										"mode",
										"reason",
										"grantedByName",
										"startsAt",
										"endsAt",
										"revokedAt",
										"revokedByName"
									],
									"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/security/support-grants/{id}/revoke": {
			"post": {
				"summary": "End Smileline support access now",
				"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)$"
										},
										"mode": {
											"type": "string",
											"enum": [
												"look",
												"change"
											]
										},
										"reason": {
											"type": "string"
										},
										"grantedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"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))$"
										},
										"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"
												}
											]
										},
										"revokedByName": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"id",
										"mode",
										"reason",
										"grantedByName",
										"startsAt",
										"endsAt",
										"revokedAt",
										"revokedByName"
									],
									"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/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": {
										"type": [
											"string",
											"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-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"type": [
											"string",
											"null"
										]
									},
									"addressLine2": {
										"type": [
											"string",
											"null"
										]
									},
									"city": {
										"type": [
											"string",
											"null"
										]
									},
									"province": {
										"type": [
											"string",
											"null"
										]
									},
									"postalCode": {
										"type": [
											"string",
											"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
									},
									"billingEntityId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
								]
							}
						}
					}
				},
				"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": {
										"type": [
											"string",
											"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-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
											},
											{
												"type": "null"
											}
										]
									},
									"addressLine1": {
										"type": [
											"string",
											"null"
										]
									},
									"addressLine2": {
										"type": [
											"string",
											"null"
										]
									},
									"city": {
										"type": [
											"string",
											"null"
										]
									},
									"province": {
										"type": [
											"string",
											"null"
										]
									},
									"postalCode": {
										"type": [
											"string",
											"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
									},
									"billingEntityId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
										"type": [
											"string",
											"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": {
										"type": [
											"string",
											"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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/stock-rooms": {
			"get": {
				"summary": "List stock rooms",
				"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/StockRoom"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a stock room",
				"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
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"locationId",
									"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"
										},
										"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"
										},
										"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",
										"locationId",
										"name",
										"position",
										"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/stock-rooms/{id}": {
			"patch": {
				"summary": "Update a stock room",
				"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
									},
									"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"
										},
										"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"
										},
										"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",
										"locationId",
										"name",
										"position",
										"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/stock-rooms/{id}/archive": {
			"post": {
				"summary": "Archive a stock room",
				"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"
										},
										"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"
										},
										"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",
										"locationId",
										"name",
										"position",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/stock-rooms/{id}/restore": {
			"post": {
				"summary": "Restore an archived stock room",
				"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"
										},
										"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"
										},
										"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",
										"locationId",
										"name",
										"position",
										"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/stock-rooms/reorder": {
			"post": {
				"summary": "Reorder stock rooms",
				"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/StockRoom"
											}
										}
									},
									"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/stock-tags": {
			"get": {
				"summary": "List stock 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/StockTag"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a stock tag",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"color": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-fA-F]{6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"label"
								]
							}
						}
					}
				},
				"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"
										},
										"label": {
											"type": "string"
										},
										"color": {
											"type": [
												"string",
												"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
								}
							}
						}
					},
					"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/stock-tags/{id}": {
			"patch": {
				"summary": "Update a stock 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",
												"pattern": "^#[0-9a-fA-F]{6}$"
											},
											{
												"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"
										},
										"label": {
											"type": "string"
										},
										"color": {
											"type": [
												"string",
												"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
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/stock-tags/{id}/archive": {
			"post": {
				"summary": "Archive a stock 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": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-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": {
											"type": [
												"string",
												"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
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/stock-tags/{id}/restore": {
			"post": {
				"summary": "Restore an archived stock 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": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"organizationId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^[0-9a-f]{8}-[0-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": {
											"type": [
												"string",
												"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
								}
							}
						}
					},
					"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/stock-tags/reorder": {
			"post": {
				"summary": "Reorder stock 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/StockTag"
											}
										}
									},
									"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/stock-fields": {
			"get": {
				"summary": "List item fields",
				"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/StockItemField"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a item field",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1
									},
									"kind": {
										"type": "string",
										"enum": [
											"text",
											"number",
											"date",
											"select"
										]
									},
									"options": {
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1
										}
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"label",
									"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"
										},
										"label": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"text",
												"number",
												"date",
												"select"
											]
										},
										"options": {
											"type": "array",
											"items": {
												"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",
										"kind",
										"options",
										"position",
										"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/stock-fields/{id}": {
			"patch": {
				"summary": "Update a item field",
				"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
									},
									"options": {
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1
										}
									},
									"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"
										},
										"label": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"text",
												"number",
												"date",
												"select"
											]
										},
										"options": {
											"type": "array",
											"items": {
												"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",
										"kind",
										"options",
										"position",
										"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/stock-fields/{id}/archive": {
			"post": {
				"summary": "Archive a item field",
				"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"
										},
										"label": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"text",
												"number",
												"date",
												"select"
											]
										},
										"options": {
											"type": "array",
											"items": {
												"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",
										"kind",
										"options",
										"position",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/stock-fields/{id}/restore": {
			"post": {
				"summary": "Restore an archived item field",
				"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"
										},
										"label": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"text",
												"number",
												"date",
												"select"
											]
										},
										"options": {
											"type": "array",
											"items": {
												"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",
										"kind",
										"options",
										"position",
										"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/stock-fields/reorder": {
			"post": {
				"summary": "Reorder item fields",
				"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/StockItemField"
											}
										}
									},
									"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"
															}
														]
													},
													"hideOtherWorkspace": {
														"type": "boolean"
													},
													"voiceExtension": {
														"type": [
															"string",
															"null"
														]
													},
													"callingRole": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"opener",
																	"closer"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"newLeadWindow": {
														"type": "boolean"
													},
													"goals": {
														"$ref": "#/components/schemas/MemberGoals"
													},
													"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"
															}
														]
													},
													"agencyStaff": {
														"type": "boolean"
													},
													"otherOrganization": {
														"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))$"
													},
													"user": {
														"type": "object",
														"properties": {
															"name": {
																"type": "string"
															},
															"email": {
																"type": "string"
															},
															"image": {
																"type": [
																	"string",
																	"null"
																]
															}
														},
														"required": [
															"name",
															"email",
															"image"
														],
														"additionalProperties": false
													}
												},
												"required": [
													"id",
													"userId",
													"role",
													"defaultWorkspace",
													"hideOtherWorkspace",
													"voiceExtension",
													"newLeadWindow",
													"goals",
													"suspendedAt",
													"agencyStaff",
													"otherOrganization",
													"createdAt",
													"user"
												],
												"additionalProperties": false
											}
										},
										"invitations": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"email": {
														"type": "string"
													},
													"role": {
														"type": [
															"string",
															"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": {
														"type": [
															"string",
															"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, or MEMBER_SITE_HAS_ROTA for a site where they still have a rota (take them off that site's rota first).",
				"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": {
										"type": [
											"string",
											"null"
										]
									},
									"photoUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"userId": {
										"description": "Create linked to this member. Browser session with member:update only (403); 404 when the member is not in the practice, 409 when they already act as a practitioner.",
										"type": "string",
										"minLength": 1
									}
								},
								"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": {
										"type": [
											"string",
											"null"
										]
									},
									"photoUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500,
												"format": "uri"
											},
											{
												"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
															"type": [
																"string",
																"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"
										]
									},
									"checkinEnabled": {
										"type": "boolean"
									},
									"skippedAppointmentTypeIds": {
										"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)$"
										}
									},
									"templateBindings": {
										"maxItems": 16,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"type": "string",
													"enum": [
														"initial",
														"reminder",
														"checkin"
													]
												},
												"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": "Enable or pause a linked Reputation location",
				"tags": [
					"reputation"
				],
				"description": "Only a Google location linked to a practice location; a picker candidate answers 404.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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"
									}
								},
								"required": [
									"enabled"
								]
							}
						}
					}
				},
				"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/google/connections/{id}/location-choices": {
			"get": {
				"summary": "List the Google locations a connection can link",
				"tags": [
					"reputation"
				],
				"description": "Every Google location discovered for the connection, linked or not, for the location picker; `linkedElsewhere` marks one another practice has linked. Only the member who connected the Google account may list them (403 REPUTATION_CONNECTOR_ONLY, also when no connector is recorded: reconnect).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"choices": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReputationLocationChoice"
											}
										}
									},
									"required": [
										"choices"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/reputation/google/connections/{id}/locations": {
			"put": {
				"summary": "Link Google locations to practice locations",
				"tags": [
					"reputation"
				],
				"description": "Replaces the connection's links with exactly these pairs and deletes every other Google location it discovered, with that location's stored reviews, posts and audits — except a location a Social account still posts to, which is kept unlinked and the account marked as needing attention. Reconnect to choose again. Only the member who connected the Google account may link (403 REPUTATION_CONNECTOR_ONLY). A Google location is linked to one practice: 409 REPUTATION_LOCATION_LINKED_ELSEWHERE when another practice holds it, 409 REPUTATION_LOCATION_ALREADY_LINKED when this practice links it (or the practice location) through another Google account, 422 REPUTATION_LINK_DUPLICATE when one save names it twice.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"links": {
										"minItems": 1,
										"maxItems": 1000,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"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)$"
												},
												"crmLocationId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
												"reputationLocationId",
												"crmLocationId"
											]
										}
									}
								},
								"required": [
									"links"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"choices": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReputationLocationChoice"
											}
										}
									},
									"required": [
										"choices"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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/requests/{id}/retry-ask": {
			"post": {
				"summary": "Send a stopped check-in review ask again",
				"tags": [
					"reputation"
				],
				"description": "For a check-in request whose review ask was never accepted and is not in flight (skipped, parked, or the request expired before it went): re-arms the ask with the practice's standard template and a fresh link.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"request": {
											"$ref": "#/components/schemas/ReputationRequest"
										}
									},
									"required": [
										"request"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": "maxRating",
						"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
						}
					},
					{
						"name": "actionCursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					},
					{
						"name": "actionLimit",
						"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/gbp/google-posts": {
			"get": {
				"summary": "Read the live Google posts of a linked Google Business Profile location",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "reputationLocationId",
						"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 4096
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"maxItems": 100,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"minLength": 1,
														"maxLength": 1024
													},
													"summary": {
														"type": "string",
														"maxLength": 12000
													},
													"status": {
														"type": "string",
														"enum": [
															"published",
															"publishing",
															"rejected",
															"unknown"
														]
													},
													"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"
															}
														]
													},
													"viewUrl": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2048,
																"format": "uri"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"id",
													"summary",
													"status",
													"createdAt",
													"viewUrl"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"minLength": 1,
													"maxLength": 4096
												},
												{
													"type": "null"
												}
											]
										},
										"error": {
											"anyOf": [
												{
													"type": "string",
													"const": "unavailable"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"items",
										"nextCursor",
										"error"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/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": "findingStatus",
						"in": "query",
						"required": false,
						"schema": {
							"default": "active",
							"type": "string",
							"enum": [
								"active",
								"resolved"
							]
						}
					},
					{
						"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": "documentStatus",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"draft",
								"in_review",
								"changes_requested",
								"approved",
								"exported"
							]
						}
					},
					{
						"name": "lane",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"writing",
								"in_review",
								"ready",
								"live"
							]
						}
					},
					{
						"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/settings": {
			"get": {
				"summary": "Get the SEO settings and the article reviewers to choose from",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"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"
													}
												}
											},
											"required": [
												"settings",
												"reviewers"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"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"
									},
									"trackingEnabled": {
										"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": {
			"get": {
				"summary": "List SEO actions, one cursor page at a time",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "surface",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"overview",
								"search_visibility",
								"gbp",
								"website",
								"ai_visibility",
								"listings",
								"content"
							]
						}
					},
					{
						"name": "status",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"approved",
								"running",
								"done",
								"failed",
								"dismissed",
								"expired"
							]
						}
					},
					{
						"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": "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
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoActionsPage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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"
										]
									},
									"keywords": {
										"minItems": 1,
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 300
										}
									},
									"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])?)+$"
										}
									},
									"pollOnly": {
										"type": "boolean"
									}
								},
								"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])?)+$"
											}
										},
										"unresolved": {
											"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",
										"unresolved"
									],
									"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/gsc/url-inspection": {
			"post": {
				"summary": "Ask Google whether a page of the connected Search Console site is indexed",
				"tags": [
					"seo"
				],
				"description": "Google's URL Inspection of one page, read live through the practice's Search Console connection and never stored; free at Google. Google allows 2,000 inspections a day per site, counted per practice by Pacific day (429 `GSC_INSPECTION_QUOTA_REACHED` with Retry-After). 404 `GSC_NOT_CONNECTED`; 409 `GSC_PROPERTY_REQUIRED`, `GSC_URL_OUTSIDE_PROPERTY` or `GSC_RECONNECT_REQUIRED`.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"url"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoGscUrlInspection"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/search-visibility/performance": {
			"get": {
				"summary": "Search Console's Performance report joined with Google organic leads",
				"tags": [
					"seo"
				],
				"description": "Read live from Google through the practice's Search Console connection (never stored). Rows are Search Console's top 1,000, as its own report shows; pages add every page with Google organic leads. 404 `GSC_NOT_CONNECTED`; 409 `GSC_PROPERTY_REQUIRED` or `GSC_RECONNECT_REQUIRED`; 400 for an invalid `filters` JSON.",
				"parameters": [
					{
						"name": "searchType",
						"in": "query",
						"required": false,
						"schema": {
							"default": "web",
							"type": "string",
							"enum": [
								"web",
								"image",
								"video",
								"news",
								"discover",
								"googleNews"
							]
						}
					},
					{
						"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": "compare",
						"in": "query",
						"required": false,
						"schema": {
							"default": "previous",
							"type": "string",
							"enum": [
								"none",
								"previous",
								"year"
							]
						}
					},
					{
						"name": "dimension",
						"in": "query",
						"required": false,
						"schema": {
							"default": "query",
							"type": "string",
							"enum": [
								"query",
								"page",
								"country",
								"device",
								"searchAppearance",
								"date"
							]
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 25000
						}
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "clicks",
							"type": "string",
							"enum": [
								"clicks",
								"impressions",
								"ctr",
								"position",
								"leads",
								"booked",
								"won",
								"revenue"
							]
						}
					},
					{
						"name": "order",
						"in": "query",
						"required": false,
						"schema": {
							"default": "desc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "show",
						"in": "query",
						"required": false,
						"schema": {
							"default": "all",
							"type": "string",
							"enum": [
								"all",
								"patients",
								"noLeads"
							]
						}
					},
					{
						"name": "page",
						"in": "query",
						"required": false,
						"schema": {
							"default": 1,
							"type": "integer",
							"minimum": 1,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "pageSize",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"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": {
									"type": "object",
									"properties": {
										"propertyUri": {
											"type": "string",
											"minLength": 1,
											"maxLength": 2048
										},
										"searchType": {
											"type": "string",
											"enum": [
												"web",
												"image",
												"video",
												"news",
												"discover",
												"googleNews"
											]
										},
										"dimension": {
											"type": "string",
											"enum": [
												"query",
												"page",
												"country",
												"device",
												"searchAppearance",
												"date"
											]
										},
										"window": {
											"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
										},
										"compareWindow": {
											"anyOf": [
												{
													"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
												},
												{
													"type": "null"
												}
											]
										},
										"totals": {
											"type": "object",
											"properties": {
												"current": {
													"type": "object",
													"properties": {
														"clicks": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"impressions": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"ctr": {
															"type": "number",
															"minimum": 0
														},
														"position": {
															"anyOf": [
																{
																	"type": "number",
																	"minimum": 0
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"clicks",
														"impressions",
														"ctr",
														"position"
													],
													"additionalProperties": false
												},
												"previous": {
													"anyOf": [
														{
															"type": "object",
															"properties": {
																"clicks": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"impressions": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"ctr": {
																	"type": "number",
																	"minimum": 0
																},
																"position": {
																	"anyOf": [
																		{
																			"type": "number",
																			"minimum": 0
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"required": [
																"clicks",
																"impressions",
																"ctr",
																"position"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"current",
												"previous"
											],
											"additionalProperties": false
										},
										"crm": {
											"type": "object",
											"properties": {
												"current": {
													"type": "object",
													"properties": {
														"leads": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"booked": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"won": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"revenueCents": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"leads",
														"booked",
														"won",
														"revenueCents"
													],
													"additionalProperties": false
												},
												"previous": {
													"anyOf": [
														{
															"type": "object",
															"properties": {
																"leads": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"booked": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"won": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"revenueCents": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"leads",
																"booked",
																"won",
																"revenueCents"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"currency": {
													"type": "string",
													"minLength": 3,
													"maxLength": 3
												},
												"wholePages": {
													"type": "boolean"
												}
											},
											"required": [
												"current",
												"previous",
												"currency",
												"wholePages"
											],
											"additionalProperties": false
										},
										"series": {
											"maxItems": 500,
											"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])))$"
													},
													"current": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"clicks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"impressions": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"ctr": {
																		"type": "number",
																		"minimum": 0
																	},
																	"position": {
																		"anyOf": [
																			{
																				"type": "number",
																				"minimum": 0
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"clicks",
																	"impressions",
																	"ctr",
																	"position"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"previous": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"clicks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"impressions": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"ctr": {
																		"type": "number",
																		"minimum": 0
																	},
																	"position": {
																		"anyOf": [
																			{
																				"type": "number",
																				"minimum": 0
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"clicks",
																	"impressions",
																	"ctr",
																	"position"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"leads": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"date",
													"current",
													"previous",
													"leads"
												],
												"additionalProperties": false
											}
										},
										"rows": {
											"maxItems": 100,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"key": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2048
													},
													"current": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"clicks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"impressions": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"ctr": {
																		"type": "number",
																		"minimum": 0
																	},
																	"position": {
																		"anyOf": [
																			{
																				"type": "number",
																				"minimum": 0
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"clicks",
																	"impressions",
																	"ctr",
																	"position"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"previous": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"clicks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"impressions": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"ctr": {
																		"type": "number",
																		"minimum": 0
																	},
																	"position": {
																		"anyOf": [
																			{
																				"type": "number",
																				"minimum": 0
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"clicks",
																	"impressions",
																	"ctr",
																	"position"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"crm": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"leads": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"booked": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"won": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"revenueCents": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"leads",
																	"booked",
																	"won",
																	"revenueCents"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"trackedKeywordId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": [
													"key",
													"current",
													"previous",
													"crm",
													"trackedKeywordId"
												],
												"additionalProperties": false
											}
										},
										"totalRows": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"showCounts": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"all": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"patients": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"noLeads": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"all",
														"patients",
														"noLeads"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"truncated": {
											"type": "boolean"
										}
									},
									"required": [
										"propertyUri",
										"searchType",
										"dimension",
										"window",
										"compareWindow",
										"totals",
										"crm",
										"series",
										"rows",
										"totalRows",
										"showCounts",
										"truncated"
									],
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/search-visibility/performance.csv": {
			"get": {
				"summary": "The Performance report's rows as CSV",
				"tags": [
					"seo"
				],
				"description": "The same rows as `/seo/search-visibility/performance` (Search Console's top 1,000 plus pages with leads), every page of them, as a CSV download.",
				"parameters": [
					{
						"name": "searchType",
						"in": "query",
						"required": false,
						"schema": {
							"default": "web",
							"type": "string",
							"enum": [
								"web",
								"image",
								"video",
								"news",
								"discover",
								"googleNews"
							]
						}
					},
					{
						"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": "compare",
						"in": "query",
						"required": false,
						"schema": {
							"default": "previous",
							"type": "string",
							"enum": [
								"none",
								"previous",
								"year"
							]
						}
					},
					{
						"name": "dimension",
						"in": "query",
						"required": false,
						"schema": {
							"default": "query",
							"type": "string",
							"enum": [
								"query",
								"page",
								"country",
								"device",
								"searchAppearance",
								"date"
							]
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 25000
						}
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"schema": {
							"default": "clicks",
							"type": "string",
							"enum": [
								"clicks",
								"impressions",
								"ctr",
								"position",
								"leads",
								"booked",
								"won",
								"revenue"
							]
						}
					},
					{
						"name": "order",
						"in": "query",
						"required": false,
						"schema": {
							"default": "desc",
							"type": "string",
							"enum": [
								"asc",
								"desc"
							]
						}
					},
					{
						"name": "show",
						"in": "query",
						"required": false,
						"schema": {
							"default": "all",
							"type": "string",
							"enum": [
								"all",
								"patients",
								"noLeads"
							]
						}
					},
					{
						"name": "page",
						"in": "query",
						"required": false,
						"schema": {
							"default": 1,
							"type": "integer",
							"minimum": 1,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "pageSize",
						"in": "query",
						"required": false,
						"schema": {
							"default": 25,
							"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": {
							"text/csv": {
								"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/search-visibility/tracked": {
			"get": {
				"summary": "Google's last 28 days for a location's tracked searches",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"window": {
											"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
										},
										"keywords": {
											"type": "array",
											"items": {
												"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)$"
													},
													"metrics": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"clicks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"impressions": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"ctr": {
																		"type": "number",
																		"minimum": 0
																	},
																	"position": {
																		"anyOf": [
																			{
																				"type": "number",
																				"minimum": 0
																			},
																			{
																				"type": "null"
																			}
																		]
																	}
																},
																"required": [
																	"clicks",
																	"impressions",
																	"ctr",
																	"position"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"keywordId",
													"metrics"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"window",
										"keywords"
									],
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/search-visibility/insights": {
			"get": {
				"summary": "Search Console insights: the last 28 days against the 28 before",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"window": {
											"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
										},
										"biggestGain": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"page": {
															"type": "string",
															"maxLength": 2048,
															"format": "uri"
														},
														"clicks": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"previousClicks": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"page",
														"clicks",
														"previousClicks"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"biggestDrop": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"page": {
															"type": "string",
															"maxLength": 2048,
															"format": "uri"
														},
														"clicks": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"previousClicks": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"position": {
															"anyOf": [
																{
																	"type": "number",
																	"minimum": 0
																},
																{
																	"type": "null"
																}
															]
														},
														"previousPosition": {
															"anyOf": [
																{
																	"type": "number",
																	"minimum": 0
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"page",
														"clicks",
														"previousClicks",
														"position",
														"previousPosition"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"newSearches": {
											"type": "object",
											"properties": {
												"count": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"example": {
													"anyOf": [
														{
															"type": "string",
															"minLength": 1,
															"maxLength": 2048
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"count",
												"example"
											],
											"additionalProperties": false
										},
										"countries": {
											"maxItems": 3,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"country": {
														"type": "string",
														"minLength": 1,
														"maxLength": 8
													},
													"clicks": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"share": {
														"type": "number",
														"minimum": 0,
														"maximum": 1
													}
												},
												"required": [
													"country",
													"clicks",
													"share"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"window",
										"biggestGain",
										"biggestDrop",
										"newSearches",
										"countries"
									],
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/search-visibility/indexing": {
			"get": {
				"summary": "Which of the site's pages Google shows, from Smileline's daily page check",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "reason",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"on_google",
								"redirect",
								"duplicate_google_chose",
								"duplicate_no_canonical",
								"alternate_canonical",
								"crawled_not_indexed",
								"discovered_not_indexed",
								"noindex",
								"not_found",
								"soft_404",
								"robots_blocked",
								"server_error",
								"redirect_error",
								"access_blocked",
								"unknown_to_google",
								"other",
								"unchecked"
							]
						}
					},
					{
						"name": "page",
						"in": "query",
						"required": false,
						"schema": {
							"default": 1,
							"type": "integer",
							"minimum": 1,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"propertyUri": {
											"type": "string",
											"minLength": 1,
											"maxLength": 2048
										},
										"run": {
											"type": "object",
											"properties": {
												"day": {
													"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"
														}
													]
												},
												"state": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"running",
																"waiting",
																"done",
																"partial",
																"parked"
															]
														},
														{
															"type": "null"
														}
													]
												},
												"checked": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"known": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"day",
												"state",
												"checked",
												"known"
											],
											"additionalProperties": false
										},
										"counts": {
											"type": "object",
											"properties": {
												"onGoogle": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"notOnGoogle": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"unknown": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"onGoogle",
												"notOnGoogle",
												"unknown"
											],
											"additionalProperties": false
										},
										"trend": {
											"maxItems": 120,
											"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])))$"
													},
													"onGoogle": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"notOnGoogle": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"unknown": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"date",
													"onGoogle",
													"notOnGoogle",
													"unknown"
												],
												"additionalProperties": false
											}
										},
										"reasons": {
											"maxItems": 17,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"reason": {
														"type": "string",
														"enum": [
															"on_google",
															"redirect",
															"duplicate_google_chose",
															"duplicate_no_canonical",
															"alternate_canonical",
															"crawled_not_indexed",
															"discovered_not_indexed",
															"noindex",
															"not_found",
															"soft_404",
															"robots_blocked",
															"server_error",
															"redirect_error",
															"access_blocked",
															"unknown_to_google",
															"other",
															"unchecked"
														]
													},
													"fixer": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"website",
																	"google"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"pages": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"reason",
													"fixer",
													"pages"
												],
												"additionalProperties": false
											}
										},
										"pages": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"reason": {
															"type": "string",
															"enum": [
																"on_google",
																"redirect",
																"duplicate_google_chose",
																"duplicate_no_canonical",
																"alternate_canonical",
																"crawled_not_indexed",
																"discovered_not_indexed",
																"noindex",
																"not_found",
																"soft_404",
																"robots_blocked",
																"server_error",
																"redirect_error",
																"access_blocked",
																"unknown_to_google",
																"other",
																"unchecked"
															]
														},
														"items": {
															"maxItems": 25,
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"url": {
																		"type": "string",
																		"maxLength": 2048,
																		"format": "uri"
																	},
																	"coverageState": {
																		"anyOf": [
																			{
																				"type": "string",
																				"maxLength": 300
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"lastCrawlAt": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "date-time",
																				"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"lastInspectedAt": {
																		"anyOf": [
																			{
																				"type": "string",
																				"format": "date-time",
																				"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"leads": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"url",
																	"coverageState",
																	"lastCrawlAt",
																	"lastInspectedAt",
																	"leads"
																],
																"additionalProperties": false
															}
														},
														"total": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"reason",
														"items",
														"total"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"sitemaps": {
											"anyOf": [
												{
													"maxItems": 500,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"url": {
																"type": "string",
																"maxLength": 2048,
																"format": "uri"
															},
															"isIndex": {
																"type": "boolean"
															},
															"readState": {
																"type": "string",
																"enum": [
																	"pending",
																	"read",
																	"too_large",
																	"failed"
																]
															},
															"urlsFound": {
																"type": "integer",
																"minimum": 0,
																"maximum": 9007199254740991
															},
															"lastReadAt": {
																"anyOf": [
																	{
																		"type": "string",
																		"format": "date-time",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"google": {
																"anyOf": [
																	{
																		"type": "object",
																		"properties": {
																			"lastSubmitted": {
																				"anyOf": [
																					{
																						"type": "string",
																						"format": "date-time",
																						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																					},
																					{
																						"type": "null"
																					}
																				]
																			},
																			"lastDownloaded": {
																				"anyOf": [
																					{
																						"type": "string",
																						"format": "date-time",
																						"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																					},
																					{
																						"type": "null"
																					}
																				]
																			},
																			"isPending": {
																				"type": "boolean"
																			},
																			"warnings": {
																				"type": "integer",
																				"minimum": 0,
																				"maximum": 9007199254740991
																			},
																			"errors": {
																				"type": "integer",
																				"minimum": 0,
																				"maximum": 9007199254740991
																			}
																		},
																		"required": [
																			"lastSubmitted",
																			"lastDownloaded",
																			"isPending",
																			"warnings",
																			"errors"
																		],
																		"additionalProperties": false
																	},
																	{
																		"type": "null"
																	}
																]
															}
														},
														"required": [
															"url",
															"isIndex",
															"readState",
															"urlsFound",
															"lastReadAt",
															"google"
														],
														"additionalProperties": false
													}
												},
												{
													"type": "null"
												}
											]
										},
										"canSendSitemaps": {
											"type": "boolean"
										}
									},
									"required": [
										"propertyUri",
										"run",
										"counts",
										"trend",
										"reasons",
										"pages",
										"sitemaps",
										"canSendSitemaps"
									],
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/google/gsc/sitemaps": {
			"post": {
				"summary": "Send a sitemap to Google Search Console",
				"tags": [
					"seo"
				],
				"description": "Only the member who connected Search Console. 409 `GSC_SITEMAP_PERMISSION_NEEDED` until Google's wider permission is granted (connect with `access=manage`); 409 `GSC_URL_OUTSIDE_PROPERTY` for an address off the site.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"url"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/search-visibility/enhancements": {
			"get": {
				"summary": "The extras Google can show for the site's pages, and their problems",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "type",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 100
						}
					},
					{
						"name": "page",
						"in": "query",
						"required": false,
						"schema": {
							"default": 1,
							"type": "integer",
							"minimum": 1,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"types": {
											"maxItems": 50,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"working": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"warnings": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"broken": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"type",
													"working",
													"warnings",
													"broken"
												],
												"additionalProperties": false
											}
										},
										"pages": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"type": {
															"type": "string",
															"minLength": 1,
															"maxLength": 100
														},
														"items": {
															"maxItems": 25,
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"url": {
																		"type": "string",
																		"maxLength": 2048,
																		"format": "uri"
																	},
																	"state": {
																		"type": "string",
																		"enum": [
																			"broken",
																			"warning"
																		]
																	},
																	"issues": {
																		"maxItems": 5,
																		"type": "array",
																		"items": {
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 300
																		}
																	},
																	"leads": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"url",
																	"state",
																	"issues",
																	"leads"
																],
																"additionalProperties": false
															}
														},
														"total": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"type",
														"items",
														"total"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"checkedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
										"types",
										"pages",
										"checkedAt"
									],
									"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/search-visibility/experience": {
			"get": {
				"summary": "Real-visitor speed, HTTPS and the website check's speed",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"vitals": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"phone": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"lcp": {
																			"anyOf": [
																				{
																					"type": "object",
																					"properties": {
																						"p75": {
																							"type": "number",
																							"minimum": 0
																						},
																						"good": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"needsImprovement": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"poor": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					},
																					"required": [
																						"p75",
																						"good",
																						"needsImprovement",
																						"poor"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"inp": {
																			"anyOf": [
																				{
																					"type": "object",
																					"properties": {
																						"p75": {
																							"type": "number",
																							"minimum": 0
																						},
																						"good": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"needsImprovement": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"poor": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					},
																					"required": [
																						"p75",
																						"good",
																						"needsImprovement",
																						"poor"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"cls": {
																			"anyOf": [
																				{
																					"type": "object",
																					"properties": {
																						"p75": {
																							"type": "number",
																							"minimum": 0
																						},
																						"good": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"needsImprovement": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"poor": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					},
																					"required": [
																						"p75",
																						"good",
																						"needsImprovement",
																						"poor"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"collectionEnd": {
																			"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": [
																		"lcp",
																		"inp",
																		"cls",
																		"collectionEnd"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														},
														"desktop": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"lcp": {
																			"anyOf": [
																				{
																					"type": "object",
																					"properties": {
																						"p75": {
																							"type": "number",
																							"minimum": 0
																						},
																						"good": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"needsImprovement": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"poor": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					},
																					"required": [
																						"p75",
																						"good",
																						"needsImprovement",
																						"poor"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"inp": {
																			"anyOf": [
																				{
																					"type": "object",
																					"properties": {
																						"p75": {
																							"type": "number",
																							"minimum": 0
																						},
																						"good": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"needsImprovement": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"poor": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					},
																					"required": [
																						"p75",
																						"good",
																						"needsImprovement",
																						"poor"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"cls": {
																			"anyOf": [
																				{
																					"type": "object",
																					"properties": {
																						"p75": {
																							"type": "number",
																							"minimum": 0
																						},
																						"good": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"needsImprovement": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						},
																						"poor": {
																							"type": "number",
																							"minimum": 0,
																							"maximum": 1
																						}
																					},
																					"required": [
																						"p75",
																						"good",
																						"needsImprovement",
																						"poor"
																					],
																					"additionalProperties": false
																				},
																				{
																					"type": "null"
																				}
																			]
																		},
																		"collectionEnd": {
																			"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": [
																		"lcp",
																		"inp",
																		"cls",
																		"collectionEnd"
																	],
																	"additionalProperties": false
																},
																{
																	"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": [
														"phone",
														"desktop",
														"fetchedAt"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"pages": {
											"maxItems": 100,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"url": {
														"type": "string",
														"maxLength": 2048,
														"format": "uri"
													},
													"lcp": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"p75": {
																		"type": "number",
																		"minimum": 0
																	},
																	"good": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	},
																	"needsImprovement": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	},
																	"poor": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	}
																},
																"required": [
																	"p75",
																	"good",
																	"needsImprovement",
																	"poor"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"inp": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"p75": {
																		"type": "number",
																		"minimum": 0
																	},
																	"good": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	},
																	"needsImprovement": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	},
																	"poor": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	}
																},
																"required": [
																	"p75",
																	"good",
																	"needsImprovement",
																	"poor"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"cls": {
														"anyOf": [
															{
																"type": "object",
																"properties": {
																	"p75": {
																		"type": "number",
																		"minimum": 0
																	},
																	"good": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	},
																	"needsImprovement": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	},
																	"poor": {
																		"type": "number",
																		"minimum": 0,
																		"maximum": 1
																	}
																},
																"required": [
																	"p75",
																	"good",
																	"needsImprovement",
																	"poor"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													},
													"clicks": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"leads": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"url",
													"lcp",
													"inp",
													"cls",
													"clicks",
													"leads"
												],
												"additionalProperties": false
											}
										},
										"https": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"https": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"http": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"checkedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														}
													},
													"required": [
														"https",
														"http",
														"checkedAt"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"speed": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"score": {
															"type": "number",
															"minimum": 0,
															"maximum": 100
														},
														"checkedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														}
													},
													"required": [
														"score",
														"checkedAt"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"vitals",
										"pages",
										"https",
										"speed"
									],
									"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/search-visibility/links": {
			"get": {
				"summary": "Links from other sites and inside the site",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"backlinks": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"checkedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"backlinks": {
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																{
																	"type": "null"
																}
															]
														},
														"referringDomains": {
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																{
																	"type": "null"
																}
															]
														},
														"newReferringDomains": {
															"anyOf": [
																{
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																{
																	"type": "null"
																}
															]
														},
														"topDomains": {
															"maxItems": 100,
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"domain": {
																		"type": "string",
																		"minLength": 1,
																		"maxLength": 253
																	},
																	"backlinks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"domain",
																	"backlinks"
																],
																"additionalProperties": false
															}
														},
														"anchors": {
															"maxItems": 100,
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"anchor": {
																		"type": "string",
																		"maxLength": 500
																	},
																	"backlinks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"anchor",
																	"backlinks"
																],
																"additionalProperties": false
															}
														},
														"topPages": {
															"maxItems": 100,
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"url": {
																		"type": "string",
																		"maxLength": 2048,
																		"format": "uri"
																	},
																	"backlinks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"leads": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"url",
																	"backlinks",
																	"leads"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"checkedAt",
														"backlinks",
														"referringDomains",
														"newReferringDomains",
														"topDomains",
														"anchors",
														"topPages"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"internal": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"checkedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														},
														"pages": {
															"maxItems": 500,
															"type": "array",
															"items": {
																"type": "object",
																"properties": {
																	"url": {
																		"type": "string",
																		"maxLength": 2048,
																		"format": "uri"
																	},
																	"inboundLinks": {
																		"type": "integer",
																		"minimum": 0,
																		"maximum": 9007199254740991
																	},
																	"onGoogle": {
																		"type": [
																			"boolean",
																			"null"
																		]
																	}
																},
																"required": [
																	"url",
																	"inboundLinks",
																	"onGoogle"
																],
																"additionalProperties": false
															}
														}
													},
													"required": [
														"checkedAt",
														"pages"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"backlinks",
										"internal"
									],
									"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/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": {
								"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": [
											"clientRef",
											"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"
											},
											"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))$"
											},
											"offerCouponCode": {
												"type": "string",
												"maxLength": 100
											},
											"offerRedeemUrl": {
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											"offerTerms": {
												"type": "string",
												"maxLength": 5000
											}
										},
										"required": [
											"clientRef",
											"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)$"
											},
											"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": [
											"clientRef",
											"locationId",
											"reputationLocationId",
											"summary",
											"topicType",
											"eventTitle",
											"eventStartsAt",
											"eventEndsAt"
										]
									}
								]
							}
						}
					}
				},
				"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"
											}
										]
									},
									"offerRedeemUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"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": {
										"type": "integer",
										"minimum": 1,
										"maximum": 10000
									}
								},
								"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-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 content 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/start": {
			"post": {
				"summary": "Start a Content Studio document and queue its research 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
									}
								},
								"required": [
									"clientRef",
									"locationId",
									"targetPhrase"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					},
					"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}/research": {
			"post": {
				"summary": "Queue fresh research for a document whose brief failed",
				"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)$"
									},
									"targetPhrase": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									}
								},
								"required": [
									"clientRef"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"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/{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"
											}
										]
									},
									"metaTitle": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 300
											},
											{
												"type": "null"
											}
										]
									},
									"metaDescription": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 1000
											},
											{
												"type": "null"
											}
										]
									},
									"planJson": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/SeoArticlePlan"
											},
											{
												"type": "null"
											}
										]
									},
									"cover": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/SeoArticleCover"
											},
											{
												"type": "null"
											}
										]
									},
									"slug": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200,
												"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
											},
											{
												"type": "null"
											}
										]
									},
									"termSettings": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/SeoArticleTermSettings"
											},
											{
												"type": "null"
											}
										]
									},
									"liveUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"editOutcomes": {
										"minItems": 1,
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"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)$"
												},
												"editId": {
													"type": "string",
													"minLength": 1,
													"maxLength": 40
												},
												"outcome": {
													"type": "string",
													"enum": [
														"accepted",
														"rejected"
													]
												}
											},
											"required": [
												"runId",
												"editId",
												"outcome"
											]
										}
									}
								},
								"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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a Content Studio article that has no saved version",
				"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/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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Discard an unused picture made for the article",
				"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": {
					"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/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}/review": {
			"post": {
				"summary": "Cut a revision and send the article for 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
									},
									"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"
											}
										]
									},
									"note": {
										"type": "string",
										"maxLength": 2000
									}
								},
								"required": [
									"version",
									"reviewerPractitionerId"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					}
				}
			},
			"get": {
				"summary": "Read the article's current review round",
				"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/SeoArticleReview"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/approve": {
			"post": {
				"summary": "Approve and clinically attest the round's reviewed 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
									},
									"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)$"
									},
									"remindAfterMonths": {
										"anyOf": [
											{
												"anyOf": [
													{
														"type": "number",
														"const": 6
													},
													{
														"type": "number",
														"const": 12
													}
												]
											},
											{
												"type": "null"
											}
										]
									},
									"reviewNote": {
										"type": "string",
										"maxLength": 4000
									}
								},
								"required": [
									"version",
									"reviewerPractitionerId",
									"remindAfterMonths"
								]
							}
						}
					}
				},
				"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}/review/start": {
			"post": {
				"summary": "Open the review round of an article sent before rounds",
				"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": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleReviewRound"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/review/claims/retry": {
			"post": {
				"summary": "Check the round's claims again after a failed attempt",
				"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/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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/review/claims/{claimId}": {
			"post": {
				"summary": "Mark one claim checked or commented",
				"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": "claimId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"reviewGeneration": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"state": {
										"type": "string",
										"enum": [
											"ok",
											"commented"
										]
									},
									"commentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"reviewGeneration",
									"state"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleReviewClaim"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/review/suggested": {
			"put": {
				"summary": "Save the reviewer copy under its own compare-and-set",
				"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": {
									"reviewId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"reviewGeneration": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"baseRevisionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"suggestedVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"suggestedJson": {
										"description": "Reviewer copy; 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"
									}
								},
								"required": [
									"reviewId",
									"reviewGeneration",
									"baseRevisionId",
									"suggestedVersion",
									"suggestedJson"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleSuggestedSaved"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/review-edit": {
			"post": {
				"summary": "A reviewer's own edit: a new reviewed revision and claims run",
				"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
									},
									"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"
									}
								},
								"required": [
									"version",
									"contentJson"
								]
							}
						}
					}
				},
				"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}/review/send-back": {
			"post": {
				"summary": "Send the article back with the frozen suggestions",
				"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
									},
									"reviewId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"suggestedVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"note": {
										"type": "string",
										"maxLength": 2000
									}
								},
								"required": [
									"version",
									"reviewId",
									"suggestedVersion",
									"note"
								]
							}
						}
					}
				},
				"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}/review/suggestions/accept-all": {
			"post": {
				"summary": "Accept every open suggested edit that still fits",
				"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": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleAcceptAll"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/review/suggestions/{suggestionId}/accept": {
			"post": {
				"summary": "Accept one suggested edit into the 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)$"
						}
					},
					{
						"name": "suggestionId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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}/review/suggestions/{suggestionId}/reject": {
			"post": {
				"summary": "Reject one suggested edit",
				"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": "suggestionId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleReviewSuggestion"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/comments": {
			"get": {
				"summary": "Read the article's comment threads, newest first",
				"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": "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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleCommentPage"
								}
							}
						}
					},
					"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": "Comment on the article or reply to a comment",
				"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)$"
									},
									"anchor": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "text"
													},
													"quote": {
														"type": "object",
														"properties": {
															"exact": {
																"type": "string",
																"minLength": 1,
																"maxLength": 1000
															},
															"prefix": {
																"type": "string",
																"maxLength": 64
															},
															"suffix": {
																"type": "string",
																"maxLength": 64
															}
														},
														"required": [
															"exact",
															"prefix",
															"suffix"
														],
														"additionalProperties": false
													}
												},
												"required": [
													"kind",
													"quote"
												],
												"additionalProperties": false
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "article"
													}
												},
												"required": [
													"kind"
												],
												"additionalProperties": false
											}
										]
									},
									"body": {
										"type": "string",
										"minLength": 1,
										"maxLength": 4000
									},
									"parentId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
									"anchor",
									"body"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleComment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/comments/{commentId}/resolve": {
			"post": {
				"summary": "Resolve a comment (its author or a reviewer)",
				"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": "commentId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleComment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/comments/{commentId}/reopen": {
			"post": {
				"summary": "Reopen a resolved comment (its author or a reviewer)",
				"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": "commentId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticleComment"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/{revisionId}": {
			"get": {
				"summary": "Read one revision's content and 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)$"
						}
					},
					{
						"name": "revisionId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SeoContentRevisionRead"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/revisions/{revisionId}/restore": {
			"post": {
				"summary": "Make a new draft from one 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)$"
						}
					},
					{
						"name": "revisionId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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}/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}/publish/schedule": {
			"post": {
				"summary": "Schedule the approved article for the website blog",
				"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": {
									"siteId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"slug": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200,
										"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
									},
									"localDate": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"localMinutes": {
										"type": "integer",
										"minimum": 0,
										"maximum": 1439
									},
									"approvedRevisionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
									}
								},
								"required": [
									"siteId",
									"slug",
									"localDate",
									"localMinutes",
									"approvedRevisionId",
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticlePublishState"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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": "Cancel the article's blog schedule",
				"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/SeoArticlePublishState"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/publish/schedule/retry": {
			"post": {
				"summary": "Start the failed blog schedule again",
				"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": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoArticlePublishState"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/ai/meta": {
			"post": {
				"summary": "Suggest an SEO title and meta description with AI",
				"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": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentMetaSuggestion"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/ai/rewrite": {
			"post": {
				"summary": "Rewrite one selected passage with AI",
				"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)$"
									},
									"text": {
										"type": "string",
										"minLength": 1,
										"maxLength": 5000
									},
									"style": {
										"type": "string",
										"enum": [
											"clearer",
											"friendlier",
											"shorter",
											"simpler",
											"longer",
											"grammar",
											"practice_fact",
											"rules",
											"custom"
										]
									},
									"instruction": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									}
								},
								"required": [
									"clientRef",
									"text",
									"style"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoContentRewrite"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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}/pages/selection": {
			"post": {
				"summary": "Tick the pages research learns from and recompute the brief",
				"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": {
									"selectionVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"selectedPageIds": {
										"maxItems": 40,
										"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": [
									"selectionVersion",
									"selectedPageIds"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/pages": {
			"post": {
				"summary": "Add a page to learn from by its link",
				"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)$"
									},
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"clientRef",
									"url"
								]
							}
						}
					}
				},
				"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)$"
										},
										"rank": {
											"anyOf": [
												{
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"serp",
												"link",
												"import"
											]
										},
										"url": {
											"type": "string",
											"minLength": 1,
											"maxLength": 2048
										},
										"title": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 500
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"health_info",
												"practice",
												"encyclopaedia",
												"guide",
												"directory",
												"page"
											]
										},
										"fetchStatus": {
											"type": "string",
											"enum": [
												"queued",
												"reading",
												"read",
												"failed"
											]
										},
										"fetchError": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 500
												},
												{
													"type": "null"
												}
											]
										},
										"wordCount": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"aiCited": {
											"type": "string",
											"enum": [
												"yes",
												"no",
												"unknown"
											]
										},
										"score": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 100
												},
												{
													"type": "null"
												}
											]
										},
										"selected": {
											"type": "boolean"
										},
										"headings": {
											"anyOf": [
												{
													"maxItems": 100,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"level": {
																"anyOf": [
																	{
																		"type": "number",
																		"const": 1
																	},
																	{
																		"type": "number",
																		"const": 2
																	},
																	{
																		"type": "number",
																		"const": 3
																	}
																]
															},
															"text": {
																"type": "string",
																"maxLength": 300
															}
														},
														"required": [
															"level",
															"text"
														],
														"additionalProperties": false
													}
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"rank",
										"source",
										"url",
										"title",
										"kind",
										"fetchStatus",
										"fetchError",
										"wordCount",
										"aiCited",
										"score",
										"selected",
										"headings"
									],
									"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/documents/{id}/pages/more": {
			"post": {
				"summary": "Read Google results 11 to 20",
				"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": {
									"type": "object",
									"properties": {
										"queued": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"queued"
									],
									"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/documents/{id}/pages/{pageId}/retry": {
			"post": {
				"summary": "Read one page to learn from again",
				"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": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"type": "object",
									"properties": {
										"id": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"rank": {
											"anyOf": [
												{
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"serp",
												"link",
												"import"
											]
										},
										"url": {
											"type": "string",
											"minLength": 1,
											"maxLength": 2048
										},
										"title": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 500
												},
												{
													"type": "null"
												}
											]
										},
										"kind": {
											"type": "string",
											"enum": [
												"health_info",
												"practice",
												"encyclopaedia",
												"guide",
												"directory",
												"page"
											]
										},
										"fetchStatus": {
											"type": "string",
											"enum": [
												"queued",
												"reading",
												"read",
												"failed"
											]
										},
										"fetchError": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 500
												},
												{
													"type": "null"
												}
											]
										},
										"wordCount": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"aiCited": {
											"type": "string",
											"enum": [
												"yes",
												"no",
												"unknown"
											]
										},
										"score": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 100
												},
												{
													"type": "null"
												}
											]
										},
										"selected": {
											"type": "boolean"
										},
										"headings": {
											"anyOf": [
												{
													"maxItems": 100,
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"level": {
																"anyOf": [
																	{
																		"type": "number",
																		"const": 1
																	},
																	{
																		"type": "number",
																		"const": 2
																	},
																	{
																		"type": "number",
																		"const": 3
																	}
																]
															},
															"text": {
																"type": "string",
																"maxLength": 300
															}
														},
														"required": [
															"level",
															"text"
														],
														"additionalProperties": false
													}
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"rank",
										"source",
										"url",
										"title",
										"kind",
										"fetchStatus",
										"fetchError",
										"wordCount",
										"aiCited",
										"score",
										"selected",
										"headings"
									],
									"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/documents/{id}/pages/{pageId}/receipt": {
			"get": {
				"summary": "Inspect what a page to learn from answered",
				"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": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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",
											"minLength": 1,
											"maxLength": 2048
										},
										"finalUrl": {
											"anyOf": [
												{
													"type": "string",
													"maxLength": 2048
												},
												{
													"type": "null"
												}
											]
										},
										"status": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 999
												},
												{
													"type": "null"
												}
											]
										},
										"headers": {
											"type": "object",
											"propertyNames": {
												"type": "string"
											},
											"additionalProperties": {
												"type": "string"
											}
										},
										"fetchedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"bodyBytes": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"truncated": {
											"type": "boolean"
										},
										"interrupted": {
											"type": "boolean"
										},
										"body": {
											"type": "string"
										}
									},
									"required": [
										"url",
										"finalUrl",
										"status",
										"headers",
										"fetchedAt",
										"bodyBytes",
										"truncated",
										"interrupted",
										"body"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/word-details": {
			"get": {
				"summary": "Where the ticked pages use one word or phrase",
				"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": "term",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"term": {
											"type": "string",
											"minLength": 1,
											"maxLength": 200
										},
										"pages": {
											"maxItems": 40,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 500
															},
															{
																"type": "null"
															}
														]
													},
													"url": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2048
													},
													"uses": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"pageId",
													"title",
													"url",
													"uses"
												],
												"additionalProperties": false
											}
										},
										"examples": {
											"maxItems": 3,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"sentence": {
														"type": "string",
														"maxLength": 1000
													}
												},
												"required": [
													"pageId",
													"sentence"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"term",
										"pages",
										"examples"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/plan/generate": {
			"post": {
				"summary": "Queue a version-fenced AI plan",
				"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
									}
								},
								"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}/plan/parts/{partId}/key-points": {
			"post": {
				"summary": "Suggest key points for one part of the plan",
				"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": "partId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									}
								},
								"required": [
									"clientRef",
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"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)$"
										},
										"keyPoints": {
											"maxItems": 5,
											"type": "array",
											"items": {
												"type": "string",
												"minLength": 1,
												"maxLength": 300
											}
										}
									},
									"required": [
										"runId",
										"keyPoints"
									],
									"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/documents/{id}/runs/{runId}/reply": {
			"get": {
				"summary": "Inspect an AI run's kept reply",
				"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 999
												},
												{
													"type": "null"
												}
											]
										},
										"headers": {
											"type": "object",
											"propertyNames": {
												"type": "string"
											},
											"additionalProperties": {
												"type": "string"
											}
										},
										"incomplete": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"overflow",
														"interrupted",
														"invalid_utf8"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"capturedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"body": {
											"type": "string"
										}
									},
									"required": [
										"status",
										"headers",
										"incomplete",
										"capturedAt",
										"body"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/ai/part": {
			"post": {
				"summary": "Write one part of the article with AI",
				"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
									},
									"mode": {
										"type": "string",
										"enum": [
											"section",
											"continue"
										]
									},
									"partId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"after": {
										"type": "integer",
										"minimum": 0,
										"maximum": 10000
									}
								},
								"required": [
									"clientRef",
									"version",
									"mode",
									"after"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"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)$"
										},
										"edits": {
											"maxItems": 1000,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SeoArticleBlockEdit"
											}
										}
									},
									"required": [
										"runId"
									],
									"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/documents/{id}/ai/chat": {
			"post": {
				"summary": "Ask AI about the article",
				"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
									},
									"message": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"clientRef",
									"version",
									"message"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"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)$"
										},
										"reply": {
											"type": "string",
											"maxLength": 4000
										},
										"edits": {
											"maxItems": 1000,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SeoArticleBlockEdit"
											}
										}
									},
									"required": [
										"runId"
									],
									"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/documents/{id}/ai/fix": {
			"post": {
				"summary": "Propose fixes for the article's issues with AI",
				"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
									},
									"only": {
										"type": "string",
										"enum": [
											"missing_terms"
										]
									}
								},
								"required": [
									"clientRef",
									"version"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"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)$"
										},
										"edits": {
											"maxItems": 1000,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SeoArticleBlockEdit"
											}
										}
									},
									"required": [
										"runId"
									],
									"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/documents/{id}/ai/picture": {
			"post": {
				"summary": "Make pictures for the article with AI",
				"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)$"
									},
									"prompt": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1000
									},
									"style": {
										"type": "string",
										"enum": [
											"photo",
											"illustration",
											"sketch"
										]
									},
									"count": {
										"anyOf": [
											{
												"type": "number",
												"const": 1
											},
											{
												"type": "number",
												"const": 2
											},
											{
												"type": "number",
												"const": 4
											}
										]
									}
								},
								"required": [
									"clientRef",
									"prompt",
									"style",
									"count"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"pictures": {
											"maxItems": 4,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"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)$"
													},
													"status": {
														"type": "string",
														"enum": [
															"queued",
															"running",
															"completed",
															"failed",
															"cancelled",
															"applied",
															"conflict",
															"budget_blocked"
														]
													},
													"lastError": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2000
															},
															{
																"type": "null"
															}
														]
													},
													"asset": {
														"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)$"
																	},
																	"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)$"
																	},
																	"url": {
																		"type": "string",
																		"format": "uri"
																	},
																	"width": {
																		"type": "integer",
																		"exclusiveMinimum": 0,
																		"maximum": 9007199254740991
																	},
																	"height": {
																		"type": "integer",
																		"exclusiveMinimum": 0,
																		"maximum": 9007199254740991
																	}
																},
																"required": [
																	"id",
																	"publicId",
																	"url",
																	"width",
																	"height"
																],
																"additionalProperties": false
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"runId",
													"status",
													"lastError",
													"asset"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"pictures"
									],
									"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/documents/{id}/media/copy": {
			"post": {
				"summary": "Copy a library or stock picture into the article",
				"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)$"
									},
									"source": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "library"
													},
													"mediaAssetId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
													"mediaAssetId"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "stock"
													},
													"photoId": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"kind",
													"photoId"
												]
											}
										]
									}
								},
								"required": [
									"clientRef",
									"source"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"asset": {
											"type": "object",
											"properties": {
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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)$"
												},
												"url": {
													"type": "string",
													"format": "uri"
												},
												"width": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												"height": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"id",
												"publicId",
												"url",
												"width",
												"height"
											],
											"additionalProperties": false
										},
										"credit": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/SeoArticleCredit"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"asset",
										"credit"
									],
									"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"
								}
							}
						}
					},
					"422": {
						"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}/media/unused": {
			"get": {
				"summary": "Pictures made for the article and not used yet",
				"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"assets": {
											"maxItems": 50,
											"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)$"
													},
													"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)$"
													},
													"url": {
														"type": "string",
														"format": "uri"
													},
													"width": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"height": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"credit": {
														"anyOf": [
															{
																"$ref": "#/components/schemas/SeoArticleCredit"
															},
															{
																"type": "null"
															}
														]
													},
													"source": {
														"type": "string",
														"enum": [
															"ai",
															"library",
															"stock",
															"upload"
														]
													},
													"createdAt": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
													"url",
													"width",
													"height",
													"credit",
													"source",
													"createdAt"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"minLength": 1,
													"maxLength": 1024
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"assets",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/stock/search": {
			"get": {
				"summary": "Search stock photos",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "q",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "page",
						"in": "query",
						"required": false,
						"schema": {
							"default": 1,
							"type": "integer",
							"minimum": 1,
							"maximum": 10000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"photos": {
											"maxItems": 80,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"width": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"height": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"alt": {
														"type": "string",
														"maxLength": 1000
													},
													"photographer": {
														"type": "string",
														"maxLength": 200
													},
													"photographerUrl": {
														"type": "string",
														"maxLength": 2048
													},
													"previewUrl": {
														"type": "string",
														"maxLength": 2048
													}
												},
												"required": [
													"id",
													"width",
													"height",
													"alt",
													"photographer",
													"photographerUrl",
													"previewUrl"
												],
												"additionalProperties": false
											}
										},
										"page": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"hasMore": {
											"type": "boolean"
										}
									},
									"required": [
										"photos",
										"page",
										"hasMore"
									],
									"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"
								}
							}
						}
					},
					"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}/own-pages": {
			"get": {
				"summary": "The practice's own pages an article can link to",
				"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"pages": {
											"maxItems": 500,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"url": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2048
													},
													"title": {
														"type": "string",
														"maxLength": 2048
													}
												},
												"required": [
													"url",
													"title"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"minLength": 1,
													"maxLength": 1024
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"pages",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/live": {
			"get": {
				"summary": "Where an article is live, and how it does on Google",
				"tags": [
					"seo"
				],
				"description": "Read live from Google through the practice's Search Console connection (never stored): the last 28 days for the live address against the 28 before, its top 25 searches, the Google organic leads that landed on it, and the ideas. `google` is `{ connected: false }` while Search Console isn't connected (or must be reconnected, or has no site chosen), and null until the article is live, or when asked with `google=false` (the publication alone: one statement, no Google call). 403 `SEO_NOT_ENABLED` before any Google 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": "google",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoDocumentLive"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/chat": {
			"get": {
				"summary": "The article's Ask AI history, newest first",
				"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": "before",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 1024
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"turns": {
											"maxItems": 20,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"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)$"
													},
													"status": {
														"type": "string",
														"enum": [
															"queued",
															"running",
															"completed",
															"failed",
															"cancelled",
															"applied",
															"conflict",
															"budget_blocked"
														]
													},
													"message": {
														"type": "string",
														"maxLength": 2000
													},
													"reply": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 4000
															},
															{
																"type": "null"
															}
														]
													},
													"editCount": {
														"type": "integer",
														"minimum": 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": [
													"runId",
													"status",
													"message",
													"reply",
													"editCount",
													"createdAt"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"anyOf": [
												{
													"type": "string",
													"minLength": 1,
													"maxLength": 1024
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"turns",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/runs/{runId}": {
			"get": {
				"summary": "One AI run's 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)$"
						}
					},
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"run": {
											"$ref": "#/components/schemas/SeoContentGenerationRun"
										},
										"result": {
											"anyOf": [
												{
													"anyOf": [
														{
															"type": "object",
															"properties": {
																"reply": {
																	"anyOf": [
																		{
																			"type": "string",
																			"maxLength": 4000
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"edits": {
																	"maxItems": 1000,
																	"type": "array",
																	"items": {
																		"$ref": "#/components/schemas/SeoArticleBlockEdit"
																	}
																},
																"editOutcomes": {
																	"type": "object",
																	"propertyNames": {
																		"type": "string"
																	},
																	"additionalProperties": {
																		"type": "string",
																		"enum": [
																			"accepted",
																			"rejected"
																		]
																	}
																}
															},
															"required": [
																"reply",
																"edits",
																"editOutcomes"
															],
															"additionalProperties": false
														},
														{
															"$ref": "#/components/schemas/SeoContentRewrite"
														},
														{
															"$ref": "#/components/schemas/SeoContentMetaSuggestion"
														},
														{
															"type": "object",
															"properties": {
																"asset": {
																	"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)$"
																				},
																				"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)$"
																				},
																				"url": {
																					"type": "string",
																					"format": "uri"
																				},
																				"width": {
																					"type": "integer",
																					"exclusiveMinimum": 0,
																					"maximum": 9007199254740991
																				},
																				"height": {
																					"type": "integer",
																					"exclusiveMinimum": 0,
																					"maximum": 9007199254740991
																				}
																			},
																			"required": [
																				"id",
																				"publicId",
																				"url",
																				"width",
																				"height"
																			],
																			"additionalProperties": false
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"required": [
																"asset"
															],
															"additionalProperties": false
														}
													]
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"run",
										"result"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/{id}/originality": {
			"get": {
				"summary": "Sentences that overlap the pages the article learns from",
				"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": "version",
						"in": "query",
						"required": true,
						"schema": {
							"type": "integer",
							"exclusiveMinimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"version": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"overlaps": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"sentence": {
														"type": "string"
													},
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"url": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2048
													},
													"title": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 500
															},
															{
																"type": "null"
															}
														]
													},
													"words": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"sentence",
													"pageId",
													"url",
													"title",
													"words"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"version",
										"overlaps"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/documents/import": {
			"post": {
				"summary": "Start an article that improves an existing page",
				"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)$"
									},
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"clientRef",
									"locationId",
									"url"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"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)$"
										}
									},
									"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"
								}
							}
						}
					},
					"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/settings/article-defaults": {
			"get": {
				"summary": "Get the practice's article defaults and its facts for previews",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"defaults": {
											"$ref": "#/components/schemas/SeoArticleDefaults"
										},
										"stored": {
											"type": "boolean"
										},
										"practiceFacts": {
											"$ref": "#/components/schemas/SeoArticlePracticeFacts"
										}
									},
									"required": [
										"defaults",
										"stored",
										"practiceFacts"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Save the practice's article defaults",
				"tags": [
					"seo"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"defaults": {
										"$ref": "#/components/schemas/SeoArticleDefaults"
									}
								},
								"required": [
									"defaults"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"defaults": {
											"$ref": "#/components/schemas/SeoArticleDefaults"
										}
									},
									"required": [
										"defaults"
									],
									"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/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-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",
							"pattern": "^[a-z0-9][a-z0-9_]{0,63}$"
						}
					}
				],
				"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"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",
							"pattern": "^[a-z0-9][a-z0-9_]{0,63}$"
						}
					}
				],
				"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
						}
					},
					{
						"name": "access",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"read",
								"manage"
							]
						}
					}
				],
				"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/properties": {
			"get": {
				"summary": "List the connector's verified Search Console sites",
				"tags": [
					"seo-google"
				],
				"description": "Read live from the connecting member's Google grant; only that member may list it (403 `GSC_CONNECTOR_ONLY`). `ownedElsewhere` marks a site another practice holds.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"properties": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"propertyUri": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2048
													},
													"permissionLevel": {
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													"ownedElsewhere": {
														"type": "boolean"
													}
												},
												"required": [
													"propertyUri",
													"permissionLevel",
													"ownedElsewhere"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"properties"
									],
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"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"
				],
				"description": "Only the connecting member may choose (403 `GSC_CONNECTOR_ONLY`); a site another practice holds is refused (409 `GSC_PROPERTY_CLAIMED_ELSEWHERE`).",
				"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/ranking-guide": {
			"get": {
				"summary": "Get the SEO Ranking guide 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoRankingGuidePage"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/ranking-guide/marks": {
			"put": {
				"summary": "Tick or untick a Ranking guide point for a location",
				"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)$"
									},
									"pointId": {
										"type": "string",
										"enum": [
											"gbp_primary_category",
											"gbp_name_keywords",
											"gbp_verified",
											"fake_offices",
											"gbp_complete",
											"gbp_photos",
											"gbp_posts",
											"reviews_volume",
											"reviews_recent",
											"reviews_keywords",
											"reviews_reply",
											"reviews_multi_site",
											"fake_reviews",
											"review_gating",
											"treatment_pages",
											"titles_keywords",
											"answer_questions",
											"facts_in_text",
											"qa_page",
											"dentist_bios",
											"dated_reviewed_pages",
											"rank_google_first",
											"youtube_presence",
											"site_speed",
											"dentist_schema",
											"search_console",
											"https",
											"broken_links",
											"allow_snippets",
											"allow_oai_searchbot",
											"allow_claude_bots",
											"no_js_pages",
											"llms_txt",
											"bing_index",
											"brave_search",
											"nap_consistent",
											"bing_places",
											"health_directories_uk",
											"health_directories_us",
											"local_links",
											"mentions_local_sites",
											"best_dentist_lists",
											"mentions_forums",
											"paid_guest_posts",
											"expired_domains",
											"pbn",
											"link_exchanges",
											"link_farms",
											"anchor_text",
											"directory_spam",
											"web20_blogs",
											"widget_links",
											"comment_spam",
											"parasite_seo",
											"hacked_links",
											"negative_seo",
											"doorway_pages",
											"ctr_manipulation",
											"scaled_ai_content",
											"hidden_text",
											"hidden_ai_text",
											"self_listicles",
											"paid_listicles",
											"astroturfing",
											"ai_chatgpt_check",
											"ai_google_check",
											"ask_claude"
										]
									},
									"done": {
										"type": "boolean"
									}
								},
								"required": [
									"locationId",
									"pointId",
									"done"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SeoRankingGuideMark"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/seo/website/overview": {
			"get": {
				"summary": "Get the Website check overview",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteAuditOverview"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/website/audits/{auditId}/issues": {
			"get": {
				"summary": "List a Website check's issues by check",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "severity",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"error",
								"warning",
								"notice"
							]
						}
					},
					{
						"name": "category",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"status_codes",
								"redirects",
								"crawlability",
								"indexability",
								"canonicalization",
								"titles_descriptions",
								"content",
								"duplicates",
								"links",
								"images",
								"performance",
								"mobile",
								"security",
								"structured_data",
								"ai_search",
								"accessibility",
								"local_compliance",
								"international",
								"javascript",
								"sitemaps_robots"
							]
						}
					},
					{
						"name": "report",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"crawlability",
								"https",
								"international",
								"performance",
								"core_web_vitals",
								"internal_linking",
								"markup",
								"robots_txt",
								"ai_search",
								"accessibility",
								"local",
								"js_impact"
							]
						}
					},
					{
						"name": "state",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"to_fix",
								"sent",
								"fixed",
								"hidden"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 100
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteAuditIssues"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/website/audits/{auditId}/issues/{checkKey}/items": {
			"get": {
				"summary": "Page through one check's affected pages, links or files",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "checkKey",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"pattern": "^[a-z0-9][a-z0-9_]{0,79}$"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 200
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteAuditItems"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/website/audits/{auditId}/pages": {
			"get": {
				"summary": "Page through a Website check's crawled pages",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
							"type": "string",
							"enum": [
								"link_rank",
								"issues",
								"url",
								"depth",
								"speed",
								"status"
							]
						}
					},
					{
						"name": "filter",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"all",
								"with_issues",
								"broken",
								"redirects",
								"blocked"
							]
						}
					},
					{
						"name": "q",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 200
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteAuditPages"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/website/audits/{auditId}/pages/{pageId}": {
			"get": {
				"summary": "Get one crawled page with what was found on it",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SiteAuditPageDetail"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/website/audits/{auditId}/pages/{pageId}/ai-view": {
			"get": {
				"summary": "Compare a crawled page without JavaScript (as most AI bots read it) with the browser view",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SiteAuditPageAiView"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/website/audits/{auditId}/statistics": {
			"get": {
				"summary": "Get a Website check's statistics tiles",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SiteAuditStatistics"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/website/history": {
			"get": {
				"summary": "List Website checks, newest first",
				"tags": [
					"seo"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteAuditHistory"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/seo/website/compare": {
			"get": {
				"summary": "Compare two Website checks check by check",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "from",
						"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": "to",
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteAuditCompare"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/website/audits/{auditId}/retry": {
			"post": {
				"summary": "Resume a stopped Website check from the work that parked",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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/SiteAuditCommand"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/website/audits/{auditId}/discard": {
			"post": {
				"summary": "Discard a stopped Website check and its unfinished work",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SiteAuditCommand"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/website/audits/{auditId}/pages/{pageId}/recheck": {
			"post": {
				"summary": "Check one crawled page again: fetch it fresh and rerun its checks",
				"tags": [
					"seo"
				],
				"parameters": [
					{
						"name": "auditId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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/SiteAuditRecheck"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/campaigns": {
			"get": {
				"summary": "List ad campaigns",
				"tags": [
					"ads"
				],
				"description": "Managed and external (adopted-inventory) campaigns, cursor-paginated, newest first, each with its numbers over a date window (`performance`: platform and CRM truth, the previous window, per-bucket trend; default the last 30 days). 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"
							]
						}
					},
					{
						"name": "hideStopped",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"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"
													}
												},
												"currency": {
													"type": "string",
													"enum": [
														"EUR",
														"GBP",
														"USD"
													]
												},
												"spendCurrency": {
													"anyOf": [
														{
															"type": "string",
															"pattern": "^[A-Z]{3}$"
														},
														{
															"type": "null"
														}
													]
												},
												"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
												},
												"performance": {
													"maxItems": 100,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsCampaignPerformance"
													}
												}
											},
											"required": [
												"items",
												"nextCursor",
												"openAlerts",
												"syncHealth",
												"currency",
												"spendCurrency",
												"range",
												"previousRange",
												"performance"
											],
											"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, open alerts, the last 28 days of results (CRM enquiries, bookings and treatment value beside the platform's own numbers, never blended), each ad's spend and cost per lead, and `insights`: the booking-based verdict with its estimate and range, the patient funnel, follow-up health, budget facts, what Smileline may change, and the advisor's suggestions per lever (null for drafts and campaigns still being created).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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"
													}
												},
												"results": {
													"$ref": "#/components/schemas/AdsCampaignResults"
												},
												"adPerformance": {
													"maxItems": 500,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsCampaignAdPerformance"
													}
												},
												"insights": {
													"anyOf": [
														{
															"$ref": "#/components/schemas/AdsCampaignInsights"
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"campaign",
												"adGroups",
												"ads",
												"mutations",
												"alerts",
												"results",
												"adPerformance",
												"insights"
											],
											"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"
											}
										]
									},
									"destinationSitePageId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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/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"
									},
									"sitePageId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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",
									"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; ads the batch doesn't name keep their copy. Policy pre-flight re-runs at validation; on Meta the learning reset must be explicitly confirmed. A Google search ad's copy changes as whole lists (`headlines`, `descriptions`) and must keep at least 3 headlines and 2 descriptions; other platforms' ads change one line of each kind. On a live Meta campaign a batch may add up to 3 new ads to the existing ad set and pause up to 3 ads (`pauseAdIds`) once they exist; other platforms take edits to existing ads only (409 ADS_NEW_ADS_UNSUPPORTED).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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"
														}
													]
												},
												"headlines": {
													"minItems": 3,
													"maxItems": 15,
													"type": "array",
													"items": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200,
														"description": "At most 30 characters as Google counts them"
													}
												},
												"descriptions": {
													"minItems": 2,
													"maxItems": 4,
													"type": "array",
													"items": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500,
														"description": "At most 90 characters as Google counts them"
													}
												},
												"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"
									},
									"pauseAdIds": {
										"maxItems": 3,
										"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",
									"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}/ads/{adId}/status": {
			"post": {
				"summary": "Pause or resume one ad",
				"tags": [
					"ads"
				],
				"description": "Pausing an ad only stops spend (`ads:manage`); resuming it restarts spend (`ads:publish`). Meta and Google campaigns. The campaign's last delivering ad cannot be paused (409 ADS_LAST_DELIVERING_AD) — pause the campaign instead — and pending pauses count, so two requests cannot both pass. While the campaign is going live or resuming, single ads wait (409 ADS_ACTIVATION_PENDING). Setting the campaign live or resuming it later keeps a paused ad 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)$"
						}
					},
					{
						"name": "adId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"paused"
										]
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"status"
								]
							}
						}
					}
				},
				"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/campaigns/{id}/advice/apply": {
			"post": {
				"summary": "Apply a campaign suggestion",
				"tags": [
					"ads"
				],
				"description": "Re-computes the campaign's suggestion and, when it still proposes the same change, applies it through the same verb as the matching editor (budget, pause, ad status, targeting radius, optimization goal, automatic reply). A changed proposal answers 409 ADS_ADVICE_STALE; replaying a clientRef returns the first result. Permission follows the underlying verb: budget changes need 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
									},
									"kind": {
										"type": "string",
										"enum": [
											"pause_campaign",
											"lower_budget",
											"raise_budget",
											"pause_weakest_ad",
											"widen_radius",
											"optimize_on_leads",
											"optimize_on_bookings",
											"reply_faster"
										]
									},
									"proposal": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"dailyBudgetMicros": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"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)$"
													},
													"radii": {
														"minItems": 1,
														"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"
															]
														}
													},
													"optimizationGoal": {
														"type": "string",
														"enum": [
															"booking",
															"lead"
														]
													}
												}
											},
											{
												"type": "null"
											}
										]
									},
									"confirmMonthlyProjection": {
										"type": "boolean"
									}
								},
								"required": [
									"clientRef",
									"expectedVersion",
									"kind",
									"proposal"
								]
							}
						}
					}
				},
				"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}/target": {
			"put": {
				"summary": "Set a campaign's target cost per booking",
				"tags": [
					"ads"
				],
				"description": "Local to Smileline: the bar the campaign's verdict and suggestions compare against. Compare-and-set on the previous value; null returns to the treatment default.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"expectedTargetCostPerBookingMicros": {
										"anyOf": [
											{
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"targetCostPerBookingMicros": {
										"anyOf": [
											{
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 1000000000000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"expectedTargetCostPerBookingMicros",
									"targetCostPerBookingMicros"
								]
							}
						}
					}
				},
				"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}/advice/{kind}/snooze": {
			"put": {
				"summary": "Snooze a campaign suggestion",
				"tags": [
					"ads"
				],
				"description": "Hides one suggestion from the Ads Overview for 7 or 30 days; the campaign page shows it collapsed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
								"pause_campaign",
								"lower_budget",
								"hold_budget",
								"raise_budget",
								"budget_not_limit",
								"pause_weakest_ad",
								"refresh_ad",
								"widen_radius",
								"optimize_on_leads",
								"optimize_on_bookings",
								"leads_missing",
								"feedback_failing",
								"feedback_off",
								"patients_waiting",
								"reply_faster",
								"show_up",
								"ending_soon"
							]
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"days": {
										"anyOf": [
											{
												"type": "number",
												"const": 7
											},
											{
												"type": "number",
												"const": 30
											}
										]
									}
								},
								"required": [
									"days"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Bring back a snoozed suggestion",
				"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)$"
						}
					},
					{
						"name": "kind",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"pause_campaign",
								"lower_budget",
								"hold_budget",
								"raise_budget",
								"budget_not_limit",
								"pause_weakest_ad",
								"refresh_ad",
								"widen_radius",
								"optimize_on_leads",
								"optimize_on_bookings",
								"leads_missing",
								"feedback_failing",
								"feedback_off",
								"patients_waiting",
								"reply_faster",
								"show_up",
								"ending_soon"
							]
						}
					}
				],
				"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/settings": {
			"get": {
				"summary": "Get practice-level ads settings",
				"tags": [
					"ads"
				],
				"description": "The monthly spend cap, the creative-generation budget override and the privacy policy link Meta instant forms carry. `data` is null until the settings are first saved. Reads stay open when the entitlement lapses.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/AdsSettings"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Update practice-level ads settings",
				"tags": [
					"ads"
				],
				"description": "Spend guard rails plus the privacy policy link (HTTPS) that Meta shows on every instant form Smileline creates — an instant-form campaign cannot launch without it. An omitted `privacyPolicyUrl` keeps the saved link; null clears it. Raising or removing the monthly cap lets more be spent, so it needs `ads:publish`; setting a first cap, lowering it, keeping it and the other settings need `ads:manage`. The cap is kept in `spendCapCurrency` and bounds only campaigns that spend in that currency — amounts in different currencies are never added or converted.",
				"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"
											}
										]
									},
									"privacyPolicyUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri",
												"description": "Absolute HTTPS URL, at most 2048 UTF-8 bytes."
											},
											{
												"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])))$"
												},
												"spendCurrency": {
													"anyOf": [
														{
															"type": "string",
															"pattern": "^[A-Z]{3}$"
														},
														{
															"type": "null"
														}
													]
												},
												"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",
												"spendCurrency",
												"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"
													]
												},
												"spendCurrency": {
													"anyOf": [
														{
															"type": "string",
															"pattern": "^[A-Z]{3}$"
														},
														{
															"type": "null"
														}
													]
												},
												"freshness": {
													"type": "object",
													"properties": {
														"metricsSyncedAt": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
																},
																{
																	"type": "null"
																}
															]
														},
														"neverSynced": {
															"type": "boolean"
														}
													},
													"required": [
														"metricsSyncedAt",
														"neverSynced"
													],
													"additionalProperties": false
												},
												"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
												},
												"funnel": {
													"type": "object",
													"properties": {
														"current": {
															"type": "object",
															"properties": {
																"leads": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"contacted": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"contactedFast": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"booked": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"attended": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"noShow": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"won": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"wonValueCents": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"leads",
																"contacted",
																"contactedFast",
																"booked",
																"attended",
																"noShow",
																"won",
																"wonValueCents"
															],
															"additionalProperties": false
														},
														"previous": {
															"type": "object",
															"properties": {
																"leads": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"contacted": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"contactedFast": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"booked": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"attended": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"noShow": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"won": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																},
																"wonValueCents": {
																	"type": "integer",
																	"minimum": 0,
																	"maximum": 9007199254740991
																}
															},
															"required": [
																"leads",
																"contacted",
																"contactedFast",
																"booked",
																"attended",
																"noShow",
																"won",
																"wonValueCents"
															],
															"additionalProperties": false
														}
													},
													"required": [
														"current",
														"previous"
													],
													"additionalProperties": false
												},
												"tracking": {
													"type": "object",
													"properties": {
														"lead": {
															"type": "string",
															"enum": [
																"restricted",
																"unknown",
																"off",
																"pending",
																"accepted",
																"failing"
															]
														},
														"booked": {
															"type": "string",
															"enum": [
																"restricted",
																"unknown",
																"off",
																"pending",
																"accepted",
																"failing"
															]
														},
														"won": {
															"type": "string",
															"enum": [
																"restricted",
																"unknown",
																"off",
																"pending",
																"accepted",
																"failing"
															]
														},
														"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"
																}
															]
														}
													},
													"required": [
														"lead",
														"booked",
														"won",
														"lastAcceptedAt"
													],
													"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",
												"spendCurrency",
												"freshness",
												"range",
												"previousRange",
												"grain",
												"kpis",
												"series",
												"totals",
												"funnel",
												"tracking",
												"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/overview": {
			"get": {
				"summary": "Every ad platform's performance and the ranked suggestions",
				"tags": [
					"ads"
				],
				"description": "The Ads Overview's numbers: every platform over `filters`' date window (previous = the same number of whole days before; default the last 30 days), each live campaign's booking verdict and the advisor's ranked suggestions, narrowed to `locationId`'s campaigns when given — tracking, sync health and freshness stay practice-wide. Read-only: no provider calls. Reads stay open when the entitlement lapses.",
				"parameters": [
					{
						"name": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"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": {
											"$ref": "#/components/schemas/AdsOverviewPerformance"
										}
									},
									"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"
														}
													]
												},
												"adCoverage": {
													"anyOf": [
														{
															"type": "number",
															"minimum": 0,
															"maximum": 1
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"items",
												"nextCursor",
												"adCoverage"
											],
											"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, retry fence and traversal cursors cleared) and starts a fresh campaign refresh, then reporting, at once. 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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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))$"
										},
										"metricsSyncedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
										"externalAccountId",
										"accountName",
										"provider",
										"parkedAt",
										"lastError",
										"structureDueAt",
										"metricsDueAt",
										"metricsSyncedAt",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/ads/alerts": {
			"get": {
				"summary": "List ads alerts",
				"tags": [
					"ads"
				],
				"description": "Operational alerts the sync raises (CPL spikes, delivery stopped, disapprovals, account health, budget exhausted). The retired suggestion kinds (learning stuck, fatigue, room to grow, reply faster, pause weakest ad) remain only as history: without a status filter, only open alerts of the other kinds 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",
								"room_to_grow",
								"reply_faster",
								"pause_weakest_ad"
							]
						}
					},
					{
						"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 (retired)",
				"tags": [
					"ads"
				],
				"description": "Retired: suggestions moved to the campaign advisor (`POST /ads/campaigns/:id/advice/apply`). A retired suggestion kind answers 409 ADS_ALERT_RETIRED and any other alert 409 ADS_ALERT_ACTION_MISMATCH, before any write.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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",
											"raise_budget",
											"enable_fast_response",
											"pause_ad"
										]
									},
									"confirmMonthlyProjection": {
										"type": "boolean"
									}
								},
								"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": "List the practice's ad images",
				"tags": [
					"ads"
				],
				"description": "Newest first, one page at a time (`nextCursor`). Reads stay open when the add-on entitlement lapses; the envelope carries the gating instead. GB and US practices only (403 `COUNTRY_UNAVAILABLE` elsewhere).",
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"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": 50,
													"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
													}
												},
												"nextCursor": {
													"type": [
														"string",
														"null"
													]
												}
											},
											"required": [
												"sessions",
												"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/creative/import-social": {
			"post": {
				"summary": "Add an approved Social image to the ad images",
				"tags": [
					"ads"
				],
				"description": "Copies one approved Social → Images output into the Ads library as an approved 4:5 variant. Smile simulations, before & after images and carousels are refused (409), and so is an image that is not approved. An image made with photos needs `consentText`. GB and US practices only. `clientRef` is the idempotency key: a retry returns the same variant (200).",
				"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)$"
									},
									"socialImageId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"consentText": {
										"type": "string",
										"maxLength": 1000
									}
								},
								"required": [
									"clientRef",
									"socialImageId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeVariant"
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/AdsCreativeVariant"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					},
					"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/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"
								}
							}
						}
					}
				}
			}
		},
		"/ads/templates": {
			"get": {
				"summary": "List campaign templates",
				"tags": [
					"ads"
				],
				"description": "Read-only. The ready-made campaign templates for the practice's country (none without a country), each with the platforms it can create on now, budget presets in the ad account's currency, the industry-estimate inputs, its instant form and its creative recipes, plus the prerequisites the launcher shows as fix cards.",
				"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": {
												"country": {
													"anyOf": [
														{
															"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"
															]
														},
														{
															"type": "null"
														}
													]
												},
												"templates": {
													"maxItems": 9,
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/AdsCampaignTemplate"
													}
												},
												"prerequisites": {
													"$ref": "#/components/schemas/AdsCampaignTemplatePrerequisites"
												},
												"prefill": {
													"type": "object",
													"properties": {
														"practiceName": {
															"type": "string"
														},
														"website": {
															"type": [
																"string",
																"null"
															]
														},
														"bookingUrl": {
															"type": [
																"string",
																"null"
															]
														},
														"locations": {
															"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)$"
																	},
																	"name": {
																		"type": "string"
																	},
																	"city": {
																		"type": [
																			"string",
																			"null"
																		]
																	},
																	"hasPin": {
																		"type": "boolean"
																	}
																},
																"required": [
																	"locationId",
																	"name",
																	"city",
																	"hasPin"
																],
																"additionalProperties": false
															}
														},
														"practitioners": {
															"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)$"
																	},
																	"name": {
																		"type": "string"
																	},
																	"photoUrl": {
																		"type": [
																			"string",
																			"null"
																		]
																	},
																	"treatmentSlugs": {
																		"type": "array",
																		"items": {
																			"type": "string"
																		}
																	}
																},
																"required": [
																	"practitionerId",
																	"name",
																	"photoUrl",
																	"treatmentSlugs"
																],
																"additionalProperties": false
															}
														},
														"rating": {
															"anyOf": [
																{
																	"type": "object",
																	"properties": {
																		"average": {
																			"type": "number"
																		},
																		"count": {
																			"type": "integer",
																			"minimum": -9007199254740991,
																			"maximum": 9007199254740991
																		},
																		"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])))$"
																		}
																	},
																	"required": [
																		"average",
																		"count",
																		"asOf"
																	],
																	"additionalProperties": false
																},
																{
																	"type": "null"
																}
															]
														}
													},
													"required": [
														"practiceName",
														"website",
														"bookingUrl",
														"locations",
														"practitioners",
														"rating"
													],
													"additionalProperties": false
												},
												"capabilities": {
													"type": "object",
													"properties": {
														"canPublishSocial": {
															"type": "boolean"
														},
														"canManageAutomations": {
															"type": "boolean"
														},
														"voiceAiActive": {
															"type": "boolean"
														},
														"fastResponseAvailable": {
															"type": "boolean"
														},
														"aiImagesAvailable": {
															"type": "boolean"
														},
														"aiReceptionistRuleCapReached": {
															"type": "boolean"
														}
													},
													"required": [
														"canPublishSocial",
														"canManageAutomations",
														"voiceAiActive",
														"fastResponseAvailable",
														"aiImagesAvailable",
														"aiReceptionistRuleCapReached"
													],
													"additionalProperties": false
												}
											},
											"required": [
												"country",
												"templates",
												"prerequisites",
												"prefill",
												"capabilities"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/ads/campaigns/from-template": {
			"post": {
				"summary": "Build a campaign from a template, PAUSED",
				"tags": [
					"ads"
				],
				"description": "One call: the draft, its ads, the create mutation and the switched-on follow-ups (the fast reply's sequence card, the AI receptionist's call rule) are written in one transaction, and the campaign arrives at the provider paused; going live is the separate publish verb. An instant form takes `formType` (the template's own type when null); a Meta `targetCplMicros` becomes the campaign's target cost per lead (Meta's cost cap) and needs a daily budget of at least 5 times it (400 otherwise). Idempotent on clientRef: an identical retry returns the original campaign without applying the follow-ups again, and a changed input answers 409. A template the practice's country isn't served by answers 403 COUNTRY_UNAVAILABLE; an unapproved image answers 409; asking for the AI receptionist when the practice already holds the most AI call rules it may answers 409 ADS_TEMPLATE_AI_RECEPTIONIST_CAP.",
				"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)$"
									},
									"templateKey": {
										"type": "string",
										"enum": [
											"meet_the_dentist",
											"new_patients",
											"implants",
											"clear_aligners",
											"bonding_veneers",
											"whitening",
											"emergency",
											"us_benefits",
											"custom"
										]
									},
									"platformKind": {
										"type": "string",
										"enum": [
											"meta_leads",
											"meta_website",
											"google_search"
										]
									},
									"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"
											}
										]
									},
									"locations": {
										"minItems": 1,
										"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"
											]
										}
									},
									"dailyBudgetMicros": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 1000000000000
									},
									"ads": {
										"minItems": 1,
										"maxItems": 3,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"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"
														}
													]
												},
												"headlines": {
													"minItems": 1,
													"maxItems": 15,
													"type": "array",
													"items": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													}
												},
												"primaryTexts": {
													"maxItems": 1,
													"type": "array",
													"items": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2000
													}
												},
												"descriptions": {
													"maxItems": 4,
													"type": "array",
													"items": {
														"type": "string",
														"minLength": 1,
														"maxLength": 500
													}
												}
											},
											"required": [
												"creativeVariantId",
												"headlines",
												"primaryTexts",
												"descriptions"
											]
										}
									},
									"ageMin": {
										"type": "integer",
										"minimum": 18,
										"maximum": 65
									},
									"name": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 300
											},
											{
												"type": "null"
											}
										]
									},
									"destinationUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"destinationSitePageId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"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"
											}
										]
									},
									"fastResponse": {
										"type": "boolean"
									},
									"aiReceptionist": {
										"type": "boolean"
									},
									"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"
											}
										]
									},
									"formType": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"standard",
													"higher_intent"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"targetCplMicros": {
										"anyOf": [
											{
												"type": "integer",
												"exclusiveMinimum": 0,
												"maximum": 1000000000000
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"clientRef",
									"templateKey",
									"platformKind",
									"externalAccountId",
									"pageExternalAccountId",
									"locations",
									"dailyBudgetMicros",
									"ads",
									"ageMin",
									"name",
									"destinationUrl",
									"startAt",
									"endAt",
									"fastResponse",
									"aiReceptionist"
								]
							}
						}
					}
				},
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites": {
			"get": {
				"summary": "List websites",
				"tags": [
					"sites"
				],
				"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": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/SiteSummary"
													}
												}
											},
											"required": [
												"items"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a website from a template",
				"tags": [
					"sites"
				],
				"description": "Creates the site, its pages from the template and its free address. Nothing is published until the first publish.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"kind": {
										"type": "string",
										"enum": [
											"website",
											"landing"
										]
									},
									"templateKey": {
										"type": "string",
										"enum": [
											"practice",
											"implants",
											"clear_aligners",
											"new_patients",
											"cosmetic",
											"emergency",
											"us_benefits"
										]
									},
									"treatmentIds": {
										"default": [],
										"maxItems": 50,
										"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)$"
										}
									},
									"freeLabel": {
										"type": "string",
										"minLength": 1,
										"maxLength": 63
									}
								},
								"required": [
									"name",
									"kind",
									"templateKey"
								]
							}
						}
					}
				},
				"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": [
												"website",
												"landing"
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"live",
												"paused"
											]
										},
										"pausedBy": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"practice",
														"operator",
														"billing",
														"core"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"adsLapsedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"url": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"freeUrl": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"liveVersionNumber": {
											"anyOf": [
												{
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"publishing": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/SitePublishingState"
												},
												{
													"type": "null"
												}
											]
										},
										"pageCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"name",
										"status",
										"pausedBy",
										"adsLapsedAt",
										"url",
										"freeUrl",
										"liveVersionNumber",
										"publishing",
										"pageCount",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}": {
			"patch": {
				"summary": "Rename or archive a website",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"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)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"website",
												"landing"
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"live",
												"paused"
											]
										},
										"pausedBy": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"practice",
														"operator",
														"billing",
														"core"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"adsLapsedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"url": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"freeUrl": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"liveVersionNumber": {
											"anyOf": [
												{
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"publishing": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/SitePublishingState"
												},
												{
													"type": "null"
												}
											]
										},
										"pageCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"name",
										"status",
										"pausedBy",
										"adsLapsedAt",
										"url",
										"freeUrl",
										"liveVersionNumber",
										"publishing",
										"pageCount",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/editor": {
			"get": {
				"summary": "Load a website for the editor",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"$ref": "#/components/schemas/SiteEditorData"
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/draft": {
			"put": {
				"summary": "Save the site's design (theme, header, menu, footer)",
				"tags": [
					"sites"
				],
				"description": "Compare-and-set on `expectedRevision`; a stale revision is 409 SITE_DRAFT_CONFLICT.",
				"parameters": [
					{
						"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": {
									"expectedRevision": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"document": {
										"$ref": "#/components/schemas/SiteDocument"
									}
								},
								"required": [
									"expectedRevision",
									"document"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"draftRevision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"savedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"draftRevision",
										"savedAt"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/pages": {
			"post": {
				"summary": "Add a page",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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": {
									"kind": {
										"type": "string",
										"enum": [
											"page",
											"landing",
											"thank_you"
										]
									},
									"path": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2048
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"from": {
										"oneOf": [
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "blank"
													}
												},
												"required": [
													"kind"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "template"
													},
													"templateKey": {
														"type": "string",
														"enum": [
															"implants",
															"clear_aligners",
															"new_patients",
															"cosmetic",
															"emergency",
															"us_benefits"
														]
													},
													"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"
															}
														]
													},
													"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": [
													"kind",
													"templateKey",
													"treatmentId",
													"locationId"
												]
											},
											{
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"const": "copy"
													},
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
													"pageId"
												]
											}
										]
									}
								},
								"required": [
									"kind",
									"path",
									"title",
									"from"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"page": {
											"$ref": "#/components/schemas/SitePageSummary"
										},
										"document": {
											"$ref": "#/components/schemas/SitePageDocument"
										},
										"draftRevision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"page",
										"document",
										"draftRevision"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/pages/{pageId}": {
			"get": {
				"summary": "Load a page's draft",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"page": {
											"$ref": "#/components/schemas/SitePageSummary"
										},
										"document": {
											"$ref": "#/components/schemas/SitePageDocument"
										},
										"draftRevision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"page",
										"document",
										"draftRevision"
									],
									"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": "Rename, re-path or archive a page",
				"tags": [
					"sites"
				],
				"description": "A path change on a published page adds a redirect. A change of title, SEO or path is a new draft revision (the summary carries it). Archiving a live page takes it down at once with a maintenance re-bake (no add-on needed). Re-pathing or archiving a page a live campaign is linked to needs `confirmLinkedCampaigns`; a page in a running A/B test is refused (409 SITE_TEST_RUNNING).",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"path": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2048
									},
									"seo": {
										"type": "object",
										"properties": {
											"description": {
												"type": "string",
												"maxLength": 320
											},
											"ogImage": {
												"anyOf": [
													{
														"type": "object",
														"properties": {
															"mediaId": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															"alt": {
																"type": "string",
																"maxLength": 200
															}
														},
														"required": [
															"mediaId",
															"alt"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"noindex": {
												"type": "boolean"
											}
										},
										"required": [
											"description",
											"ogImage",
											"noindex"
										]
									},
									"archived": {
										"type": "boolean"
									},
									"confirmLinkedCampaigns": {
										"default": false,
										"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)$"
										},
										"kind": {
											"type": "string",
											"enum": [
												"page",
												"landing",
												"thank_you"
											]
										},
										"path": {
											"type": "string"
										},
										"title": {
											"type": "string"
										},
										"seo": {
											"type": "object",
											"properties": {
												"description": {
													"type": "string",
													"maxLength": 320
												},
												"ogImage": {
													"anyOf": [
														{
															"type": "object",
															"properties": {
																"mediaId": {
																	"type": "string",
																	"format": "uuid",
																	"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																},
																"alt": {
																	"type": "string",
																	"maxLength": 200
																}
															},
															"required": [
																"mediaId",
																"alt"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"noindex": {
													"type": "boolean"
												}
											},
											"required": [
												"description",
												"ogImage",
												"noindex"
											],
											"additionalProperties": false
										},
										"draftRevision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"hasUnpublishedChanges": {
											"type": "boolean"
										},
										"live": {
											"type": "boolean"
										},
										"url": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"variantOfPageId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"testRunning": {
											"type": "boolean"
										},
										"linkedCampaigns": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedByName": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"id",
										"kind",
										"path",
										"title",
										"seo",
										"draftRevision",
										"hasUnpublishedChanges",
										"live",
										"url",
										"variantOfPageId",
										"testRunning",
										"linkedCampaigns",
										"updatedAt",
										"updatedByName"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/pages/{pageId}/draft": {
			"put": {
				"summary": "Autosave a page's draft",
				"tags": [
					"sites"
				],
				"description": "Compare-and-set on `expectedRevision`; a stale revision is 409 SITE_DRAFT_CONFLICT.",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"expectedRevision": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"document": {
										"$ref": "#/components/schemas/SitePageDocument"
									}
								},
								"required": [
									"expectedRevision",
									"document"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"draftRevision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"savedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"draftRevision",
										"savedAt"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/publish": {
			"post": {
				"summary": "Publish pages",
				"tags": [
					"sites"
				],
				"description": "Freezes the chosen drafts, the site design and the practice's details into a new version, then builds it in the background. Idempotent per `requestId`.",
				"parameters": [
					{
						"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": {
									"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)$"
									},
									"site": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"expectedRevision": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"expectedRevision"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"pages": {
										"maxItems": 10000,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"pageId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"expectedRevision": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"pageId",
												"expectedRevision"
											]
										}
									},
									"confirmLinkedCampaigns": {
										"default": false,
										"type": "boolean"
									}
								},
								"required": [
									"requestId",
									"site",
									"pages"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"version": {
											"$ref": "#/components/schemas/SiteVersion"
										},
										"warnings": {
											"$ref": "#/components/schemas/SitePublishWarnings"
										}
									},
									"required": [
										"version",
										"warnings"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/publish/check": {
			"post": {
				"summary": "What a publish would warn about (writes nothing)",
				"tags": [
					"sites"
				],
				"description": "The same validation and warnings as a publish of these drafts, without freezing anything.",
				"parameters": [
					{
						"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": {
									"site": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"expectedRevision": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"expectedRevision"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"pages": {
										"maxItems": 10000,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"pageId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												"expectedRevision": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"pageId",
												"expectedRevision"
											]
										}
									}
								},
								"required": [
									"site",
									"pages"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"unconfirmedClaims": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"blockId": {
														"type": "string",
														"minLength": 1,
														"maxLength": 64,
														"pattern": "^[A-Za-z0-9_-]+$"
													},
													"field": {
														"type": "string"
													},
													"text": {
														"type": "string"
													}
												},
												"required": [
													"pageId",
													"blockId",
													"field",
													"text"
												],
												"additionalProperties": false
											}
										},
										"policy": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"blockId": {
														"anyOf": [
															{
																"type": "string",
																"minLength": 1,
																"maxLength": 64,
																"pattern": "^[A-Za-z0-9_-]+$"
															},
															{
																"type": "null"
															}
														]
													},
													"code": {
														"type": "string"
													},
													"message": {
														"type": "string"
													}
												},
												"required": [
													"pageId",
													"blockId",
													"code",
													"message"
												],
												"additionalProperties": false
											}
										},
										"missingPracticeDetails": {
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"unconfirmedClaims",
										"policy",
										"missingPracticeDetails"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/versions": {
			"get": {
				"summary": "List a website's publications",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SiteVersion"
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/versions/{versionId}/retry": {
			"post": {
				"summary": "Retry a parked publication",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "versionId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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)$"
										},
										"number": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"reason": {
											"type": "string",
											"enum": [
												"publish",
												"rebake",
												"restore",
												"preview"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"queued",
												"baking",
												"ready",
												"superseded",
												"failed",
												"parked"
											]
										},
										"attempt": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"lastError": {
											"type": [
												"string",
												"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))$"
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"live": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"number",
										"reason",
										"status",
										"attempt",
										"lastError",
										"createdAt",
										"createdByName",
										"live"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/pages/{pageId}/versions": {
			"get": {
				"summary": "List a page's published versions",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SitePageVersion"
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/pages/{pageId}/versions/{pageVersionId}/restore": {
			"post": {
				"summary": "Copy a published version back into the draft",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "pageVersionId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"expectedRevision": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedRevision"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"page": {
											"$ref": "#/components/schemas/SitePageSummary"
										},
										"document": {
											"$ref": "#/components/schemas/SitePageDocument"
										},
										"draftRevision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"page",
										"document",
										"draftRevision"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/settings": {
			"patch": {
				"summary": "Switch a website's connections",
				"tags": [
					"sites"
				],
				"description": "Call tracking pool, chat and instant AI callbacks. Each is refused when it is not available to the practice.",
				"parameters": [
					{
						"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": {
									"settings": {
										"type": "object",
										"properties": {
											"dniPoolId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"chat": {
												"type": "boolean"
											},
											"callBackAi": {
												"type": "boolean"
											}
										}
									}
								},
								"required": [
									"settings"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SiteConnectionSettings"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/pause": {
			"post": {
				"summary": "Take a website offline (practice pause)",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"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": [
												"website",
												"landing"
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"live",
												"paused"
											]
										},
										"pausedBy": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"practice",
														"operator",
														"billing",
														"core"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"adsLapsedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"url": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"freeUrl": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"liveVersionNumber": {
											"anyOf": [
												{
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"publishing": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/SitePublishingState"
												},
												{
													"type": "null"
												}
											]
										},
										"pageCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"name",
										"status",
										"pausedBy",
										"adsLapsedAt",
										"url",
										"freeUrl",
										"liveVersionNumber",
										"publishing",
										"pageCount",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/resume": {
			"post": {
				"summary": "Put a website back online (clears the practice's pause)",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"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": [
												"website",
												"landing"
											]
										},
										"name": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"draft",
												"live",
												"paused"
											]
										},
										"pausedBy": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"practice",
														"operator",
														"billing",
														"core"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"adsLapsedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"url": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"freeUrl": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"type": "null"
												}
											]
										},
										"liveVersionNumber": {
											"anyOf": [
												{
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"publishing": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/SitePublishingState"
												},
												{
													"type": "null"
												}
											]
										},
										"pageCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"name",
										"status",
										"pausedBy",
										"adsLapsedAt",
										"url",
										"freeUrl",
										"liveVersionNumber",
										"publishing",
										"pageCount",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/hostnames": {
			"get": {
				"summary": "List a website's addresses",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SiteHostname"
											}
										}
									},
									"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": "Connect an own domain",
				"tags": [
					"sites"
				],
				"description": "Returns the TXT (ownership) and CNAME (routing) records to add. Nothing is connected until ownership is proven.",
				"parameters": [
					{
						"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": {
									"hostname": {
										"type": "string",
										"minLength": 1,
										"maxLength": 253
									}
								},
								"required": [
									"hostname"
								]
							}
						}
					}
				},
				"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)$"
										},
										"hostname": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"free",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"verifying",
												"claiming",
												"provisioning",
												"active",
												"unhealthy",
												"removing",
												"conflict",
												"review_required",
												"awaiting_capacity"
											]
										},
										"canonical": {
											"type": "boolean"
										},
										"records": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"enum": [
															"TXT",
															"CNAME"
														]
													},
													"name": {
														"type": "string"
													},
													"value": {
														"type": "string"
													},
													"purpose": {
														"type": "string",
														"enum": [
															"ownership",
															"routing",
															"certificate"
														]
													},
													"found": {
														"type": "boolean"
													}
												},
												"required": [
													"type",
													"name",
													"value",
													"purpose",
													"found"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"null"
											]
										},
										"nextCheckAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
												}
											]
										},
										"dnsHost": {
											"type": [
												"string",
												"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",
										"hostname",
										"kind",
										"status",
										"canonical",
										"records",
										"lastError",
										"nextCheckAt",
										"parkedAt",
										"dnsHost",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/hostnames/{hostnameId}/check": {
			"post": {
				"summary": "Check a domain's DNS now",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "hostnameId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"hostname": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"free",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"verifying",
												"claiming",
												"provisioning",
												"active",
												"unhealthy",
												"removing",
												"conflict",
												"review_required",
												"awaiting_capacity"
											]
										},
										"canonical": {
											"type": "boolean"
										},
										"records": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"enum": [
															"TXT",
															"CNAME"
														]
													},
													"name": {
														"type": "string"
													},
													"value": {
														"type": "string"
													},
													"purpose": {
														"type": "string",
														"enum": [
															"ownership",
															"routing",
															"certificate"
														]
													},
													"found": {
														"type": "boolean"
													}
												},
												"required": [
													"type",
													"name",
													"value",
													"purpose",
													"found"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"null"
											]
										},
										"nextCheckAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
												}
											]
										},
										"dnsHost": {
											"type": [
												"string",
												"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",
										"hostname",
										"kind",
										"status",
										"canonical",
										"records",
										"lastError",
										"nextCheckAt",
										"parkedAt",
										"dnsHost",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/hostnames/{hostnameId}/retry": {
			"post": {
				"summary": "Restart a parked domain's checks",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "hostnameId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"hostname": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"free",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"verifying",
												"claiming",
												"provisioning",
												"active",
												"unhealthy",
												"removing",
												"conflict",
												"review_required",
												"awaiting_capacity"
											]
										},
										"canonical": {
											"type": "boolean"
										},
										"records": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"enum": [
															"TXT",
															"CNAME"
														]
													},
													"name": {
														"type": "string"
													},
													"value": {
														"type": "string"
													},
													"purpose": {
														"type": "string",
														"enum": [
															"ownership",
															"routing",
															"certificate"
														]
													},
													"found": {
														"type": "boolean"
													}
												},
												"required": [
													"type",
													"name",
													"value",
													"purpose",
													"found"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"null"
											]
										},
										"nextCheckAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
												}
											]
										},
										"dnsHost": {
											"type": [
												"string",
												"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",
										"hostname",
										"kind",
										"status",
										"canonical",
										"records",
										"lastError",
										"nextCheckAt",
										"parkedAt",
										"dnsHost",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/hostnames/{hostnameId}/canonical": {
			"post": {
				"summary": "Make a domain the website's main address",
				"tags": [
					"sites"
				],
				"description": "Other addresses redirect to it; linked campaigns follow.",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "hostnameId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"hostname": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"free",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"verifying",
												"claiming",
												"provisioning",
												"active",
												"unhealthy",
												"removing",
												"conflict",
												"review_required",
												"awaiting_capacity"
											]
										},
										"canonical": {
											"type": "boolean"
										},
										"records": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"enum": [
															"TXT",
															"CNAME"
														]
													},
													"name": {
														"type": "string"
													},
													"value": {
														"type": "string"
													},
													"purpose": {
														"type": "string",
														"enum": [
															"ownership",
															"routing",
															"certificate"
														]
													},
													"found": {
														"type": "boolean"
													}
												},
												"required": [
													"type",
													"name",
													"value",
													"purpose",
													"found"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"null"
											]
										},
										"nextCheckAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
												}
											]
										},
										"dnsHost": {
											"type": [
												"string",
												"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",
										"hostname",
										"kind",
										"status",
										"canonical",
										"records",
										"lastError",
										"nextCheckAt",
										"parkedAt",
										"dnsHost",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/hostnames/{hostnameId}/cloudflare-dns": {
			"post": {
				"summary": "Add the DNS records to the practice's own Cloudflare zone",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "hostnameId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": 20,
										"maxLength": 200
									}
								},
								"required": [
									"apiToken"
								]
							}
						}
					}
				},
				"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)$"
										},
										"hostname": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"free",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"verifying",
												"claiming",
												"provisioning",
												"active",
												"unhealthy",
												"removing",
												"conflict",
												"review_required",
												"awaiting_capacity"
											]
										},
										"canonical": {
											"type": "boolean"
										},
										"records": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"enum": [
															"TXT",
															"CNAME"
														]
													},
													"name": {
														"type": "string"
													},
													"value": {
														"type": "string"
													},
													"purpose": {
														"type": "string",
														"enum": [
															"ownership",
															"routing",
															"certificate"
														]
													},
													"found": {
														"type": "boolean"
													}
												},
												"required": [
													"type",
													"name",
													"value",
													"purpose",
													"found"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"null"
											]
										},
										"nextCheckAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
												}
											]
										},
										"dnsHost": {
											"type": [
												"string",
												"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",
										"hostname",
										"kind",
										"status",
										"canonical",
										"records",
										"lastError",
										"nextCheckAt",
										"parkedAt",
										"dnsHost",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/hostnames/{hostnameId}": {
			"delete": {
				"summary": "Disconnect a domain",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "hostnameId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"hostname": {
											"type": "string"
										},
										"kind": {
											"type": "string",
											"enum": [
												"free",
												"custom"
											]
										},
										"status": {
											"type": "string",
											"enum": [
												"verifying",
												"claiming",
												"provisioning",
												"active",
												"unhealthy",
												"removing",
												"conflict",
												"review_required",
												"awaiting_capacity"
											]
										},
										"canonical": {
											"type": "boolean"
										},
										"records": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"type": {
														"type": "string",
														"enum": [
															"TXT",
															"CNAME"
														]
													},
													"name": {
														"type": "string"
													},
													"value": {
														"type": "string"
													},
													"purpose": {
														"type": "string",
														"enum": [
															"ownership",
															"routing",
															"certificate"
														]
													},
													"found": {
														"type": "boolean"
													}
												},
												"required": [
													"type",
													"name",
													"value",
													"purpose",
													"found"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"null"
											]
										},
										"nextCheckAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
												}
											]
										},
										"dnsHost": {
											"type": [
												"string",
												"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",
										"hostname",
										"kind",
										"status",
										"canonical",
										"records",
										"lastError",
										"nextCheckAt",
										"parkedAt",
										"dnsHost",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/previews": {
			"get": {
				"summary": "List share-preview links",
				"tags": [
					"sites"
				],
				"description": "Links still open first, then revoked and expired ones, newest first in each. The next page continues from `nextCursor`.",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"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/SitePreview"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a share-preview link of the drafts",
				"tags": [
					"sites"
				],
				"description": "The link is returned once; it carries its capability in the URL fragment.",
				"parameters": [
					{
						"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": {
									"pageIds": {
										"default": [],
										"maxItems": 10000,
										"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": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"preview": {
											"$ref": "#/components/schemas/SitePreview"
										},
										"url": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"preview",
										"url"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/previews/{previewId}": {
			"delete": {
				"summary": "Revoke a share-preview link",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "previewId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"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))$"
										},
										"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))$"
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"id",
										"expiresAt",
										"revokedAt",
										"createdAt",
										"createdByName"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/posts": {
			"get": {
				"summary": "List a website's blog posts",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SitePost"
											}
										}
									},
									"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": "Publish an approved Content Studio article to the blog",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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": {
									"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)$"
									},
									"slug": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200,
										"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
									},
									"approvedRevisionId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
									}
								},
								"required": [
									"documentId",
									"slug",
									"approvedRevisionId",
									"version"
								]
							}
						}
					}
				},
				"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)$"
										},
										"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)$"
										},
										"slug": {
											"type": "string"
										},
										"title": {
											"type": "string"
										},
										"url": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"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"
												}
											]
										}
									},
									"required": [
										"id",
										"documentId",
										"slug",
										"title",
										"url",
										"publishedAt"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/posts/{postId}": {
			"delete": {
				"summary": "Take a blog post down",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "postId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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)$"
										},
										"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)$"
										},
										"slug": {
											"type": "string"
										},
										"title": {
											"type": "string"
										},
										"url": {
											"anyOf": [
												{
													"type": "string",
													"format": "uri"
												},
												{
													"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"
												}
											]
										}
									},
									"required": [
										"id",
										"documentId",
										"slug",
										"title",
										"url",
										"publishedAt"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/pages/{pageId}/ab-test": {
			"post": {
				"summary": "Create version B of a page",
				"tags": [
					"sites"
				],
				"description": "Copies the page into a noindex variant draft. The test starts when both versions are published.",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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": {
										"page": {
											"$ref": "#/components/schemas/SitePageSummary"
										},
										"document": {
											"$ref": "#/components/schemas/SitePageDocument"
										},
										"draftRevision": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"page",
										"document",
										"draftRevision"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/landing-pages": {
			"post": {
				"summary": "Create and publish a landing page from a template",
				"tags": [
					"sites"
				],
				"description": "Uses the newest website live on an own domain, else the practice's landing site (created on the free address).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"templateKey": {
										"type": "string",
										"enum": [
											"implants",
											"clear_aligners",
											"new_patients",
											"cosmetic",
											"emergency",
											"us_benefits"
										]
									},
									"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"
											}
										]
									},
									"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": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"required": [
									"templateKey",
									"treatmentId",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"siteId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"pageId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"url": {
											"type": "string",
											"format": "uri"
										},
										"version": {
											"$ref": "#/components/schemas/SiteVersion"
										}
									},
									"required": [
										"siteId",
										"pageId",
										"url",
										"version"
									],
									"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": "Landing pages across websites, with their results",
				"tags": [
					"sites"
				],
				"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": {
									"type": "object",
									"properties": {
										"entitlement": {
											"$ref": "#/components/schemas/AdsEntitlement"
										},
										"permissions": {
											"$ref": "#/components/schemas/AdsPermissions"
										},
										"data": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/SitePagePerformance"
													}
												}
											},
											"required": [
												"items"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"entitlement",
										"permissions",
										"data"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/sites/destinations": {
			"get": {
				"summary": "Published pages a campaign can send people to",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"name": "treatment",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 120
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SiteDestination"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/performance": {
			"get": {
				"summary": "Visitors, enquiries and bookings per page",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"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": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SitePagePerformance"
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/import": {
			"post": {
				"summary": "Import an existing website into this one",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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": {
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									},
									"confirmOwnership": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"url",
									"confirmOwnership"
								]
							}
						}
					}
				},
				"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)$"
										},
										"status": {
											"type": "string",
											"enum": [
												"queued",
												"running",
												"done",
												"parked",
												"cancelled"
											]
										},
										"sourceUrl": {
											"type": "string",
											"format": "uri"
										},
										"pagesFound": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesStored": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesMapped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesSkipped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"exclusions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"url": {
														"type": "string"
													},
													"reason": {
														"type": "string",
														"enum": [
															"off_site",
															"not_html",
															"robots",
															"duplicate",
															"too_long"
														]
													}
												},
												"required": [
													"url",
													"reason"
												],
												"additionalProperties": false
											}
										},
										"exclusionsCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"pagesWithheld": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"withheld": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"count": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"excerpts": {
														"type": "array",
														"items": {
															"type": "string"
														}
													}
												},
												"required": [
													"id",
													"url",
													"count",
													"excerpts"
												],
												"additionalProperties": false
											}
										},
										"withheldCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"fetches": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"state": {
														"type": "string",
														"enum": [
															"queued",
															"stored",
															"parsed",
															"unreadable",
															"excluded",
															"discarded"
														]
													},
													"lastError": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"url",
													"state",
													"lastError"
												],
												"additionalProperties": false
											}
										},
										"failedPages": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
													},
													"path": {
														"type": "string"
													},
													"issues": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"reply": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"pageId",
													"title",
													"path",
													"issues",
													"reply"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"sourceUrl",
										"pagesFound",
										"pagesStored",
										"pagesMapped",
										"pagesSkipped",
										"exclusions",
										"exclusionsCursor",
										"pagesWithheld",
										"withheld",
										"withheldCursor",
										"fetches",
										"failedPages",
										"lastError",
										"parkedAt",
										"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": "The website import's progress",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"anyOf": [
										{
											"$ref": "#/components/schemas/SiteImport"
										},
										{
											"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/import/retry": {
			"post": {
				"summary": "Retry a parked import",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					}
				],
				"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)$"
										},
										"status": {
											"type": "string",
											"enum": [
												"queued",
												"running",
												"done",
												"parked",
												"cancelled"
											]
										},
										"sourceUrl": {
											"type": "string",
											"format": "uri"
										},
										"pagesFound": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesStored": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesMapped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesSkipped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"exclusions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"url": {
														"type": "string"
													},
													"reason": {
														"type": "string",
														"enum": [
															"off_site",
															"not_html",
															"robots",
															"duplicate",
															"too_long"
														]
													}
												},
												"required": [
													"url",
													"reason"
												],
												"additionalProperties": false
											}
										},
										"exclusionsCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"pagesWithheld": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"withheld": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"count": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"excerpts": {
														"type": "array",
														"items": {
															"type": "string"
														}
													}
												},
												"required": [
													"id",
													"url",
													"count",
													"excerpts"
												],
												"additionalProperties": false
											}
										},
										"withheldCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"fetches": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"state": {
														"type": "string",
														"enum": [
															"queued",
															"stored",
															"parsed",
															"unreadable",
															"excluded",
															"discarded"
														]
													},
													"lastError": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"url",
													"state",
													"lastError"
												],
												"additionalProperties": false
											}
										},
										"failedPages": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
													},
													"path": {
														"type": "string"
													},
													"issues": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"reply": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"pageId",
													"title",
													"path",
													"issues",
													"reply"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"sourceUrl",
										"pagesFound",
										"pagesStored",
										"pagesMapped",
										"pagesSkipped",
										"exclusions",
										"exclusionsCursor",
										"pagesWithheld",
										"withheld",
										"withheldCursor",
										"fetches",
										"failedPages",
										"lastError",
										"parkedAt",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/import/fetches/{fetchId}/{action}": {
			"post": {
				"summary": "Retry or discard one unreadable imported page",
				"tags": [
					"sites"
				],
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "fetchId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "action",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"retry",
								"discard"
							]
						}
					}
				],
				"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",
											"enum": [
												"queued",
												"running",
												"done",
												"parked",
												"cancelled"
											]
										},
										"sourceUrl": {
											"type": "string",
											"format": "uri"
										},
										"pagesFound": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesStored": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesMapped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesSkipped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"exclusions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"url": {
														"type": "string"
													},
													"reason": {
														"type": "string",
														"enum": [
															"off_site",
															"not_html",
															"robots",
															"duplicate",
															"too_long"
														]
													}
												},
												"required": [
													"url",
													"reason"
												],
												"additionalProperties": false
											}
										},
										"exclusionsCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"pagesWithheld": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"withheld": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"count": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"excerpts": {
														"type": "array",
														"items": {
															"type": "string"
														}
													}
												},
												"required": [
													"id",
													"url",
													"count",
													"excerpts"
												],
												"additionalProperties": false
											}
										},
										"withheldCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"fetches": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"state": {
														"type": "string",
														"enum": [
															"queued",
															"stored",
															"parsed",
															"unreadable",
															"excluded",
															"discarded"
														]
													},
													"lastError": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"url",
													"state",
													"lastError"
												],
												"additionalProperties": false
											}
										},
										"failedPages": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
													},
													"path": {
														"type": "string"
													},
													"issues": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"reply": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"pageId",
													"title",
													"path",
													"issues",
													"reply"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"sourceUrl",
										"pagesFound",
										"pagesStored",
										"pagesMapped",
										"pagesSkipped",
										"exclusions",
										"exclusionsCursor",
										"pagesWithheld",
										"withheld",
										"withheldCursor",
										"fetches",
										"failedPages",
										"lastError",
										"parkedAt",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/import/pages/{pageId}/{action}": {
			"post": {
				"summary": "Retry a website page's imported text, or leave the page as it is",
				"tags": [
					"sites"
				],
				"description": "For a page whose imported text couldn't be used (the import stopped on it). 409 SITE_IMPORT_PAGE_NOT_FAILED for any other page; 409 SITE_IMPORT_BUSY while the import is running.",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"name": "pageId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "action",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"retry",
								"discard"
							]
						}
					}
				],
				"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",
											"enum": [
												"queued",
												"running",
												"done",
												"parked",
												"cancelled"
											]
										},
										"sourceUrl": {
											"type": "string",
											"format": "uri"
										},
										"pagesFound": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesStored": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesMapped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"pagesSkipped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"exclusions": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"url": {
														"type": "string"
													},
													"reason": {
														"type": "string",
														"enum": [
															"off_site",
															"not_html",
															"robots",
															"duplicate",
															"too_long"
														]
													}
												},
												"required": [
													"url",
													"reason"
												],
												"additionalProperties": false
											}
										},
										"exclusionsCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"pagesWithheld": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"withheld": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"count": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"excerpts": {
														"type": "array",
														"items": {
															"type": "string"
														}
													}
												},
												"required": [
													"id",
													"url",
													"count",
													"excerpts"
												],
												"additionalProperties": false
											}
										},
										"withheldCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"fetches": {
											"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)$"
													},
													"url": {
														"type": "string"
													},
													"state": {
														"type": "string",
														"enum": [
															"queued",
															"stored",
															"parsed",
															"unreadable",
															"excluded",
															"discarded"
														]
													},
													"lastError": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"url",
													"state",
													"lastError"
												],
												"additionalProperties": false
											}
										},
										"failedPages": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"pageId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
													},
													"path": {
														"type": "string"
													},
													"issues": {
														"type": "array",
														"items": {
															"type": "string"
														}
													},
													"reply": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"pageId",
													"title",
													"path",
													"issues",
													"reply"
												],
												"additionalProperties": false
											}
										},
										"lastError": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"sourceUrl",
										"pagesFound",
										"pagesStored",
										"pagesMapped",
										"pagesSkipped",
										"exclusions",
										"exclusionsCursor",
										"pagesWithheld",
										"withheld",
										"withheldCursor",
										"fetches",
										"failedPages",
										"lastError",
										"parkedAt",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/import/exclusions": {
			"get": {
				"summary": "The URLs the website import skipped, and why",
				"tags": [
					"sites"
				],
				"description": "Oldest first. The next page continues from `nextCursor`.",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"url": {
														"type": "string"
													},
													"reason": {
														"type": "string",
														"enum": [
															"off_site",
															"not_html",
															"robots",
															"duplicate",
															"too_long"
														]
													}
												},
												"required": [
													"url",
													"reason"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/sites/{siteId}/import/withheld": {
			"get": {
				"summary": "Imported pages with words left out for the practice to add by hand",
				"tags": [
					"sites"
				],
				"description": "Testimonials, reviews, quotes, ratings and words the import couldn't tell apart from them never reach the AI. Oldest first; the next page continues from `nextCursor`.",
				"parameters": [
					{
						"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)$"
						}
					},
					{
						"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)$"
						}
					}
				],
				"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)$"
													},
													"url": {
														"type": "string"
													},
													"count": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"excerpts": {
														"type": "array",
														"items": {
															"type": "string"
														}
													}
												},
												"required": [
													"id",
													"url",
													"count",
													"excerpts"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas/board": {
			"get": {
				"summary": "The ideas board: every group and the first page of each column",
				"tags": [
					"Social"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"groups": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialIdeaGroup"
											}
										},
										"columns": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"groupId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"ideas": {
														"type": "array",
														"items": {
															"$ref": "#/components/schemas/SocialIdea"
														}
													},
													"nextCursor": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"groupId",
													"ideas",
													"nextCursor"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"groups",
										"columns"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas": {
			"get": {
				"summary": "The next page of one board column",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "group",
						"in": "query",
						"required": true,
						"schema": {
							"anyOf": [
								{
									"type": "string",
									"format": "uuid",
									"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
								},
								{
									"type": "string",
									"const": "unassigned"
								}
							]
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ideas": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialIdea"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"ideas",
										"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"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Add an idea",
				"tags": [
					"Social"
				],
				"description": "404 when groupId is not one of the practice's groups; 422 SOCIAL_MEDIA_NOT_FOUND for a file that is not the practice's, 409 SOCIAL_MEDIA_NOT_READY while one uploads.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"groupId": {
										"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"
											}
										]
									},
									"title": {
										"default": null,
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"body": {
										"default": "",
										"type": "string",
										"maxLength": 10000
									},
									"mediaAssetIds": {
										"default": [],
										"maxItems": 35,
										"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": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialIdea"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas/{id}": {
			"patch": {
				"summary": "Edit an idea's title, body or files",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"title": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"body": {
										"type": "string",
										"maxLength": 10000
									},
									"mediaAssetIds": {
										"maxItems": 35,
										"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": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialIdea"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete an idea",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas/{id}/move": {
			"post": {
				"summary": "Move an idea to another column",
				"tags": [
					"Social"
				],
				"description": "404 when the idea or the target group 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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"expectedVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"groupId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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",
									"groupId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialIdea"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas/groups": {
			"post": {
				"summary": "Add a group at the end of the board",
				"tags": [
					"Social"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 50
									}
								},
								"required": [
									"name"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialIdeaGroup"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas/groups/{groupId}": {
			"patch": {
				"summary": "Rename a group or move it one place left or right",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "groupId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": 50
									},
									"move": {
										"type": "string",
										"enum": [
											"left",
											"right"
										]
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialIdeaGroup"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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 group; its ideas move to Unassigned",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "groupId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas/ai/ideas": {
			"post": {
				"summary": "Suggest post ideas with AI (not saved)",
				"tags": [
					"Social"
				],
				"description": "Needs the AI add-on and AI assist; spends the practice's shared AI budget (429 RATE_LIMITED when it is spent). 503 AI_UNAVAILABLE when the model answers with something unusable.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"topic": {
										"type": "string",
										"minLength": 1,
										"maxLength": 300
									},
									"count": {
										"default": 6,
										"type": "integer",
										"minimum": 1,
										"maximum": 10
									},
									"locale": {
										"type": "string",
										"enum": [
											"en",
											"es",
											"it"
										]
									}
								},
								"required": [
									"locale"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"ideas": {
											"minItems": 1,
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"title": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													"body": {
														"type": "string",
														"maxLength": 10000
													}
												},
												"required": [
													"title",
													"body"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"ideas"
									],
									"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/ideas/ai/captions": {
			"post": {
				"summary": "Write three caption variants with AI (not saved)",
				"tags": [
					"Social"
				],
				"description": "Same gates and shared AI budget as AI ideas. 503 AI_UNAVAILABLE when the model answers with something unusable.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"content": {
										"type": "string",
										"maxLength": 10000
									},
									"instruction": {
										"type": "string",
										"minLength": 1,
										"maxLength": 500
									},
									"platforms": {
										"minItems": 1,
										"maxItems": 6,
										"type": "array",
										"items": {
											"type": "string",
											"enum": [
												"facebook",
												"instagram",
												"google_business_profile",
												"tiktok",
												"linkedin",
												"youtube"
											]
										}
									},
									"locale": {
										"type": "string",
										"enum": [
											"en",
											"es",
											"it"
										]
									}
								},
								"required": [
									"platforms",
									"locale"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"captions": {
											"minItems": 3,
											"maxItems": 3,
											"type": "array",
											"items": {
												"type": "string"
											}
										}
									},
									"required": [
										"captions"
									],
									"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts": {
			"get": {
				"summary": "Connected social accounts and which platforms can be connected",
				"tags": [
					"Social"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"accounts": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialAccount"
											}
										},
										"youtubeDeletions": {
											"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)$"
													},
													"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))$"
													},
													"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))$"
													},
													"deadlineState": {
														"type": "string",
														"enum": [
															"pending",
															"approaching",
															"overdue"
														]
													},
													"error": {
														"type": [
															"string",
															"null"
														]
													},
													"revocationPending": {
														"type": "boolean"
													}
												},
												"required": [
													"accountId",
													"requestedAt",
													"deadlineAt",
													"deadlineState",
													"error",
													"revocationPending"
												],
												"additionalProperties": false
											}
										},
										"connect": {
											"type": "object",
											"properties": {
												"meta": {
													"type": "boolean"
												},
												"googleBusinessProfile": {
													"type": "boolean"
												},
												"tiktok": {
													"type": "boolean"
												},
												"linkedin": {
													"type": "boolean"
												},
												"youtube": {
													"type": "boolean"
												}
											},
											"required": [
												"meta",
												"googleBusinessProfile",
												"tiktok",
												"linkedin",
												"youtube"
											],
											"additionalProperties": false
										},
										"audited": {
											"type": "object",
											"properties": {
												"tiktok": {
													"type": "boolean"
												},
												"youtube": {
													"type": "boolean"
												}
											},
											"required": [
												"tiktok",
												"youtube"
											],
											"additionalProperties": false
										},
										"pausedPosts": {
											"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)$"
													},
													"count": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"since": {
														"type": "string",
														"format": "date-time",
														"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
													}
												},
												"required": [
													"accountId",
													"count",
													"since"
												],
												"additionalProperties": false
											}
										},
										"scheduledPosts": {
											"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)$"
													},
													"count": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													}
												},
												"required": [
													"accountId",
													"count"
												],
												"additionalProperties": false
											}
										},
										"googleBusinessProfile": {
											"type": "object",
											"properties": {
												"connections": {
													"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": [
																	"connecting",
																	"active",
																	"error",
																	"revoked"
																]
															},
															"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"
																	}
																]
															},
															"awaitingLocationChoice": {
																"type": "boolean"
															},
															"connectedByUserId": {
																"type": [
																	"string",
																	"null"
																]
															}
														},
														"required": [
															"id",
															"status",
															"errorCode",
															"awaitingLocationChoice",
															"connectedByUserId"
														],
														"additionalProperties": false
													}
												},
												"locations": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"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)$"
															},
															"title": {
																"type": "string"
															},
															"eligible": {
																"type": "boolean"
															}
														},
														"required": [
															"reputationLocationId",
															"title",
															"eligible"
														],
														"additionalProperties": false
													}
												}
											},
											"required": [
												"connections",
												"locations"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"accounts",
										"youtubeDeletions",
										"connect",
										"audited",
										"pausedPosts",
										"scheduledPosts",
										"googleBusinessProfile"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts/connect": {
			"post": {
				"summary": "Start connecting a social platform",
				"tags": [
					"Social"
				],
				"description": "Returns the provider's authorize URL; the callback returns to the Social accounts page. `meta` connects Facebook and Instagram through the Inbox Meta connect and also needs channelConnection:create. 409 SOCIAL_PLATFORM_NOT_CONFIGURED while a platform's connection is not available yet.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"platform": {
										"type": "string",
										"enum": [
											"meta",
											"tiktok",
											"linkedin",
											"youtube"
										]
									}
								},
								"required": [
									"platform"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"authorizeUrl": {
											"type": "string"
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts/gbp": {
			"post": {
				"summary": "Add a Google Business Profile location as a social account",
				"tags": [
					"Social"
				],
				"description": "The location must be verified by Google and linked to a practice location on an active Google connection (409 SOCIAL_GBP_LOCATION_UNAVAILABLE otherwise); the SEO review `enabled` switch does not affect posting. Adding a removed location again restores the same account.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"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": [
									"reputationLocationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialAccount"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts/{id}": {
			"delete": {
				"summary": "Remove a social account",
				"tags": [
					"Social"
				],
				"description": "Archives the account. Facebook, Instagram and Google Business Profile keep their Inbox and Google connections; an account's own grant is deleted, never revoked at the provider (revocation is grant-wide). Its live Auto-DM automations stop, their queued replies with them. Its scheduled posts pause when they fall due. Connecting again restores the same account, but neither publishes the paused posts nor restarts an automation by itself.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts/{id}/youtube/revoke": {
			"post": {
				"summary": "Revoke Google access and delete cached YouTube data",
				"tags": [
					"Social"
				],
				"description": "Owner browser session only. Explicitly acknowledges authority over the Google grant and that revocation may disconnect other practices sharing it. Uploaded videos and practice-authored posts are preserved. Deletion is durable and its progress appears in GET /social/accounts.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"acknowledgeSharedGoogleAccess": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"acknowledgeSharedGoogleAccess"
								]
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted"
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts/{id}/youtube/retry-deletion": {
			"post": {
				"summary": "Retry pending YouTube revocation and data deletion",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/media": {
			"post": {
				"summary": "Start uploading a photo or video",
				"tags": [
					"Social"
				],
				"description": "Creates the upload and answers the part size and count: PUT each part to /social/media/:id/parts/:n, then POST /social/media/:id/complete. An upload with no part for 24 hours expires. Photos are JPEG up to 8 MiB; videos MP4 or MOV up to 256 GiB (each channel's own limits apply when posting).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"kind": {
										"type": "string",
										"enum": [
											"photo",
											"video"
										]
									},
									"mime": {
										"type": "string",
										"enum": [
											"image/jpeg",
											"video/mp4",
											"video/quicktime"
										]
									},
									"bytes": {
										"type": "integer",
										"minimum": 1,
										"maximum": 274877906944
									},
									"width": {
										"type": "integer",
										"minimum": 1,
										"maximum": 8192
									},
									"height": {
										"type": "integer",
										"minimum": 1,
										"maximum": 8192
									},
									"durationMs": {
										"type": "integer",
										"minimum": 1,
										"maximum": 2147483647
									},
									"expectedOrganizationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
										"description": "Canonical lowercase UUID organization identifier"
									}
								},
								"required": [
									"kind",
									"mime",
									"bytes"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"asset": {
											"$ref": "#/components/schemas/SocialMediaAsset"
										},
										"partSize": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"partCount": {
											"type": "integer",
											"minimum": 1,
											"maximum": 10000
										}
									},
									"required": [
										"asset",
										"partSize",
										"partCount"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/media/{id}/parts/{n}": {
			"put": {
				"summary": "Upload one part of a photo or video",
				"tags": [
					"Social"
				],
				"description": "Streams one part: Content-Length must be the part's exact size (partSize, the remainder for the last part). Sending a part again replaces it. 409 SOCIAL_MEDIA_UPLOAD_EXPIRED once the upload has expired or completed.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "n",
						"in": "path",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 10000
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/octet-stream": {
							"schema": {
								"type": "string",
								"description": "The part's bytes",
								"format": "binary"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"partNumber": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"etag": {
											"type": "string"
										}
									},
									"required": [
										"partNumber",
										"etag"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/media/{id}/complete": {
			"post": {
				"summary": "Finish uploading a photo or video",
				"tags": [
					"Social"
				],
				"description": "Assembles the parts. A photo must be a JPEG of the declared size and dimensions (422 SOCIAL_MEDIA_INVALID otherwise, and the upload is discarded). 409 SOCIAL_MEDIA_UPLOAD_EXPIRED when the upload expired first. Completing a finished upload again answers the file.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"parts": {
										"minItems": 1,
										"maxItems": 10000,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"partNumber": {
													"type": "integer",
													"minimum": 1,
													"maximum": 10000
												},
												"etag": {
													"type": "string",
													"minLength": 1,
													"maxLength": 256
												}
											},
											"required": [
												"partNumber",
												"etag"
											],
											"additionalProperties": false
										}
									}
								},
								"required": [
									"parts"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialMediaAsset"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/media/{id}/content": {
			"get": {
				"summary": "Preview an uploaded photo or video",
				"tags": [
					"Social"
				],
				"description": "Streams a ready file privately (no-store). A single `Range: bytes=` request answers 206 with Content-Range, so a video preview can seek.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-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",
									"format": "binary"
								}
							}
						}
					},
					"206": {
						"description": "Partial Content",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string",
									"format": "binary"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"416": {
						"description": "Range Not Satisfiable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/media/{id}": {
			"delete": {
				"summary": "Delete an unused photo or video",
				"tags": [
					"Social"
				],
				"description": "Cancels an upload or deletes a file no post or idea uses (409 SOCIAL_MEDIA_IN_USE otherwise). The stored bytes are removed within the hour.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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"
								}
							}
						}
					}
				}
			}
		},
		"/social/posts": {
			"get": {
				"summary": "Posts scheduled on practice-local days, or the drafts",
				"tags": [
					"Social"
				],
				"description": "`from` and `to` (inclusive) are the practice's own calendar days; posts come in time order, 100 per page, together with the posts made on the platforms themselves in those days (`nativePosts`, read-only, from the insights import). `status=draft` lists the posts with no time instead.",
				"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",
							"const": "draft"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"posts": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialPost"
											}
										},
										"nativePosts": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialNativePost"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"posts",
										"nativePosts",
										"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"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a draft, schedule, queue or publish a post",
				"tags": [
					"Social"
				],
				"description": "Accounts, media and the idea must be the practice's (404 otherwise; 422 SOCIAL_MEDIA_NOT_FOUND for a file, 409 SOCIAL_MEDIA_NOT_READY while one uploads). Scheduling needs every account connected and able to publish, and runs the channel rules (422 SOCIAL_POST_INVALID). 422 SOCIAL_POST_SCHEDULE_PAST for a time more than a minute ago. Nothing is sent from here: publishing starts within the minute the post is due. While TikTok or YouTube has not passed its review, their posts are private.",
				"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)$"
									},
									"caption": {
										"default": "",
										"type": "string",
										"maxLength": 65536
									},
									"mediaAssetIds": {
										"default": [],
										"maxItems": 35,
										"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)$"
										}
									},
									"ideaId": {
										"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"
											}
										]
									},
									"mode": {
										"type": "string",
										"enum": [
											"draft",
											"schedule",
											"now",
											"queue"
										]
									},
									"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))$"
									},
									"targets": {
										"minItems": 1,
										"maxItems": 250,
										"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)$"
												},
												"captionOverride": {
													"default": null,
													"anyOf": [
														{
															"type": "string",
															"maxLength": 65536
														},
														{
															"type": "null"
														}
													]
												},
												"options": {
													"default": {},
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {}
												}
											},
											"required": [
												"accountId"
											],
											"additionalProperties": false
										}
									}
								},
								"required": [
									"clientRef",
									"mode",
									"targets"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/posts/{id}": {
			"get": {
				"summary": "A post with every account's status",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialPost"
								}
							}
						}
					},
					"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": "Edit, reschedule, queue or unschedule a post",
				"tags": [
					"Social"
				],
				"description": "Only before publishing starts and while every account is still draft or scheduled (409 SOCIAL_POST_SENT otherwise). A scheduled result runs the channel rules like create.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"caption": {
										"type": "string",
										"maxLength": 65536
									},
									"mediaAssetIds": {
										"maxItems": 35,
										"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)$"
										}
									},
									"targets": {
										"minItems": 1,
										"maxItems": 250,
										"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)$"
												},
												"captionOverride": {
													"default": null,
													"anyOf": [
														{
															"type": "string",
															"maxLength": 65536
														},
														{
															"type": "null"
														}
													]
												},
												"options": {
													"default": {},
													"type": "object",
													"propertyNames": {
														"type": "string"
													},
													"additionalProperties": {}
												}
											},
											"required": [
												"accountId"
											],
											"additionalProperties": false
										}
									},
									"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"
											}
										]
									},
									"queue": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"expectedVersion"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a post that is not live",
				"tags": [
					"Social"
				],
				"description": "Refused (409 SOCIAL_POST_IN_FLIGHT) once any account is published, publishing, unknown, or has a request outstanding; live posts are never removed from the platforms. Its files are let go.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
							"minimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/posts/{id}/publish": {
			"post": {
				"summary": "Publish a draft or scheduled post now",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									}
								},
								"required": [
									"expectedVersion"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/posts/{id}/targets/{targetId}": {
			"patch": {
				"summary": "Edit one account's caption or options after it failed",
				"tags": [
					"Social"
				],
				"description": "Only for a failed or needs-attention account with no request outstanding (409 SOCIAL_TARGET_NOT_EDITABLE otherwise; an unknown outcome is resolved first). Runs the channel rules. Retry it afterwards.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "targetId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"captionOverride": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 65536
											},
											{
												"type": "null"
											}
										]
									},
									"options": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									}
								},
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/posts/{id}/targets/{targetId}/retry": {
			"post": {
				"summary": "Publish one failed or paused account again",
				"tags": [
					"Social"
				],
				"description": "Starts a new attempt within the minute; a request that may have reached the platform is checked first, so nothing is posted twice. 409 SOCIAL_TARGET_NOT_RETRYABLE unless the account failed or needs attention.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "targetId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialPost"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/posts/{id}/targets/{targetId}/resolve": {
			"post": {
				"summary": "Settle an account whose outcome is unknown",
				"tags": [
					"Social"
				],
				"description": "After checking the platform: mark_published records it as published (with its link when given), dismiss closes it. 409 SOCIAL_TARGET_NOT_UNKNOWN for any other 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": "targetId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": "mark_published"
											},
											"url": {
												"type": "string",
												"maxLength": 2048,
												"format": "uri"
											}
										},
										"required": [
											"action"
										],
										"additionalProperties": false
									},
									{
										"type": "object",
										"properties": {
											"action": {
												"type": "string",
												"const": "dismiss"
											}
										},
										"required": [
											"action"
										],
										"additionalProperties": false
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialPost"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/posting-slots": {
			"get": {
				"summary": "The weekly posting times Add to queue uses",
				"tags": [
					"Social"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"slots": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"weekday": {
														"type": "integer",
														"minimum": 1,
														"maximum": 7
													},
													"minuteOfDay": {
														"type": "integer",
														"minimum": 0,
														"maximum": 1439
													}
												},
												"required": [
													"weekday",
													"minuteOfDay"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"slots"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"put": {
				"summary": "Replace the weekly posting times",
				"tags": [
					"Social"
				],
				"description": "Practice-local times. Posts already scheduled keep their times; later queue picks use the new set.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"slots": {
										"maxItems": 10080,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"weekday": {
													"type": "integer",
													"minimum": 1,
													"maximum": 7
												},
												"minuteOfDay": {
													"type": "integer",
													"minimum": 0,
													"maximum": 1439
												}
											},
											"required": [
												"weekday",
												"minuteOfDay"
											],
											"additionalProperties": false
										}
									}
								},
								"required": [
									"slots"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"slots": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"weekday": {
														"type": "integer",
														"minimum": 1,
														"maximum": 7
													},
													"minuteOfDay": {
														"type": "integer",
														"minimum": 0,
														"maximum": 1439
													}
												},
												"required": [
													"weekday",
													"minuteOfDay"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"slots"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts/{id}/tiktok-creator": {
			"get": {
				"summary": "A TikTok account's current posting settings",
				"tags": [
					"Social"
				],
				"description": "Read live from TikTok for the composer. 409 SOCIAL_ACCOUNT_NEEDS_REAUTH when the account must reconnect, 409 SOCIAL_PLATFORM_NOT_CONFIGURED when TikTok is unavailable here, 503 SOCIAL_PROVIDER_UNAVAILABLE when TikTok does not answer.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"username": {
											"type": "string"
										},
										"nickname": {
											"type": [
												"string",
												"null"
											]
										},
										"avatarUrl": {
											"type": [
												"string",
												"null"
											]
										},
										"privacyLevelOptions": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"commentDisabled": {
											"type": "boolean"
										},
										"duetDisabled": {
											"type": "boolean"
										},
										"stitchDisabled": {
											"type": "boolean"
										},
										"maxVideoPostDurationSec": {
											"type": [
												"number",
												"null"
											]
										}
									},
									"required": [
										"username",
										"nickname",
										"avatarUrl",
										"privacyLevelOptions",
										"commentDisabled",
										"duetDisabled",
										"stitchDisabled",
										"maxVideoPostDurationSec"
									],
									"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/accounts/{id}/resume-paused": {
			"post": {
				"summary": "Publish the posts paused while the account was disconnected",
				"tags": [
					"Social"
				],
				"description": "A reconnect never publishes them by itself. Needs the account connected again (409 SOCIAL_ACCOUNT_NEEDS_REAUTH otherwise).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"resumed": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"resumed"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/automations": {
			"get": {
				"summary": "Auto-DM automations, most recently changed first, with metrics",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"automations": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialAutomation"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"automations",
										"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"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a draft automation",
				"tags": [
					"Social"
				],
				"description": "404 when the account is not one of the practice's; 422 SOCIAL_AUTOMATION_ACCOUNT when it is not a Facebook Page or Instagram account.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"socialAccountId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"postScope": {
										"type": "string",
										"enum": [
											"any",
											"specific"
										]
									},
									"postId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"postSnapshot": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"caption": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 200
															},
															{
																"type": "null"
															}
														]
													},
													"permalink": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2000,
																"format": "uri"
															},
															{
																"type": "null"
															}
														]
													},
													"thumbnailUrl": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2000,
																"format": "uri"
															},
															{
																"type": "null"
															}
														]
													},
													"postedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
													"caption",
													"permalink",
													"thumbnailUrl",
													"postedAt"
												],
												"additionalProperties": false
											},
											{
												"type": "null"
											}
										]
									},
									"keywordMode": {
										"type": "string",
										"enum": [
											"keywords",
											"any"
										]
									},
									"keywords": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 50
										}
									},
									"publicReplyEnabled": {
										"type": "boolean"
									},
									"publicReplies": {
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 1000
										}
									},
									"openingEnabled": {
										"type": "boolean"
									},
									"openingText": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 640
											},
											{
												"type": "null"
											}
										]
									},
									"openingButtonLabel": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"linkText": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 640
											},
											{
												"type": "null"
											}
										]
									},
									"linkButtonLabel": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"linkUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"oncePerUser": {
										"type": "boolean"
									}
								},
								"required": [
									"name",
									"socialAccountId"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialAutomation"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/automations/posts": {
			"get": {
				"summary": "Recent posts of a Facebook Page or Instagram account",
				"tags": [
					"Social"
				],
				"description": "A live read of the platform for the specific-post picker. 409 SOCIAL_ACCOUNT_NEEDS_REAUTH when the account must reconnect.",
				"parameters": [
					{
						"name": "socialAccountId",
						"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2000
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"posts": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string"
													},
													"caption": {
														"type": [
															"string",
															"null"
														]
													},
													"permalink": {
														"type": [
															"string",
															"null"
														]
													},
													"thumbnailUrl": {
														"type": [
															"string",
															"null"
														]
													},
													"postedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
															},
															{
																"type": "null"
															}
														]
													},
													"mediaType": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"id",
													"caption",
													"permalink",
													"thumbnailUrl",
													"postedAt",
													"mediaType"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"posts",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/automations/{id}": {
			"get": {
				"summary": "One automation with its metrics and readiness",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialAutomation"
								}
							}
						}
					},
					"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": "Edit an automation",
				"tags": [
					"Social"
				],
				"description": "While live the complete rules are re-checked (422 SOCIAL_AUTOMATION_INVALID with details.problems) and the edit applies to comments admitted afterwards.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"socialAccountId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"postScope": {
										"type": "string",
										"enum": [
											"any",
											"specific"
										]
									},
									"postId": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"postSnapshot": {
										"anyOf": [
											{
												"type": "object",
												"properties": {
													"caption": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 200
															},
															{
																"type": "null"
															}
														]
													},
													"permalink": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2000,
																"format": "uri"
															},
															{
																"type": "null"
															}
														]
													},
													"thumbnailUrl": {
														"anyOf": [
															{
																"type": "string",
																"maxLength": 2000,
																"format": "uri"
															},
															{
																"type": "null"
															}
														]
													},
													"postedAt": {
														"anyOf": [
															{
																"type": "string",
																"format": "date-time",
																"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
													"caption",
													"permalink",
													"thumbnailUrl",
													"postedAt"
												],
												"additionalProperties": false
											},
											{
												"type": "null"
											}
										]
									},
									"keywordMode": {
										"type": "string",
										"enum": [
											"keywords",
											"any"
										]
									},
									"keywords": {
										"maxItems": 20,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 50
										}
									},
									"publicReplyEnabled": {
										"type": "boolean"
									},
									"publicReplies": {
										"maxItems": 10,
										"type": "array",
										"items": {
											"type": "string",
											"minLength": 1,
											"maxLength": 1000
										}
									},
									"openingEnabled": {
										"type": "boolean"
									},
									"openingText": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 640
											},
											{
												"type": "null"
											}
										]
									},
									"openingButtonLabel": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"linkText": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 640
											},
											{
												"type": "null"
											}
										]
									},
									"linkButtonLabel": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 20
											},
											{
												"type": "null"
											}
										]
									},
									"linkUrl": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 2000,
												"format": "uri"
											},
											{
												"type": "null"
											}
										]
									},
									"oncePerUser": {
										"type": "boolean"
									},
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialAutomation"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a draft automation",
				"tags": [
					"Social"
				],
				"description": "409 SOCIAL_AUTOMATION_NOT_DRAFT once it has gone 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)$"
						}
					},
					{
						"name": "expectedVersion",
						"in": "query",
						"required": true,
						"schema": {
							"type": "integer",
							"exclusiveMinimum": 0,
							"maximum": 9007199254740991
						}
					}
				],
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/automations/{id}/go-live": {
			"post": {
				"summary": "Start replying to new comments",
				"tags": [
					"Social"
				],
				"description": "422 SOCIAL_AUTOMATION_INVALID with details.problems when a rule or the account's readiness fails. Only comments made after going live are 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": {
									"expectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialAutomation"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/automations/{id}/stop": {
			"post": {
				"summary": "Stop replying (queued replies are skipped; taps still get the link)",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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/SocialAutomation"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/automations/{id}/runs": {
			"get": {
				"summary": "Recent activity: one row per matched comment, newest first",
				"tags": [
					"Social"
				],
				"description": "Needs social:read and conversation: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)$"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"runs": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialAutomationRun"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"runs",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/automations/{id}/runs/{runId}/retry": {
			"post": {
				"summary": "Queue a failed run again",
				"tags": [
					"Social"
				],
				"description": "409 SOCIAL_AUTOMATION_RUN_NOT_FAILED for any other 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": "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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialAutomationRun"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/insights": {
			"get": {
				"summary": "Insights home: every channel, KPIs and series for the window",
				"tags": [
					"Social"
				],
				"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": {
									"type": "object",
									"properties": {
										"range": {
											"type": "object",
											"properties": {
												"from": {
													"type": "string"
												},
												"to": {
													"type": "string"
												}
											},
											"required": [
												"from",
												"to"
											],
											"additionalProperties": false
										},
										"channels": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialInsightsChannel"
											}
										},
										"kpis": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReportKpi"
											}
										},
										"series": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReportSeries"
											}
										}
									},
									"required": [
										"range",
										"channels",
										"kpis",
										"series"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/insights/accounts/{accountId}": {
			"get": {
				"summary": "One channel's KPIs and series for the window",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "accountId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "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": {
									"type": "object",
									"properties": {
										"range": {
											"type": "object",
											"properties": {
												"from": {
													"type": "string"
												},
												"to": {
													"type": "string"
												}
											},
											"required": [
												"from",
												"to"
											],
											"additionalProperties": false
										},
										"channel": {
											"$ref": "#/components/schemas/SocialInsightsChannel"
										},
										"kpis": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReportKpi"
											}
										},
										"series": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ReportSeries"
											}
										}
									},
									"required": [
										"range",
										"channel",
										"kpis",
										"series"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/insights/accounts/{accountId}/posts": {
			"get": {
				"summary": "Posts published on one channel in the window, newest first",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "accountId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "filters",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"posts": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialInsightsPost"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"posts",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/insights/posts/{id}/thumbnail": {
			"get": {
				"summary": "The stored preview image of a post made on the platform",
				"tags": [
					"Social"
				],
				"description": "Streams Smileline's copy of a native post's preview privately (no-store): 404 until it is copied, when the platform has none, and once the post is 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string",
									"format": "binary"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos": {
			"get": {
				"summary": "Videos, newest first, with the practice's video setup",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"videos": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialVideo"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"setup": {
											"$ref": "#/components/schemas/SocialVideoSetup"
										}
									},
									"required": [
										"videos",
										"nextCursor",
										"setup"
									],
									"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": "Start editing an uploaded video",
				"tags": [
					"Social"
				],
				"description": "Needs a ready MP4 or MOV video from /social/media (404 when it is not the practice's, 422 when it is not a ready MP4 or MOV video) and the consent tick. One video per upload: sending the same upload again answers the existing video (200).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"rawAssetId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"consent": {
										"type": "boolean",
										"const": true
									},
									"preferences": {
										"type": "object",
										"properties": {
											"targetSeconds": {
												"anyOf": [
													{
														"type": "number",
														"enum": [
															30,
															60,
															90
														]
													},
													{
														"type": "null"
													}
												]
											},
											"format": {
												"type": "string",
												"enum": [
													"9:16",
													"1:1",
													"16:9",
													"original"
												]
											},
											"captions": {
												"type": "object",
												"properties": {
													"enabled": {
														"type": "boolean"
													},
													"style": {
														"type": "string",
														"enum": [
															"highlight",
															"simple"
														]
													},
													"color": {
														"anyOf": [
															{
																"type": "string",
																"pattern": "^#[0-9a-fA-F]{6}$"
															},
															{
																"type": "null"
															}
														]
													}
												},
												"required": [
													"enabled",
													"style",
													"color"
												],
												"additionalProperties": false
											},
											"cleanup": {
												"type": "object",
												"properties": {
													"fillerWords": {
														"type": "boolean"
													},
													"longPauses": {
														"type": "boolean"
													},
													"studioSound": {
														"type": "boolean"
													},
													"levelVolume": {
														"type": "boolean"
													}
												},
												"required": [
													"fillerWords",
													"longPauses",
													"studioSound",
													"levelVolume"
												],
												"additionalProperties": false
											},
											"logo": {
												"type": "object",
												"properties": {
													"introOutro": {
														"type": "boolean"
													},
													"watermark": {
														"type": "boolean"
													}
												},
												"required": [
													"introOutro",
													"watermark"
												],
												"additionalProperties": false
											},
											"music": {
												"type": "string",
												"enum": [
													"off",
													"calm",
													"upbeat",
													"warm",
													"inspiring"
												]
											}
										},
										"required": [
											"targetSeconds",
											"format",
											"captions",
											"cleanup",
											"logo",
											"music"
										],
										"additionalProperties": false
									},
									"expectedOrganizationId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
										"description": "Canonical lowercase UUID organization identifier"
									}
								},
								"required": [
									"rawAssetId",
									"consent"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideo"
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideo"
								}
							}
						}
					},
					"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/setup": {
			"get": {
				"summary": "Whether the practice can edit videos, its Descript connection and defaults",
				"tags": [
					"Social"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideoSetup"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/preferences": {
			"put": {
				"summary": "Set the practice's default video preferences",
				"tags": [
					"Social"
				],
				"description": "402 PAID_SUBSCRIPTION_REQUIRED unless the subscription is active or past_due.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"targetSeconds": {
										"anyOf": [
											{
												"type": "number",
												"enum": [
													30,
													60,
													90
												]
											},
											{
												"type": "null"
											}
										]
									},
									"format": {
										"type": "string",
										"enum": [
											"9:16",
											"1:1",
											"16:9",
											"original"
										]
									},
									"captions": {
										"type": "object",
										"properties": {
											"enabled": {
												"type": "boolean"
											},
											"style": {
												"type": "string",
												"enum": [
													"highlight",
													"simple"
												]
											},
											"color": {
												"anyOf": [
													{
														"type": "string",
														"pattern": "^#[0-9a-fA-F]{6}$"
													},
													{
														"type": "null"
													}
												]
											}
										},
										"required": [
											"enabled",
											"style",
											"color"
										],
										"additionalProperties": false
									},
									"cleanup": {
										"type": "object",
										"properties": {
											"fillerWords": {
												"type": "boolean"
											},
											"longPauses": {
												"type": "boolean"
											},
											"studioSound": {
												"type": "boolean"
											},
											"levelVolume": {
												"type": "boolean"
											}
										},
										"required": [
											"fillerWords",
											"longPauses",
											"studioSound",
											"levelVolume"
										],
										"additionalProperties": false
									},
									"logo": {
										"type": "object",
										"properties": {
											"introOutro": {
												"type": "boolean"
											},
											"watermark": {
												"type": "boolean"
											}
										},
										"required": [
											"introOutro",
											"watermark"
										],
										"additionalProperties": false
									},
									"music": {
										"type": "string",
										"enum": [
											"off",
											"calm",
											"upbeat",
											"warm",
											"inspiring"
										]
									}
								},
								"required": [
									"targetSeconds",
									"format",
									"captions",
									"cleanup",
									"logo",
									"music"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideoSetup"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/descript": {
			"put": {
				"summary": "Connect (or reconnect) the practice's Descript account",
				"tags": [
					"Social"
				],
				"description": "Tests the token with Descript first (422 DESCRIPT_TOKEN_INVALID when refused, 502 when Descript cannot be reached). The token is stored encrypted and never returned. 402 PAID_SUBSCRIPTION_REQUIRED unless the subscription is active or past_due.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"token": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1024,
										"pattern": "^[\\x21-\\x7e]+$"
									}
								},
								"required": [
									"token"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideoSetup"
								}
							}
						}
					},
					"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Disconnect the practice's Descript account",
				"tags": [
					"Social"
				],
				"description": "Deletes the stored token. Projects already in Descript stay in the practice's Drive.",
				"responses": {
					"204": {
						"description": "No Content"
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/{id}": {
			"get": {
				"summary": "One video with its progress, check and suggested caption",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialVideo"
								}
							}
						}
					},
					"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 video and its footage",
				"tags": [
					"Social"
				],
				"description": "The raw upload and renders are deleted unless a post still uses the render. The Descript project stays in the practice's Drive.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/{id}/changes": {
			"post": {
				"summary": "Ask for changes to a ready or approved video",
				"tags": [
					"Social"
				],
				"description": "Plans and edits again from the instructions (billed like the first edit); an approved video goes back to review. 409 unless the video is ready for review or approved.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"instructions": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"instructions"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideo"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/{id}/retry": {
			"post": {
				"summary": "Resume a video that needs attention or was cancelled",
				"tags": [
					"Social"
				],
				"description": "Resumes at the step that stopped (a missing Descript project starts again from the import, an unavailable render from the render). 409 for any other 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)$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideo"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/{id}/cancel": {
			"post": {
				"summary": "Stop editing a video",
				"tags": [
					"Social"
				],
				"description": "Work already done stays billed. 409 unless the video is processing or needs attention.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialVideo"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/videos/{id}/approve": {
			"post": {
				"summary": "Approve the reviewed render so it can be posted",
				"tags": [
					"Social"
				],
				"description": "Approves the exact render reviewed: 409 SOCIAL_VIDEO_RENDER_CHANGED when a newer render replaced it, 409 when the video is not ready for review. Approving the same render again answers the video.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"renderAssetId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"renderAssetId"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialVideo"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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"
								}
							}
						}
					}
				}
			}
		},
		"/social/images": {
			"get": {
				"summary": "Images, newest first, with the practice's image setup",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"maxLength": 300
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"images": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SocialImage"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"null"
											]
										},
										"setup": {
											"$ref": "#/components/schemas/SocialImageSetup"
										}
									},
									"required": [
										"images",
										"nextCursor",
										"setup"
									],
									"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": "Start an image from a template",
				"tags": [
					"Social"
				],
				"description": "Photos must be ready photos from /social/media that the slot accepts (422 SOCIAL_IMAGE_INPUT_INVALID otherwise, the same answer for another practice's file). A photo needs the consent tick. Book now needs the booking page on (422). Sending the same clientRef again answers the existing image (200).",
				"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "smile_design"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"photo": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
													"photo"
												],
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {},
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "team_headshot"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"photo": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
													"photo"
												],
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {},
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "clinic_polish"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"photo": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
													"photo"
												],
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {},
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "seasonal_art"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {},
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {
													"occasion": {
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													}
												},
												"required": [
													"occasion"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "free_prompt"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {},
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {
													"prompt": {
														"type": "string",
														"minLength": 1,
														"maxLength": 1000
													}
												},
												"required": [
													"prompt"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "before_after"
											},
											"style": {
												"type": "string",
												"enum": [
													"side_by_side",
													"stacked",
													"diagonal",
													"slider",
													"carousel"
												]
											},
											"photos": {
												"type": "object",
												"properties": {
													"before": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"after": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
													"before",
													"after"
												],
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {
													"caption": {
														"type": "string",
														"maxLength": 120
													}
												},
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "review_card"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"background": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
											},
											"fields": {
												"type": "object",
												"properties": {
													"reviewerName": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"rating": {
														"type": "integer",
														"minimum": 1,
														"maximum": 5
													},
													"reviewDate": {
														"type": "string",
														"maxLength": 40
													},
													"reviewText": {
														"type": "string",
														"minLength": 1,
														"maxLength": 2000
													}
												},
												"required": [
													"reviewerName",
													"rating",
													"reviewText"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "team_spotlight"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"photo": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
													"photo"
												],
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {
													"name": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"role": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"funFact": {
														"type": "string",
														"maxLength": 200
													}
												},
												"required": [
													"name",
													"role"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "tips_carousel"
											},
											"style": {
												"type": "string",
												"enum": [
													"tips",
													"myth_fact",
													"faq"
												]
											},
											"photos": {
												"type": "object",
												"properties": {},
												"additionalProperties": false
											},
											"fields": {
												"type": "object",
												"properties": {
													"slides": {
														"minItems": 2,
														"maxItems": 10,
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"title": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 80
																},
																"body": {
																	"type": "string",
																	"maxLength": 300
																}
															},
															"required": [
																"title"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"slides"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "closure_notice"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"background": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
											},
											"fields": {
												"type": "object",
												"properties": {
													"headline": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"dates": {
														"type": "string",
														"minLength": 1,
														"maxLength": 80
													},
													"body": {
														"type": "string",
														"maxLength": 280
													}
												},
												"required": [
													"headline",
													"dates"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "opening_hours"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"background": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
											},
											"fields": {
												"type": "object",
												"properties": {
													"headline": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"hours": {
														"type": "string",
														"minLength": 1,
														"maxLength": 400
													},
													"body": {
														"type": "string",
														"maxLength": 280
													}
												},
												"required": [
													"headline",
													"hours"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "new_service"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"background": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
											},
											"fields": {
												"type": "object",
												"properties": {
													"headline": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"service": {
														"type": "string",
														"minLength": 1,
														"maxLength": 80
													},
													"body": {
														"type": "string",
														"maxLength": 280
													}
												},
												"required": [
													"headline",
													"service"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "book_now"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"background": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
											},
											"fields": {
												"type": "object",
												"properties": {
													"headline": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"body": {
														"type": "string",
														"maxLength": 280
													}
												},
												"required": [
													"headline"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									},
									{
										"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)$"
											},
											"expectedOrganizationId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
												"description": "Canonical lowercase UUID organization identifier"
											},
											"template": {
												"type": "string",
												"const": "offer"
											},
											"style": {
												"not": {}
											},
											"photos": {
												"type": "object",
												"properties": {
													"background": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
											},
											"fields": {
												"type": "object",
												"properties": {
													"headline": {
														"type": "string",
														"minLength": 1,
														"maxLength": 60
													},
													"offer": {
														"type": "string",
														"minLength": 1,
														"maxLength": 120
													},
													"terms": {
														"type": "string",
														"minLength": 1,
														"maxLength": 400
													},
													"validUntil": {
														"type": "string",
														"maxLength": 40
													}
												},
												"required": [
													"headline",
													"offer",
													"terms"
												],
												"additionalProperties": false
											},
											"consent": {
												"type": "boolean",
												"const": true
											}
										},
										"required": [
											"clientRef",
											"template",
											"photos",
											"fields"
										],
										"additionalProperties": false
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialImage"
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialImage"
								}
							}
						}
					},
					"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/images/setup": {
			"get": {
				"summary": "Whether the practice can use AI templates, and what its layouts draw",
				"tags": [
					"Social"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SocialImageSetup"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/images/{id}": {
			"get": {
				"summary": "One image with its outputs",
				"tags": [
					"Social"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialImage"
								}
							}
						}
					},
					"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 an image",
				"tags": [
					"Social"
				],
				"description": "Deletes the image and its outputs, except outputs a post still uses.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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"
								}
							}
						}
					}
				}
			}
		},
		"/social/images/{id}/approve": {
			"post": {
				"summary": "Approve the image's outputs so posts can use them",
				"tags": [
					"Social"
				],
				"description": "Idempotent: approving an approved image answers it. 409 unless the image is ready for review or approved.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialImage"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/social/images/{id}/retry": {
			"post": {
				"summary": "Try an image that needs attention again",
				"tags": [
					"Social"
				],
				"description": "Starts a new attempt. 409 unless the image needs attention.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/SocialImage"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/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"
											}
										},
										"rosteredFrom": {
											"type": "object",
											"propertyNames": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
												"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"
													}
												]
											}
										},
										"absences": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListInterval"
											}
										},
										"closures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListClosure"
											}
										},
										"zones": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListZone"
											}
										},
										"pmsRotaDays": {
											"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)$"
													},
													"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": [
													"practitionerId",
													"date"
												],
												"additionalProperties": false
											}
										},
										"pmsBlocks": {
											"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)$"
													},
													"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))$"
													},
													"label": {
														"type": [
															"string",
															"null"
														]
													},
													"kind": {
														"type": "string",
														"enum": [
															"match_review",
															"awaiting_patient"
														]
													}
												},
												"required": [
													"practitionerId",
													"startsAt",
													"endsAt",
													"label"
												],
												"additionalProperties": false
											}
										},
										"inactivePractitioners": {
											"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"
													}
												},
												"required": [
													"id",
													"displayName"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"date",
										"from",
										"to",
										"timezone",
										"locationId",
										"items",
										"working",
										"rosteredFrom",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/day-list/free": {
			"get": {
				"summary": "Find a time: free starts for a visit at one site",
				"tags": [
					"pms"
				],
				"description": "Free starts on the native diary, earliest first: the practitioners' rotas, the site's hours and closures, approved absences, their bookings and live holds at any site, the type's buffers and minimum notice, and — where the site books by chair, or a room is asked for — a room free for the whole visit. Without a type, `minutes` is required and there are no buffers. `match=all` keeps only the starts every named clinician is free for. One answer searches at most 14 days and returns at most 24 starts; `nextCursor` keeps searching until `to`. Needs appointment:create, or appointment:update with `excludeAppointmentId` (a move); a site whose diary its practice management system keeps answers 409 EXTERNAL_DIARY.",
				"parameters": [
					{
						"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": "appointmentTypeId",
						"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": "minutes",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 5,
							"maximum": 9007199254740991
						}
					},
					{
						"name": "practitionerIds",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36})*$"
						}
					},
					{
						"name": "match",
						"in": "query",
						"required": false,
						"schema": {
							"default": "any",
							"type": "string",
							"enum": [
								"any",
								"all"
							]
						}
					},
					{
						"name": "operatoryId",
						"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])))$"
						}
					},
					{
						"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": "partOfDay",
						"in": "query",
						"required": false,
						"schema": {
							"default": "any",
							"type": "string",
							"enum": [
								"any",
								"morning",
								"afternoon"
							]
						}
					},
					{
						"name": "excludeAppointmentId",
						"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": "cursor",
						"in": "query",
						"required": false,
						"schema": {
							"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": "string",
									"format": "date-time",
									"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
										"items": {
											"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))$"
													},
													"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)$"
													},
													"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"
															}
														]
													}
												},
												"required": [
													"startsAt",
													"practitionerId",
													"practitionerIds",
													"operatoryId"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/day-list/gaps": {
			"get": {
				"summary": "Fill gaps: a site's free time over a few days, and who could fill it",
				"tags": [
					"pms"
				],
				"description": "Each clinician's free stretches on the native diary on the staff booking rules — their rota at the site (or the site's hours when rostered nowhere), the site's hours and closures, approved absences, their bookings and live holds at any site; no minimum notice, nothing before now — split at zone edges. Each gap counts the distinct patients on the waiting list, recalls falling due, plan visits to book and missed visits not rebooked whose visit fits it (its length, buffers, zones and — where the site books by chair — a room free for the whole visit) and names the first three with a start and room; each list is read under its own permission. With a type or `minutes`, only the gaps that visit fits, each with every start; with `patientId`, also that patient's own entries. At most 14 days. Needs appointment:create; a site whose bookings its practice management system handles answers 409.",
				"parameters": [
					{
						"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": "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": "practitionerIds",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"pattern": "^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36})*$"
						}
					},
					{
						"name": "appointmentTypeId",
						"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": "minutes",
						"in": "query",
						"required": false,
						"schema": {
							"type": "integer",
							"minimum": 5,
							"maximum": 9007199254740991
						}
					},
					{
						"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": {
										"gaps": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListGap"
											}
										},
										"entries": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListGapCandidate"
											}
										}
									},
									"required": [
										"gaps"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/day-list/gaps/fill": {
			"get": {
				"summary": "Everyone who could fill one gap",
				"tags": [
					"pms"
				],
				"description": "The patients whose visit fits one clinician's free stretch, most urgent first (short notice, the waiting list by priority, recalls due, plan visits to book, missed visits), each once, page by page; the stretch is checked again. Same gate and lists as GET /day-list/gaps.",
				"parameters": [
					{
						"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": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "startsAt",
						"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": "endsAt",
						"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": "cursor",
						"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/DayListGapFit"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/day-list/facts": {
			"get": {
				"summary": "What the diary flags on each appointment of a slice",
				"tags": [
					"pms"
				],
				"description": "Per appointment GET /day-list answers for the same window and site (the same query, the same seven-day slice bound): the patient's worst alert kind, medical-history state, forms awaiting review, account, today's uncharged treatment, the visit's pending deposit, lab state and unsigned note, the next booking, plan visits to book, the recall due, the planned items, the unread count of the conversation Message opens, and — US only — eligibility, — GB only — the NHS exemption. Each fact is read under its own permission and country: one the reader may not see is absent, never 0. Same gate as the day list.",
				"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": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/DayListFactsItem"
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/day-list/{appointmentId}/preview": {
			"get": {
				"summary": "One visit's preview beside its diary card",
				"tags": [
					"pms"
				],
				"description": "What the diary's visit preview shows beyond the slice facts, in one read: each tooth's chart state, the BPE exams that can count (GB), the alerts in force, the medical-history forms and reviews that decide its state, the first open plan's total and what is paid toward it, the visit's received lab work, and the unread count and newest inbound message of the conversation Message opens. Each section is read under its record tab's permission: one the reader may not see is absent. A record section writes one clinical-read audit row. Same gate as the day list; 404 for an appointment that is not the practice's or whose patient was erased.",
				"parameters": [
					{
						"name": "appointmentId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"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)$"
										},
										"chart": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"tooth": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"state": {
														"type": "string",
														"enum": [
															"planned",
															"missing",
															"implant",
															"crown",
															"restored"
														]
													}
												},
												"required": [
													"tooth",
													"state"
												],
												"additionalProperties": false
											}
										},
										"perio": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"kind": {
														"type": "string"
													},
													"status": {
														"type": "string"
													},
													"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"
															}
														]
													},
													"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])))$"
													},
													"nextAssessmentMonths": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"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": {
																	"type": "boolean"
																}
															},
															"required": [
																"sextant",
																"code",
																"furcation"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"kind",
													"status",
													"voidedAt",
													"examDate",
													"nextAssessmentMonths",
													"bpeScores"
												],
												"additionalProperties": false
											}
										},
										"alerts": {
											"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": [
															"medical",
															"allergy",
															"medication",
															"infectious",
															"warning"
														]
													},
													"title": {
														"type": "string"
													},
													"severity": {
														"type": "string",
														"enum": [
															"info",
															"warning",
															"critical"
														]
													},
													"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"
															}
														]
													},
													"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",
													"kind",
													"title",
													"severity",
													"provisional",
													"startsOn",
													"endsOn",
													"archivedAt"
												],
												"additionalProperties": false
											}
										},
										"historyForms": {
											"type": "object",
											"properties": {
												"templates": {
													"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": [
																	"medical_history",
																	"consent",
																	"questionnaire",
																	"custom"
																]
															},
															"expiresAfterDays": {
																"anyOf": [
																	{
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	},
																	{
																		"type": "null"
																	}
																]
															}
														},
														"required": [
															"id",
															"kind",
															"expiresAfterDays"
														],
														"additionalProperties": false
													}
												},
												"submissions": {
													"type": "array",
													"items": {
														"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)$"
															},
															"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))$"
															},
															"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"
																	}
																]
															},
															"reviews": {
																"type": "array",
																"items": {
																	"type": "object",
																	"properties": {
																		"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"
																			]
																		},
																		"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)$"
																		}
																	},
																	"required": [
																		"reviewedAt",
																		"outcome",
																		"reviewerPractitionerId"
																	],
																	"additionalProperties": false
																}
															}
														},
														"required": [
															"templateId",
															"submittedAt",
															"expiresAt",
															"reviews"
														],
														"additionalProperties": false
													}
												}
											},
											"required": [
												"templates",
												"submissions"
											],
											"additionalProperties": false
										},
										"plan": {
											"anyOf": [
												{
													"type": "object",
													"properties": {
														"name": {
															"type": "string"
														},
														"currency": {
															"type": "string"
														},
														"totalCents": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"paidCents": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"name",
														"currency",
														"totalCents",
														"paidCents"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"labBack": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"item": {
														"type": [
															"string",
															"null"
														]
													},
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"siteKind": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"none",
																	"tooth",
																	"root",
																	"implant",
																	"supernumerary",
																	"area"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"labName": {
														"type": [
															"string",
															"null"
														]
													},
													"receivedOn": {
														"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": [
													"item",
													"tooth",
													"siteKind",
													"labName",
													"receivedOn"
												],
												"additionalProperties": false
											}
										},
										"labOpen": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"item": {
														"type": [
															"string",
															"null"
														]
													},
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"siteKind": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"none",
																	"tooth",
																	"root",
																	"implant",
																	"supernumerary",
																	"area"
																]
															},
															{
																"type": "null"
															}
														]
													},
													"labName": {
														"type": [
															"string",
															"null"
														]
													},
													"label": {
														"type": "string"
													},
													"tone": {
														"type": "string"
													},
													"needs": {
														"type": "boolean"
													}
												},
												"required": [
													"item",
													"tooth",
													"siteKind",
													"labName",
													"label",
													"tone",
													"needs"
												],
												"additionalProperties": false
											}
										},
										"unread": {
											"type": "object",
											"properties": {
												"count": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"text": {
													"type": [
														"string",
														"null"
													]
												}
											},
											"required": [
												"count",
												"text"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"appointmentId"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/book": {
			"post": {
				"summary": "Book an appointment from the diary",
				"tags": [
					"pms"
				],
				"description": "Books as POST /appointments does (requestId idempotency, overbook only for owners and managers; a site a practice management system covers answers 409 PMS_MANAGED_SITE) for a signed-in person, from either diary — the PMS one or the Calendar's. Linking a treatment-plan visit, recall or waiting-list request needs the PMS workspace too. Every clinician and the room are also checked against the availability engine — rota and the site's hours, closures, approved absences, bookings and holds at any site, and the type's buffers — and a time one of them is not free refuses with 409 OUTSIDE_AVAILABILITY naming them, unless the body says `outsideAvailability` or overbooks with a 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)$"
									},
									"practitionerIds": {
										"minItems": 1,
										"maxItems": 10,
										"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": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
										"type": [
											"string",
											"null"
										]
									},
									"patientInstruction": {
										"type": [
											"string",
											"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)$"
									},
									"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)$"
									},
									"waitlistRequestId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"waitlistExpectedVersion": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"outsideAvailability": {
										"type": "boolean",
										"const": true
									}
								},
								"required": [
									"requestId",
									"patientId",
									"startsAt",
									"endsAt"
								]
							}
						}
					}
				},
				"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, with the patient's previous-system chart number (`legacyChartNumber`, null when none) and the number that system carried from the one before it (`earlierChartNumber`, null when none). 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|calls|visit)(,(timeline|journeys|touches|pms|deposits|referral|marketing|calls|visit))*$"
						}
					}
				],
				"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
											"type": [
												"string",
												"null"
											]
										},
										"firstName": {
											"type": "string"
										},
										"lastName": {
											"type": "string"
										},
										"preferredName": {
											"type": [
												"string",
												"null"
											]
										},
										"chartNumber": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"stsOpposition": {
											"type": "boolean"
										},
										"email": {
											"type": [
												"string",
												"null"
											]
										},
										"phoneMobile": {
											"type": [
												"string",
												"null"
											]
										},
										"phoneOther": {
											"type": [
												"string",
												"null"
											]
										},
										"addressLine1": {
											"type": [
												"string",
												"null"
											]
										},
										"addressLine2": {
											"type": [
												"string",
												"null"
											]
										},
										"city": {
											"type": [
												"string",
												"null"
											]
										},
										"province": {
											"type": [
												"string",
												"null"
											]
										},
										"postalCode": {
											"type": [
												"string",
												"null"
											]
										},
										"country": {
											"type": [
												"string",
												"null"
											]
										},
										"language": {
											"type": [
												"string",
												"null"
											]
										},
										"preferredContactMethod": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"phone",
														"sms",
														"email",
														"whatsapp"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"preferredContactTime": {
											"type": [
												"string",
												"null"
											]
										},
										"smsOptOut": {
											"type": "boolean"
										},
										"emailOptOut": {
											"type": "boolean"
										},
										"whatsappOptOut": {
											"type": "boolean"
										},
										"phoneOptOut": {
											"type": "boolean"
										},
										"consentSource": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"note": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"occupation": {
											"type": [
												"string",
												"null"
											]
										},
										"gpContactId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"emergencyContactName": {
											"type": [
												"string",
												"null"
											]
										},
										"emergencyContactRelationship": {
											"type": [
												"string",
												"null"
											]
										},
										"emergencyContactPhone": {
											"type": [
												"string",
												"null"
											]
										},
										"practitionerGenderPreference": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"no_preference",
														"female",
														"male",
														"declined"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"customFields": {},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"pinnedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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))$"
										},
										"tags": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Tag"
											}
										},
										"stickyNotes": {
											"type": "object",
											"properties": {
												"items": {
													"type": "array",
													"items": {
														"$ref": "#/components/schemas/PatientStickyNote"
													}
												},
												"dismissedSeen": {
													"anyOf": [
														{
															"type": "array",
															"items": {
																"type": "string"
															}
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"items",
												"dismissedSeen"
											],
											"additionalProperties": false
										},
										"leadSourceLocked": {
											"type": "boolean"
										},
										"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
												},
												"counts": {
													"type": "object",
													"properties": {
														"calls": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"messages": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"notes": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														},
														"changes": {
															"type": "integer",
															"minimum": 0,
															"maximum": 9007199254740991
														}
													},
													"required": [
														"calls",
														"messages",
														"notes",
														"changes"
													],
													"additionalProperties": false
												}
											},
											"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"
											}
										},
										"callInsight": {
											"$ref": "#/components/schemas/PatientCallInsight"
										},
										"whatsappCall": {
											"anyOf": [
												{
													"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)$"
														},
														"number": {
															"type": "string"
														},
														"until": {
															"anyOf": [
																{
																	"type": "string",
																	"format": "date-time",
																	"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": [
														"endpointId",
														"number",
														"until"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"nextVisit": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/PatientNextVisit"
												},
												{
													"type": "null"
												}
											]
										},
										"lastVisit": {
											"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)$"
														},
														"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))$"
														},
														"typeName": {
															"type": [
																"string",
																"null"
															]
														}
													},
													"required": [
														"appointmentId",
														"startsAt",
														"typeName"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										},
										"attendance": {
											"type": "object",
											"properties": {
												"noShows": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"lateCancellations": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"lateCancellationsUnknownBy": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"required": [
												"noShows",
												"lateCancellations",
												"lateCancellationsUnknownBy"
											],
											"additionalProperties": false
										},
										"legacyChartNumber": {
											"type": [
												"string",
												"null"
											]
										},
										"earlierChartNumber": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"locationId",
										"status",
										"title",
										"firstName",
										"lastName",
										"preferredName",
										"chartNumber",
										"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",
										"occupation",
										"gpContactId",
										"emergencyContactName",
										"emergencyContactRelationship",
										"emergencyContactPhone",
										"practitionerGenderPreference",
										"customFields",
										"createdById",
										"createdByName",
										"createdBySource",
										"pinnedAt",
										"archivedAt",
										"createdAt",
										"updatedAt",
										"tags",
										"leadSourceLocked",
										"legacyChartNumber"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/patient-record/{id}/correspondence-counts": {
			"get": {
				"summary": "How many of a patient's correspondence items need action or are unread",
				"tags": [
					"pms"
				],
				"description": "One count over every kind the Correspondence tab lists that the member may read, each item once: a conversation that is open with an inbound last message or has unread messages (closed ones included), an unsent letter, a lab case that is created or received, sent and past its due date at its site, flagged by a connected lab or carrying unread lab messages, a draft or received referral, a draft prescription, and an upload kept for the patient or a record merged into them. A kind the member cannot read is left out; with none readable `items` is null. Writes no clinical-read audit row: it carries no clinical content.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/patient-record/{id}/sections": {
			"get": {
				"summary": "Several of a patient record's reads in one request",
				"tags": [
					"pms"
				],
				"description": "The record's panels' reads answered together in one transaction (plan 2026-11-03): each section named in `names` (crm/record-sections lists them, with the endpoint each one is) is that endpoint's own 200 answer, under the same permission and country gates, masking and clinical-read audit rows — or null when the member may not read it or it does not apply. A request naming only sections the member may not read still answers 404 PATIENT_ERASED for an erased 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": "names",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 2000,
							"pattern": "^[A-Za-z]+(,[A-Za-z]+)*$"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"propertyNames": {
										"type": "string"
									},
									"additionalProperties": {}
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patient-record/{id}/chart-history/pdf": {
			"get": {
				"summary": "Download the chart's history (PDF)",
				"tags": [
					"pms"
				],
				"description": "Every treatment, finding, clinical note, periodontal exam and prescription of the patient, newest first, under the practice's letterhead. The record is read whole on the server in one audited transaction that ends on the patient's erasure fence (404 PATIENT_ERASED). Needs `patient:export`, the patient export's grant, and the read grants of what it prints: a role without them is refused (403). Private and `no-store`; 503 DOCUMENT_RENDER_BUSY when the renderer asks to wait.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": "variant",
						"in": "query",
						"required": false,
						"schema": {
							"default": "standard",
							"type": "string",
							"enum": [
								"standard",
								"concise",
								"concise_notes"
							]
						}
					},
					{
						"name": "includeUncompleted",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "excludeBaseChart",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/pdf": {
								"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"
								}
							}
						}
					},
					"404": {
						"description": "Not Found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"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",
								"all"
							]
						}
					},
					{
						"name": "channel",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"whatsapp",
								"sms",
								"email",
								"webchat",
								"messenger",
								"instagram",
								"telegram",
								"tiktok",
								"facebook_comments",
								"instagram_comments",
								"patient_app"
							]
						}
					},
					{
						"name": "assignee",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						}
					},
					{
						"name": "unread",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "hidden",
						"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": {
											"type": [
												"string",
												"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, and whether the other workspace is hidden from them, freely; setting another member's needs member:update. Hiding is a display preference: settings and API access stay on the role. An omitted hideOtherWorkspace is left unchanged. 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"
										]
									},
									"hideOtherWorkspace": {
										"type": "boolean"
									}
								},
								"required": [
									"workspace"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"workspace": {
											"type": "string",
											"enum": [
												"crm",
												"pms"
											]
										},
										"hideOtherWorkspace": {
											"type": "boolean"
										}
									},
									"required": [
										"userId",
										"workspace",
										"hideOtherWorkspace"
									],
									"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}/extension": {
			"put": {
				"summary": "Set a member's keypad extension",
				"tags": [
					"settings"
				],
				"description": "member:update. Three digits (100–999), unique per practice; null assigns the lowest free extension, an empty string clears it. 409 EXTENSION_TAKEN when another member already has it.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"extension": {
										"anyOf": [
											{
												"anyOf": [
													{
														"type": "string",
														"pattern": "^[1-9][0-9]{2}$"
													},
													{
														"type": "null"
													}
												]
											},
											{
												"type": "string",
												"const": ""
											}
										]
									}
								},
								"required": [
									"extension"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"extension": {
											"type": [
												"string",
												"null"
											]
										}
									},
									"required": [
										"userId",
										"extension"
									],
									"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}/calling-role": {
			"put": {
				"summary": "Set a member's team-calling role",
				"tags": [
					"settings"
				],
				"description": "member:update. Opener, closer or none (null). Only a member whose role may place calls (dialer:use) can hold one (409 CALLING_ROLE_UNAVAILABLE); a role change clears it. Setting one turns off the member's new-lead window. Audited. Idempotent. 404 for a user who is not a member of the practice.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"callingRole": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"opener",
													"closer"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"callingRole"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"callingRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"opener",
														"closer"
													]
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"userId",
										"callingRole"
									],
									"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}/new-lead-window": {
			"put": {
				"summary": "Turn a member's desktop new-lead window on or off",
				"tags": [
					"settings"
				],
				"description": "member:update (owners and managers), with no exception for a member's own. Only a member whose role works every task and adds notes (activity:create), and who holds no team-calling role, can have it on (409 NEW_LEAD_WINDOW_UNAVAILABLE); a calling role or a role change that ends that turns it off. Audited. Idempotent. 404 for a user who is not a member of the practice.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"enabled": {
										"type": "boolean"
									}
								},
								"required": [
									"enabled"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"newLeadWindow": {
											"type": "boolean"
										}
									},
									"required": [
										"userId",
										"newLeadWindow"
									],
									"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}/goals": {
			"put": {
				"summary": "Set a member's targets",
				"tags": [
					"goals"
				],
				"description": "member:update. A daily booking goal and, for a treatment coordinator, monthly closes and accepted value; null switches one off, and every one is off by default. Applies from today (practice-local): earlier days keep the target they were judged by. Audited. Idempotent. 404 for a user who is not a member of the practice.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/MemberGoals"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"userId": {
											"type": "string"
										},
										"goals": {
											"$ref": "#/components/schemas/MemberGoals"
										}
									},
									"required": [
										"userId",
										"goals"
									],
									"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-calling/status": {
			"put": {
				"summary": "Start, stop, pause or resume my team calling",
				"tags": [
					"today"
				],
				"description": "The signed-in member's own calling status, never anyone else's. Needs dialer:use and a team-calling role (else 409 CALLING_ROLE_UNAVAILABLE). Version-fenced: `expectedVersion` must be the status's current version, else 409 CALLING_STATUS_STALE with the current status (callingStatusState) in `details` and nothing written — a delayed Back never undoes a later Clock out. The same status at the current version answers 200 unchanged. A change is audited and announced to the practice's Today (`calling.status`). Clock in and Clock out on the rota set and clear it too.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"status": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"calling",
													"break"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"expectedVersion": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									}
								},
								"required": [
									"status",
									"expectedVersion"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"calling",
														"break"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"since": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"status",
										"since",
										"version"
									],
									"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/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/team/members/{userId}/avatar": {
			"post": {
				"summary": "Set a colleague's profile photo",
				"tags": [
					"settings"
				],
				"description": "member:update, from a signed-in person at a browser (never an API key, OAuth connection or the assistant). multipart/form-data with one `file` field: a JPEG, PNG, WebP or GIF of at most 5 MB. Only an owner sets an owner's photo. Your own photo is set at /user/avatar (409 SELF_AVATAR here). 409 MEMBER_IN_OTHER_ORGANIZATION when the person also belongs to another organisation — only they change their photo; 409 ARTIFACT_CONFLICT when it changed meanwhile. 404 for a user who is not a member of the practice. Audited.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"multipart/form-data": {
							"schema": {
								"type": "object",
								"properties": {
									"file": {
										"type": "string",
										"description": "The image's bytes"
									}
								},
								"required": [
									"file"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"image": {
											"type": "string"
										}
									},
									"required": [
										"image"
									],
									"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 a colleague's profile photo",
				"tags": [
					"settings"
				],
				"description": "Gated like setting it (setMemberAvatar), with the same 403, 404 and 409 answers. The person's generated avatar shows again. Audited.",
				"parameters": [
					{
						"name": "userId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"success": {
											"type": "boolean",
											"const": true
										}
									},
									"required": [
										"success"
									],
									"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/website-photos": {
			"post": {
				"summary": "Find team members' photos on the practice website's team page",
				"tags": [
					"settings"
				],
				"description": "member:update, in a practice. Reads the team page through the safe egress fetcher and pairs its photos with the members whose photo the caller may set (not themselves, nobody who also belongs to another organisation, and owners only for an owner). `unreadable` means part of the AI's answer could not be read (the pairs it could read are still returned); `none` means it read the whole page and matched no one. Nothing fetched is stored; each photo is cropped with /settings/practitioners/website-photos/crop. 422 when the page cannot be opened or is not HTML; 503 when website fetching or the AI is unavailable.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"url": {
										"type": "string",
										"maxLength": 2048,
										"format": "uri"
									}
								},
								"required": [
									"url"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string",
											"enum": [
												"matched",
												"none",
												"unreadable"
											]
										},
										"pairs": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"userId": {
														"type": "string"
													},
													"photoUrl": {
														"type": "string"
													}
												},
												"required": [
													"userId",
													"photoUrl"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"status",
										"pairs"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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/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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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
									},
									"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"
											}
										]
									},
									"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
										},
										"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"appointmentTypeId",
										"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
									},
									"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"
											}
										]
									},
									"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
										},
										"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"appointmentTypeId",
										"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
										},
										"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"appointmentTypeId",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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
										},
										"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"appointmentTypeId",
										"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": {},
									"fields": {
										"anyOf": [
											{
												"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
															}
														},
														"showIf": {
															"type": "object",
															"properties": {
																"field": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 64,
																	"pattern": "^[a-z0-9_]+$"
																},
																"equals": {
																	"anyOf": [
																		{
																			"type": "boolean"
																		},
																		{
																			"type": "number"
																		},
																		{
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 200
																		}
																	]
																}
															},
															"required": [
																"field",
																"equals"
															]
														}
													},
													"required": [
														"id",
														"label",
														"type"
													]
												}
											},
											{
												"type": "null"
											}
										]
									},
									"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": {
											"type": [
												"string",
												"null"
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"type": [
												"string",
												"null"
											]
										},
										"body": {},
										"fields": {},
										"version": {
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fields",
										"version",
										"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": {},
									"fields": {
										"anyOf": [
											{
												"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
															}
														},
														"showIf": {
															"type": "object",
															"properties": {
																"field": {
																	"type": "string",
																	"minLength": 1,
																	"maxLength": 64,
																	"pattern": "^[a-z0-9_]+$"
																},
																"equals": {
																	"anyOf": [
																		{
																			"type": "boolean"
																		},
																		{
																			"type": "number"
																		},
																		{
																			"type": "string",
																			"minLength": 1,
																			"maxLength": 200
																		}
																	]
																}
															},
															"required": [
																"field",
																"equals"
															]
														}
													},
													"required": [
														"id",
														"label",
														"type"
													]
												}
											},
											{
												"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"
										},
										"userId": {
											"type": [
												"string",
												"null"
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"type": [
												"string",
												"null"
											]
										},
										"body": {},
										"fields": {},
										"version": {
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fields",
										"version",
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"type": [
												"string",
												"null"
											]
										},
										"body": {},
										"fields": {},
										"version": {
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fields",
										"version",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
											"type": [
												"string",
												"null"
											]
										},
										"name": {
											"type": "string"
										},
										"category": {
											"type": [
												"string",
												"null"
											]
										},
										"body": {},
										"fields": {},
										"version": {
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fields",
										"version",
										"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"
									},
									"countsAsNewPatient": {
										"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",
											"large_square",
											"tiny_square",
											"triangle",
											"text",
											"arrow_mesial",
											"arrow_distal",
											"rotate_mesial",
											"rotate_distal",
											"arrow_occlusal",
											"arrow_down"
										]
									},
									"chartColour": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-f]{6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"chartText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 12
											},
											{
												"type": "null"
											}
										]
									},
									"multiTooth": {
										"type": "boolean"
									},
									"fillsRoot": {
										"type": "boolean"
									},
									"resetsTooth": {
										"type": "boolean"
									},
									"ponticProcedureCodeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"existingFindingCodeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatsFindingCodeIds": {
										"maxItems": 64,
										"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)$"
										}
									},
									"surfaceFamily": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"surfaceCount": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 5
											},
											{
												"type": "null"
											}
										]
									},
									"noteTemplateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/TreatmentCustomField"
										}
									},
									"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": {
											"type": [
												"string",
												"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"
										},
										"countsAsNewPatient": {
											"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",
												"large_square",
												"tiny_square",
												"triangle",
												"text",
												"arrow_mesial",
												"arrow_distal",
												"rotate_mesial",
												"rotate_distal",
												"arrow_occlusal",
												"arrow_down"
											]
										},
										"chartColour": {
											"type": [
												"string",
												"null"
											]
										},
										"chartText": {
											"type": [
												"string",
												"null"
											]
										},
										"multiTooth": {
											"type": "boolean"
										},
										"fillsRoot": {
											"default": false,
											"type": "boolean"
										},
										"resetsTooth": {
											"default": false,
											"type": "boolean"
										},
										"ponticProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeIsAct": {
											"type": "boolean"
										},
										"noteTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
											"default": [],
											"maxItems": 100,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentCustomField"
											}
										},
										"treatsFindingCodeIds": {
											"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)$"
											}
										},
										"surfaceFamily": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaceCount": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"countsAsNewPatient",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"multiTooth",
										"fillsRoot",
										"resetsTooth",
										"ponticProcedureCodeId",
										"existingFindingCodeId",
										"existingFindingCodeIsAct",
										"noteTemplateId",
										"customFields",
										"treatsFindingCodeIds",
										"surfaceFamily",
										"surfaceCount",
										"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"
									},
									"countsAsNewPatient": {
										"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",
											"large_square",
											"tiny_square",
											"triangle",
											"text",
											"arrow_mesial",
											"arrow_distal",
											"rotate_mesial",
											"rotate_distal",
											"arrow_occlusal",
											"arrow_down"
										]
									},
									"chartColour": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^#[0-9a-f]{6}$"
											},
											{
												"type": "null"
											}
										]
									},
									"chartText": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 12
											},
											{
												"type": "null"
											}
										]
									},
									"multiTooth": {
										"type": "boolean"
									},
									"fillsRoot": {
										"type": "boolean"
									},
									"resetsTooth": {
										"type": "boolean"
									},
									"ponticProcedureCodeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"existingFindingCodeId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"treatsFindingCodeIds": {
										"maxItems": 64,
										"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)$"
										}
									},
									"surfaceFamily": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1
											},
											{
												"type": "null"
											}
										]
									},
									"surfaceCount": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 5
											},
											{
												"type": "null"
											}
										]
									},
									"noteTemplateId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/TreatmentCustomField"
										}
									},
									"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": {
											"type": [
												"string",
												"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"
										},
										"countsAsNewPatient": {
											"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",
												"large_square",
												"tiny_square",
												"triangle",
												"text",
												"arrow_mesial",
												"arrow_distal",
												"rotate_mesial",
												"rotate_distal",
												"arrow_occlusal",
												"arrow_down"
											]
										},
										"chartColour": {
											"type": [
												"string",
												"null"
											]
										},
										"chartText": {
											"type": [
												"string",
												"null"
											]
										},
										"multiTooth": {
											"type": "boolean"
										},
										"fillsRoot": {
											"default": false,
											"type": "boolean"
										},
										"resetsTooth": {
											"default": false,
											"type": "boolean"
										},
										"ponticProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeIsAct": {
											"type": "boolean"
										},
										"noteTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
											"default": [],
											"maxItems": 100,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentCustomField"
											}
										},
										"treatsFindingCodeIds": {
											"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)$"
											}
										},
										"surfaceFamily": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaceCount": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"countsAsNewPatient",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"multiTooth",
										"fillsRoot",
										"resetsTooth",
										"ponticProcedureCodeId",
										"existingFindingCodeId",
										"existingFindingCodeIsAct",
										"noteTemplateId",
										"customFields",
										"treatsFindingCodeIds",
										"surfaceFamily",
										"surfaceCount",
										"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": {
											"type": [
												"string",
												"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"
										},
										"countsAsNewPatient": {
											"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",
												"large_square",
												"tiny_square",
												"triangle",
												"text",
												"arrow_mesial",
												"arrow_distal",
												"rotate_mesial",
												"rotate_distal",
												"arrow_occlusal",
												"arrow_down"
											]
										},
										"chartColour": {
											"type": [
												"string",
												"null"
											]
										},
										"chartText": {
											"type": [
												"string",
												"null"
											]
										},
										"multiTooth": {
											"type": "boolean"
										},
										"fillsRoot": {
											"default": false,
											"type": "boolean"
										},
										"resetsTooth": {
											"default": false,
											"type": "boolean"
										},
										"ponticProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeIsAct": {
											"type": "boolean"
										},
										"noteTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
											"default": [],
											"maxItems": 100,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentCustomField"
											}
										},
										"treatsFindingCodeIds": {
											"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)$"
											}
										},
										"surfaceFamily": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaceCount": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"countsAsNewPatient",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"multiTooth",
										"fillsRoot",
										"resetsTooth",
										"ponticProcedureCodeId",
										"existingFindingCodeId",
										"existingFindingCodeIsAct",
										"noteTemplateId",
										"customFields",
										"treatsFindingCodeIds",
										"surfaceFamily",
										"surfaceCount",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
											"type": [
												"string",
												"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"
										},
										"countsAsNewPatient": {
											"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",
												"large_square",
												"tiny_square",
												"triangle",
												"text",
												"arrow_mesial",
												"arrow_distal",
												"rotate_mesial",
												"rotate_distal",
												"arrow_occlusal",
												"arrow_down"
											]
										},
										"chartColour": {
											"type": [
												"string",
												"null"
											]
										},
										"chartText": {
											"type": [
												"string",
												"null"
											]
										},
										"multiTooth": {
											"type": "boolean"
										},
										"fillsRoot": {
											"default": false,
											"type": "boolean"
										},
										"resetsTooth": {
											"default": false,
											"type": "boolean"
										},
										"ponticProcedureCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"existingFindingCodeIsAct": {
											"type": "boolean"
										},
										"noteTemplateId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": {
											"default": [],
											"maxItems": 100,
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/TreatmentCustomField"
											}
										},
										"treatsFindingCodeIds": {
											"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)$"
											}
										},
										"surfaceFamily": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaceCount": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"seed",
												"practice"
											]
										},
										"active": {
											"type": "boolean"
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"countsAsNewPatient",
										"nhsBand",
										"taxTreatment",
										"billToInsurance",
										"chartShape",
										"chartColour",
										"chartText",
										"multiTooth",
										"fillsRoot",
										"resetsTooth",
										"ponticProcedureCodeId",
										"existingFindingCodeId",
										"existingFindingCodeIsAct",
										"noteTemplateId",
										"customFields",
										"treatsFindingCodeIds",
										"surfaceFamily",
										"surfaceCount",
										"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
									}
								},
								"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"
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"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
									}
								}
							}
						}
					}
				},
				"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"
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"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"
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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"
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"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 and may then be set again for its own date. A revision with a site is that site's price, which replaces the practice-wide one there (scope before tier).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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])))$"
									},
									"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": [
									"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"
												}
											]
										},
										"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"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"locationId",
										"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"
												}
											]
										},
										"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"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"locationId",
										"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"
											}
										]
									},
									"discountPercent": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 100
											},
											{
												"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"membershipBand": {
											"type": [
												"string",
												"null"
											]
										},
										"discountPercent": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"discountPercent",
										"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"
											}
										]
									},
									"discountPercent": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 1,
												"maximum": 100
											},
											{
												"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"membershipBand": {
											"type": [
												"string",
												"null"
											]
										},
										"discountPercent": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"discountPercent",
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"membershipBand": {
											"type": [
												"string",
												"null"
											]
										},
										"discountPercent": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"discountPercent",
										"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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"membershipBand": {
											"type": [
												"string",
												"null"
											]
										},
										"discountPercent": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"position": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"active": {
											"type": "boolean"
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"discountPercent",
										"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"
									},
									"traceable": {
										"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"
										},
										"traceable": {
											"type": [
												"boolean",
												"null"
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"traceable",
										"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"
									},
									"traceable": {
										"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"
										},
										"traceable": {
											"type": [
												"boolean",
												"null"
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"traceable",
										"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"
										},
										"traceable": {
											"type": [
												"boolean",
												"null"
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"traceable",
										"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/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"
										},
										"traceable": {
											"type": [
												"boolean",
												"null"
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"traceable",
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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"
				],
				"description": "Sets the fee and the tax treatment together (null inherits). `expected` is the pair the editor showed, or null for none: a first override is inserted only if there is still none, and a change applies only to that pair. Otherwise 409 PRICE_OVERRIDE_STALE with `details.current`, the pair now (null: none).",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
											}
										]
									},
									"expected": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/PriceOverridePair"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"feeCents",
									"taxTreatment",
									"expected"
								]
							}
						}
					}
				},
				"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"
											]
										},
										"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])))$"
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"effectiveFrom",
										"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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Remove a price list's override for one code",
				"tags": [
					"settings"
				],
				"description": "The list inherits both the schedule's fee and the code's tax treatment again. Only the pair the editor showed is removed: otherwise 409 PRICE_OVERRIDE_STALE with `details.current`.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": {
									"expected": {
										"$ref": "#/components/schemas/PriceOverridePair"
									}
								},
								"required": [
									"expected"
								]
							}
						}
					}
				},
				"responses": {
					"204": {
						"description": "No Content",
						"content": {
							"application/json": {
								"schema": {
									"type": "null"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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-preview": {
			"get": {
				"summary": "Check what a treatment would be priced at",
				"tags": [
					"settings"
				],
				"description": "Runs the same pricing charting uses, read-only: the revision that won (site before tier, then the latest date), the list's override, the fee and the tax treatment with its rate at the site. A treatment that cannot be priced answers `refused` with the reason charting would give.",
				"parameters": [
					{
						"name": "priceListId",
						"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": "procedureCodeId",
						"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": "unitCount",
						"in": "query",
						"required": false,
						"schema": {
							"default": 1,
							"type": "integer",
							"minimum": 1,
							"maximum": 32767
						}
					},
					{
						"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": {
									"oneOf": [
										{
											"type": "object",
											"properties": {
												"outcome": {
													"type": "string",
													"const": "priced"
												},
												"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])))$"
												},
												"feeCents": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												"currency": {
													"type": "string",
													"enum": [
														"EUR",
														"GBP",
														"USD"
													]
												},
												"revision": {
													"type": "object",
													"properties": {
														"id": {
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
																}
															]
														},
														"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
														}
													},
													"required": [
														"id",
														"locationId",
														"unitCountFrom",
														"effectiveFrom",
														"feeCents"
													],
													"additionalProperties": false
												},
												"override": {
													"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)$"
																},
																"feeCents": {
																	"anyOf": [
																		{
																			"type": "integer",
																			"minimum": -9007199254740991,
																			"maximum": 9007199254740991
																		},
																		{
																			"type": "null"
																		}
																	]
																},
																"taxTreatment": {
																	"anyOf": [
																		{
																			"type": "string",
																			"enum": [
																				"exempt",
																				"standard",
																				"zero",
																				"none"
																			]
																		},
																		{
																			"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])))$"
																}
															},
															"required": [
																"id",
																"feeCents",
																"taxTreatment",
																"effectiveFrom"
															],
															"additionalProperties": false
														},
														{
															"type": "null"
														}
													]
												},
												"taxTreatment": {
													"type": "string",
													"enum": [
														"exempt",
														"standard",
														"zero",
														"none"
													]
												},
												"taxRateBp": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												}
											},
											"required": [
												"outcome",
												"onDate",
												"feeCents",
												"currency",
												"revision",
												"override",
												"taxTreatment",
												"taxRateBp"
											],
											"additionalProperties": false
										},
										{
											"type": "object",
											"properties": {
												"outcome": {
													"type": "string",
													"const": "refused"
												},
												"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])))$"
												},
												"code": {
													"type": "string",
													"enum": [
														"FEE_MISSING",
														"PRICE_LIST_ARCHIVED",
														"NHS_SITE_UNAVAILABLE"
													]
												},
												"message": {
													"type": "string"
												}
											},
											"required": [
												"outcome",
												"onDate",
												"code",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/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"
									},
									"minAgeYears": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 130
											},
											{
												"type": "null"
											}
										]
									},
									"maxAgeYears": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 130
											},
											{
												"type": "null"
											}
										]
									}
								},
								"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": {
											"type": [
												"string",
												"null"
											]
										},
										"expiresAfterDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"requiresSignature": {
											"type": "boolean"
										},
										"requiresReview": {
											"type": "boolean"
										},
										"minAgeYears": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"maxAgeYears": {
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"minAgeYears",
										"maxAgeYears",
										"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"
									},
									"minAgeYears": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 130
											},
											{
												"type": "null"
											}
										]
									},
									"maxAgeYears": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 130
											},
											{
												"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"
										},
										"key": {
											"type": "string"
										},
										"version": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"kind": {
											"type": "string",
											"enum": [
												"medical_history",
												"consent",
												"questionnaire",
												"custom"
											]
										},
										"name": {
											"type": "string"
										},
										"schema": {},
										"attestationText": {
											"type": [
												"string",
												"null"
											]
										},
										"expiresAfterDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"requiresSignature": {
											"type": "boolean"
										},
										"requiresReview": {
											"type": "boolean"
										},
										"minAgeYears": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"maxAgeYears": {
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"minAgeYears",
										"maxAgeYears",
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"expiresAfterDays": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"requiresSignature": {
											"type": "boolean"
										},
										"requiresReview": {
											"type": "boolean"
										},
										"minAgeYears": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"maxAgeYears": {
											"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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"minAgeYears",
										"maxAgeYears",
										"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/alert-list": {
			"get": {
				"summary": "The practice's changes to the alert list",
				"tags": [
					"settings"
				],
				"description": "Live rows only; the client merges them over Smileline's list (core effectiveAlertList). medicalHistory:record or clinicalCatalog:read, so whoever raises alerts reads the practice's defaults.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"rows": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AlertListRow"
											}
										}
									},
									"required": [
										"rows"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Add the practice's own alert-list entry",
				"tags": [
					"settings"
				],
				"description": "clinicalCatalog:manage. Name, short name, kind, group and severity are required (400).",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"word": {
										"type": "string",
										"minLength": 1,
										"maxLength": 24
									},
									"todo": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"kind": {
										"type": "string",
										"enum": [
											"medical",
											"allergy",
											"medication",
											"infectious",
											"warning"
										]
									},
									"group": {
										"type": "string",
										"enum": [
											"allergy",
											"bleeding",
											"bone",
											"heart",
											"radiotherapy",
											"immunity",
											"emergency",
											"bbv",
											"pregnancy",
											"care"
										]
									},
									"severity": {
										"type": "string",
										"enum": [
											"info",
											"warning",
											"critical"
										]
									},
									"popup": {
										"type": [
											"boolean",
											"null"
										]
									},
									"fact": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"condition",
													"medication",
													"allergy",
													"none"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name",
									"word",
									"kind",
									"group",
									"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)$"
										},
										"catalogueKey": {
											"type": [
												"string",
												"null"
											]
										},
										"name": {
											"type": [
												"string",
												"null"
											]
										},
										"word": {
											"type": [
												"string",
												"null"
											]
										},
										"todo": {
											"type": [
												"string",
												"null"
											]
										},
										"kind": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"medical",
														"allergy",
														"medication",
														"infectious",
														"warning"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"group": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"allergy",
														"bleeding",
														"bone",
														"heart",
														"radiotherapy",
														"immunity",
														"emergency",
														"bbv",
														"pregnancy",
														"care"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"info",
														"warning",
														"critical"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"popup": {
											"type": [
												"boolean",
												"null"
											]
										},
										"fact": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"condition",
														"medication",
														"allergy",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"hidden": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"catalogueKey",
										"name",
										"word",
										"todo",
										"kind",
										"group",
										"severity",
										"popup",
										"fact",
										"hidden"
									],
									"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/clinical/alert-list/{key}": {
			"put": {
				"summary": "Change a Smileline alert-list entry for the practice",
				"tags": [
					"settings"
				],
				"description": "Replaces the practice's override of one Smileline entry whole (clinicalCatalog:manage); a field left out inherits Smileline's. 404 ALERT_LIST_KEY_UNKNOWN for a key Smileline's list does not have.",
				"parameters": [
					{
						"name": "key",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 64
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 120
											},
											{
												"type": "null"
											}
										]
									},
									"word": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 24
											},
											{
												"type": "null"
											}
										]
									},
									"todo": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"kind": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"medical",
													"allergy",
													"medication",
													"infectious",
													"warning"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"group": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"allergy",
													"bleeding",
													"bone",
													"heart",
													"radiotherapy",
													"immunity",
													"emergency",
													"bbv",
													"pregnancy",
													"care"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"severity": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"info",
													"warning",
													"critical"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"popup": {
										"type": [
											"boolean",
											"null"
										]
									},
									"fact": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"condition",
													"medication",
													"allergy",
													"none"
												]
											},
											{
												"type": "null"
											}
										]
									},
									"hidden": {
										"type": [
											"boolean",
											"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)$"
										},
										"catalogueKey": {
											"type": [
												"string",
												"null"
											]
										},
										"name": {
											"type": [
												"string",
												"null"
											]
										},
										"word": {
											"type": [
												"string",
												"null"
											]
										},
										"todo": {
											"type": [
												"string",
												"null"
											]
										},
										"kind": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"medical",
														"allergy",
														"medication",
														"infectious",
														"warning"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"group": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"allergy",
														"bleeding",
														"bone",
														"heart",
														"radiotherapy",
														"immunity",
														"emergency",
														"bbv",
														"pregnancy",
														"care"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"info",
														"warning",
														"critical"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"popup": {
											"type": [
												"boolean",
												"null"
											]
										},
										"fact": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"condition",
														"medication",
														"allergy",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"hidden": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"catalogueKey",
										"name",
										"word",
										"todo",
										"kind",
										"group",
										"severity",
										"popup",
										"fact",
										"hidden"
									],
									"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/alert-list/own/{id}": {
			"put": {
				"summary": "Change the practice's own alert-list entry",
				"tags": [
					"settings"
				],
				"description": "Replaces one live own entry whole (clinicalCatalog:manage); the same fields as adding it. 404 for a row that is unknown, archived or an override of Smileline's.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"word": {
										"type": "string",
										"minLength": 1,
										"maxLength": 24
									},
									"todo": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"kind": {
										"type": "string",
										"enum": [
											"medical",
											"allergy",
											"medication",
											"infectious",
											"warning"
										]
									},
									"group": {
										"type": "string",
										"enum": [
											"allergy",
											"bleeding",
											"bone",
											"heart",
											"radiotherapy",
											"immunity",
											"emergency",
											"bbv",
											"pregnancy",
											"care"
										]
									},
									"severity": {
										"type": "string",
										"enum": [
											"info",
											"warning",
											"critical"
										]
									},
									"popup": {
										"type": [
											"boolean",
											"null"
										]
									},
									"fact": {
										"anyOf": [
											{
												"type": "string",
												"enum": [
													"condition",
													"medication",
													"allergy",
													"none"
												]
											},
											{
												"type": "null"
											}
										]
									}
								},
								"required": [
									"name",
									"word",
									"kind",
									"group",
									"severity"
								]
							}
						}
					}
				},
				"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)$"
										},
										"catalogueKey": {
											"type": [
												"string",
												"null"
											]
										},
										"name": {
											"type": [
												"string",
												"null"
											]
										},
										"word": {
											"type": [
												"string",
												"null"
											]
										},
										"todo": {
											"type": [
												"string",
												"null"
											]
										},
										"kind": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"medical",
														"allergy",
														"medication",
														"infectious",
														"warning"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"group": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"allergy",
														"bleeding",
														"bone",
														"heart",
														"radiotherapy",
														"immunity",
														"emergency",
														"bbv",
														"pregnancy",
														"care"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"severity": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"info",
														"warning",
														"critical"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"popup": {
											"type": [
												"boolean",
												"null"
											]
										},
										"fact": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"condition",
														"medication",
														"allergy",
														"none"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"hidden": {
											"type": "boolean"
										}
									},
									"required": [
										"id",
										"catalogueKey",
										"name",
										"word",
										"todo",
										"kind",
										"group",
										"severity",
										"popup",
										"fact",
										"hidden"
									],
									"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/alert-list/{id}/archive": {
			"post": {
				"summary": "Back to Smileline's wording, or remove an own entry",
				"tags": [
					"settings"
				],
				"description": "Archives one live row (clinicalCatalog:manage): an override's entry reads as Smileline's again, an own entry leaves the list. 404 for a row that is unknown or already archived.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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/alert-list/reset": {
			"post": {
				"summary": "Reset to Smileline's alert list",
				"tags": [
					"settings"
				],
				"description": "Archives every live row of the practice (clinicalCatalog:manage): every entry reads as Smileline's and own entries leave the list. Resetting an unchanged list archives none.",
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"archived": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"archived"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"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": {
											"type": [
												"string",
												"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",
													"medications"
												]
											},
											"additionalProperties": {
												"type": "array",
												"items": {
													"type": "string"
												}
											},
											"required": [
												"categories",
												"recallTypes",
												"procedureCodes",
												"feeSchedules",
												"priceLists",
												"fees",
												"formTemplates",
												"noteTemplates",
												"letterTemplates",
												"treatmentTemplates",
												"appointmentTypes",
												"operatories",
												"medications"
											]
										},
										"nhsChargesOnFile": {
											"type": [
												"boolean",
												"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",
												"medications"
											]
										}
									}
								}
							}
						}
					}
				},
				"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",
													"medications"
												]
											},
											"additionalProperties": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											},
											"required": [
												"categories",
												"recallTypes",
												"procedureCodes",
												"feeSchedules",
												"priceLists",
												"fees",
												"formTemplates",
												"noteTemplates",
												"letterTemplates",
												"treatmentTemplates",
												"appointmentTypes",
												"operatories",
												"medications"
											]
										},
										"nhsChargesOnFile": {
											"type": [
												"boolean",
												"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 — and, for a member who may read orthodontic assessments, how many the patient has (voided ones included). The read is audited once (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"
											}
										},
										"orthoAssessments": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"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. A tooth-status code (F-UNERUPTED, F-PARTIAL, F-MISSING, F-EXTRACTED, F-IMPL, F-RETAINED) on a tooth or supernumerary site keeps one active status per site: a plain record supersedes the active one in the same transaction. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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"
													]
												}
											},
											"surfaceHalves": {
												"maxItems": 3,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"BM",
														"BD",
														"LM",
														"LD",
														"OM",
														"OD"
													]
												}
											},
											"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)$"
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"fromVoiceNote": {
										"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)$"
											},
											"generation": {
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											"inputDigest": {
												"type": "string",
												"pattern": "^[0-9a-f]{64}$"
											},
											"findingIndex": {
												"type": "integer",
												"minimum": 0,
												"maximum": 100000
											}
										},
										"required": [
											"sessionId",
											"generation",
											"inputDigest",
											"findingIndex"
										]
									}
								},
								"required": [
									"kind",
									"site",
									"locationId",
									"id"
								]
							}
						}
					}
				},
				"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"description": {
											"type": [
												"string",
												"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"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedById": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"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"
												}
											]
										},
										"jurisdiction": {
											"anyOf": [
												{
													"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",
														"ie"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"surfaceHalves",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"invalidatedByName",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"authoringSource",
										"locationId",
										"jurisdiction",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"description": {
											"type": [
												"string",
												"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"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedById": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"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"
												}
											]
										},
										"jurisdiction": {
											"anyOf": [
												{
													"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",
														"ie"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"surfaceHalves",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"invalidatedByName",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"authoringSource",
										"locationId",
										"jurisdiction",
										"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}/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)$"
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": [
									"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"description": {
											"type": [
												"string",
												"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"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedById": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"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"
												}
											]
										},
										"jurisdiction": {
											"anyOf": [
												{
													"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",
														"ie"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"surfaceHalves",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"invalidatedByName",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"authoringSource",
										"locationId",
										"jurisdiction",
										"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"
				],
				"description": "An active finding only (409 CLINICAL_TRANSITION_REFUSED). A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
									"id"
								]
							}
						}
					}
				},
				"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"description": {
											"type": [
												"string",
												"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"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedById": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"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"
												}
											]
										},
										"jurisdiction": {
											"anyOf": [
												{
													"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",
														"ie"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"surfaceHalves",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"invalidatedByName",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"authoringSource",
										"locationId",
										"jurisdiction",
										"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. An active or a treated finding can be superseded: an active copy of a treated one undoes its treatment, which stays on the old row. A new finding code must be active; one kept from the old row may since have been archived. A tooth-status code onto a site that already has another active status is 409 STATUS_CONFLICT: change a status through /tooth-status. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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"
													]
												}
											},
											"surfaceHalves": {
												"maxItems": 3,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"BM",
														"BD",
														"LM",
														"LD",
														"OM",
														"OD"
													]
												}
											},
											"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)$"
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
									"id"
								]
							}
						}
					}
				},
				"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"description": {
											"type": [
												"string",
												"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"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedById": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"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"
												}
											]
										},
										"jurisdiction": {
											"anyOf": [
												{
													"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",
														"ie"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"surfaceHalves",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"invalidatedByName",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"authoringSource",
										"locationId",
										"jurisdiction",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"description": {
											"type": [
												"string",
												"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"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedById": {
											"type": [
												"string",
												"null"
											]
										},
										"invalidatedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"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"
												}
											]
										},
										"jurisdiction": {
											"anyOf": [
												{
													"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",
														"ie"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"surfaceHalves",
										"area",
										"status",
										"observedOn",
										"observedByPractitionerId",
										"observedCredentialRevisionId",
										"appointmentId",
										"treatedByProcedureId",
										"treatedAt",
										"resolvedOn",
										"resolvedReason",
										"recordedAt",
										"supersedesId",
										"supersededById",
										"invalidatedAt",
										"invalidatedReason",
										"invalidatedById",
										"invalidatedByName",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"authoringSource",
										"locationId",
										"jurisdiction",
										"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}/tooth-status": {
			"post": {
				"summary": "Set a tooth's status",
				"tags": [
					"pms"
				],
				"description": "Serialised per tooth: the active status finding must still be `expectedCurrentId` (409 STATUS_CHANGED, `details.currentId`). A code supersedes the active status or records the first one (`record_finding`); null resolves it (`resolve_finding`); the same code again changes nothing. The code must be a tooth-status code (400 FINDING_CODE_INVALID). A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": {
									"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"
													]
												}
											},
											"surfaceHalves": {
												"maxItems": 3,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"BM",
														"BD",
														"LM",
														"LD",
														"OM",
														"OD"
													]
												}
											},
											"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"
													}
												]
											}
										}
									},
									"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"
											}
										]
									},
									"expectedCurrentId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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)$"
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"site",
									"findingCodeId",
									"expectedCurrentId",
									"locationId",
									"id"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"active": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ClinicalFinding"
												},
												{
													"type": "null"
												}
											]
										},
										"previous": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ClinicalFinding"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"active",
										"previous"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"active": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ClinicalFinding"
												},
												{
													"type": "null"
												}
											]
										},
										"previous": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ClinicalFinding"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"active",
										"previous"
									],
									"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}/tooth-statuses": {
			"post": {
				"summary": "Set several teeth's statuses at once",
				"tags": [
					"pms"
				],
				"description": "One command, one Undo: every site is locked first, then each item is judged exactly as the single tooth status is (409 STATUS_CHANGED names the first stale site in `details.tooth`; nothing is written). The Undo of a bulk or a prediction is this command with each site's previous code (null for Present) and its new status as `expectedCurrentId`. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": {
									"items": {
										"minItems": 1,
										"maxItems": 104,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"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"
																]
															}
														},
														"surfaceHalves": {
															"maxItems": 3,
															"type": "array",
															"items": {
																"type": "string",
																"enum": [
																	"BM",
																	"BD",
																	"LM",
																	"LD",
																	"OM",
																	"OD"
																]
															}
														},
														"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"
																}
															]
														}
													}
												},
												"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"
														}
													]
												},
												"expectedCurrentId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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",
												"findingCodeId",
												"expectedCurrentId"
											]
										}
									},
									"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)$"
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"items",
									"locationId",
									"id"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ToothStatusResult"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ToothStatusResult"
											}
										}
									},
									"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/chart/{patientId}/predict-dentition": {
			"post": {
				"summary": "Chart a child's dentition from their age",
				"tags": [
					"pms"
				],
				"description": "Age-based dentition (Wave A): from the patient's date of birth on file (none: 422 DATE_OF_BIRTH_MISSING) and today at the location, each permanent tooth not yet through is charted Unerupted and each primary tooth not yet through Unerupted or already lost Missing (`ageChartStatuses`). Only on a chart with nothing on its teeth, judged under every tooth site's lock (409 CHART_NOT_EMPTY). One command, answered as the bulk statuses are, so its Undo is `tooth-statuses`; an age with nothing to predict answers no items. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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)$"
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
									"id"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ToothStatusResult"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ToothStatusResult"
											}
										}
									},
									"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"
								}
							}
						}
					},
					"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, 409 FEE_MISSING). Supervised professions name their supervising dentist. With `treatmentPlanId` the row joins that plan in the same command, at the end of its order and in `visitId` when named (409 VISIT_NOT_ON_PLAN). A draft, presented, accepted or in-progress plan takes the row as it stands (Wave B: a shown plan is edited in place and flagged `changedSincePresented`; `reopenPlan` from older builds is ignored). `planLink` is where the row landed. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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"
													]
												}
											},
											"surfaceHalves": {
												"maxItems": 3,
												"type": "array",
												"items": {
													"type": "string",
													"enum": [
														"BM",
														"BD",
														"LM",
														"LD",
														"OM",
														"OD"
													]
												}
											},
											"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"
													}
												]
											}
										}
									},
									"spanTeeth": {
										"maxItems": 26,
										"type": "array",
										"items": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"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"
											}
										]
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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"
											}
										]
									},
									"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"
											}
										]
									},
									"reopenPlan": {
										"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)$"
											},
											"version": {
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											"status": {
												"type": "string",
												"enum": [
													"presented",
													"accepted",
													"in_progress"
												]
											}
										},
										"required": [
											"planId",
											"version",
											"status"
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"procedureCodeId",
									"site",
									"priceListId",
									"locationId",
									"id"
								]
							}
						}
					}
				},
				"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planLink": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ChartPlanLink"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planLink"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planLink": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ChartPlanLink"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planLink"
									],
									"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"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. It marks treated every active condition or diagnosis its code treats (`treatsFindingCodeIds`), observed and entered on or before the service date, on the same tooth, root, supernumerary slot or area with every surface covered (a whole-mouth code covers every area); a pontic treats nothing. Without `finding:resolve` the completion still succeeds and lists those findings in `notTreated`. A nurse with `procedure:completeOnBehalf` records the completion for the clinician who did it (act `record_completion_on_behalf`) by naming `performerPractitionerId`: the treatment's practitioner or the visit's; the performer must be active and allowed `complete_procedure` at the site, a supervised performer needs a supervising dentist, and the treatment is stamped with the performer as its practitioner and the nurse as its recorder. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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"
											}
										]
									},
									"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)$"
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
									"id"
								]
							}
						}
					}
				},
				"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"treatedFindingIds": {
											"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)$"
											}
										},
										"notTreated": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"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)$"
													},
													"reason": {
														"type": "string",
														"enum": [
															"needs_resolve_permission"
														]
													}
												},
												"required": [
													"findingId",
													"reason"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"treatedFindingIds",
										"notTreated"
									],
									"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"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` of the signed-in practitioner: the 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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"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 and no practitioner evidence. 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. A row with a live charge, a sendable claim or an NHS course item is 409 PROCEDURE_LOCKED. A live unit of a bridge is removed only with its bridge (409 PROCEDURE_IN_GROUP with `details.groupId`; see the group's remove); a row of a set grown over teeth (no unit roles, a code that is not multi-tooth) is removed on its own, which is a growth's Undo. With `expectedPlan` (an Undo) a plan whose id, version or status moved since is 409 PLAN_STATE_STALE and nothing changes. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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
									},
									"expectedPlan": {
										"type": "object",
										"properties": {
											"id": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 1,
												"maximum": 9007199254740991
											},
											"status": {
												"type": "string",
												"enum": [
													"draft",
													"presented",
													"accepted",
													"in_progress",
													"completed",
													"declined",
													"cancelled"
												]
											}
										},
										"required": [
											"id",
											"version",
											"status"
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
									"id"
								]
							}
						}
					}
				},
				"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"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 and the new row takes its plan, visit and position. Only a live, planned, never-completed native row is corrected (409 CLINICAL_TRANSITION_REFUSED); a charged, claimed or NHS-course row is 409 PROCEDURE_LOCKED; a finished or provider plan's row is 409. The practitioner, appointment and note are carried unless named, quantity and unit count unless named, and with the same code the duration, invoice wording and (on the same list) the fee. A shown plan is edited in place, as on planning. With `restoreFromId` (Undo of a correction) the head must still be the live row that superseded it at `expectedUpdatedAt` (409 PROCEDURE_CONFLICT) on the plan `expectedPlan` names at the same version and status (null: on no plan; otherwise 409 PLAN_STATE_STALE), and the new row copies the restored one's clinical and pricing values under the actor's own `record_procedure` act at the restored row's location. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": {
								"anyOf": [
									{
										"type": "object",
										"properties": {
											"restoreFromId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"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))$"
											},
											"expectedPlan": {
												"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)$"
															},
															"version": {
																"type": "integer",
																"minimum": 1,
																"maximum": 9007199254740991
															},
															"status": {
																"type": "string",
																"enum": [
																	"draft",
																	"presented",
																	"accepted",
																	"in_progress",
																	"completed",
																	"declined",
																	"cancelled"
																]
															}
														},
														"required": [
															"id",
															"version",
															"status"
														]
													},
													{
														"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"
													}
												]
											},
											"forPractitionerId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"reopenPlan": {
												"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)$"
													},
													"version": {
														"type": "integer",
														"minimum": 1,
														"maximum": 9007199254740991
													},
													"status": {
														"type": "string",
														"enum": [
															"presented",
															"accepted",
															"in_progress"
														]
													}
												},
												"required": [
													"planId",
													"version",
													"status"
												]
											},
											"id": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
											"restoreFromId",
											"expectedUpdatedAt",
											"expectedPlan",
											"id"
										]
									},
									{
										"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"
															]
														}
													},
													"surfaceHalves": {
														"maxItems": 3,
														"type": "array",
														"items": {
															"type": "string",
															"enum": [
																"BM",
																"BD",
																"LM",
																"LD",
																"OM",
																"OD"
															]
														}
													},
													"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"
															}
														]
													}
												}
											},
											"spanTeeth": {
												"maxItems": 26,
												"type": "array",
												"items": {
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												}
											},
											"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"
													}
												]
											},
											"forPractitionerId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"reopenPlan": {
												"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)$"
													},
													"version": {
														"type": "integer",
														"minimum": 1,
														"maximum": 9007199254740991
													},
													"status": {
														"type": "string",
														"enum": [
															"presented",
															"accepted",
															"in_progress"
														]
													}
												},
												"required": [
													"planId",
													"version",
													"status"
												]
											},
											"id": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
											"procedureCodeId",
											"site",
											"priceListId",
											"locationId",
											"id"
										]
									}
								]
							}
						}
					}
				},
				"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planLink": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ChartPlanLink"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planLink"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"planLink": {
											"anyOf": [
												{
													"$ref": "#/components/schemas/ChartPlanLink"
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"procedureCodeId",
										"codeIsAct",
										"description",
										"standardId",
										"codeSystem",
										"codeEdition",
										"code",
										"nameSnapshot",
										"patientNameSnapshot",
										"categorySnapshot",
										"nhsBandSnapshot",
										"taxTreatmentSnapshot",
										"chartShapeSnapshot",
										"chartColourSnapshot",
										"chartTextSnapshot",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"planLink"
									],
									"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}": {
			"patch": {
				"summary": "Edit a treatment on a plan",
				"tags": [
					"pms"
				],
				"description": "A price or price-list change supersedes the row clerically (the new row keeps the recorded, completed and supervising evidence) on a draft, presented, accepted or in-progress plan, which stays as it is: a change to what the patient was shown or signed flags the plan `changedSincePresented` (Wave B). Practitioner, completion date, duration, invoice wording, referrer, Show on invoice and the treatment's answers change in place; on a completed treatment the practitioner, date, referrer, Show on invoice and answers are corrections that keep the earlier values as history. Rows with a live charge, a sendable insurance claim or an NHS course dataset item are locked (409 PROCEDURE_LOCKED); a stale expectedUpdatedAt is 409 PROCEDURE_CONFLICT; a referrer who is not one of the practice's practitioners is 404.",
				"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": {
									"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))$"
									},
									"feeCents": {
										"type": "integer",
										"minimum": 0,
										"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)$"
									},
									"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)$"
									},
									"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])))$"
									},
									"durationMin": {
										"anyOf": [
											{
												"type": "integer",
												"minimum": 0,
												"maximum": 9007199254740991
											},
											{
												"type": "null"
											}
										]
									},
									"invoiceDescription": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 500
											},
											{
												"type": "null"
											}
										]
									},
									"referrerPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"showOnInvoice": {
										"type": "boolean"
									},
									"customFieldValues": {
										"type": "object",
										"propertyNames": {
											"type": "string",
											"minLength": 1,
											"maxLength": 64,
											"pattern": "^[a-z0-9_]+$"
										},
										"additionalProperties": {
											"anyOf": [
												{
													"anyOf": [
														{
															"type": "boolean"
														},
														{
															"type": "string",
															"maxLength": 2000
														}
													]
												},
												{
													"type": "null"
												}
											]
										}
									}
								},
								"required": [
									"expectedUpdatedAt"
								],
								"description": "Requires at least one of feeCents, priceListId, practitionerId, serviceDate, durationMin, invoiceDescription, referrerPractitionerId, showOnInvoice or customFieldValues. feeCents, priceListId, durationMin, invoiceDescription, referrerPractitionerId, showOnInvoice and customFieldValues need treatmentPlan:adjust; practitionerId and serviceDate need procedure:complete; a field counts as present when it is sent at all, including 0 or 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)$"
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"codeEdition": {
											"type": [
												"string",
												"null"
											]
										},
										"code": {
											"type": [
												"string",
												"null"
											]
										},
										"nameSnapshot": {
											"type": "string"
										},
										"patientNameSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"categorySnapshot": {
											"type": [
												"string",
												"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",
														"large_square",
														"tiny_square",
														"triangle",
														"text",
														"arrow_mesial",
														"arrow_distal",
														"rotate_mesial",
														"rotate_distal",
														"arrow_occlusal",
														"arrow_down"
													]
												},
												{
													"type": "null"
												}
											]
										},
										"chartColourSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"chartTextSnapshot": {
											"type": [
												"string",
												"null"
											]
										},
										"fillsRootSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"null"
											]
										},
										"resetsToothSnapshot": {
											"default": null,
											"type": [
												"boolean",
												"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": {
											"type": [
												"string",
												"null"
											]
										},
										"surfaces": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"surfaceHalves": {
											"default": [],
											"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"
												}
											]
										},
										"spanTeeth": {
											"type": "array",
											"items": {
												"type": "integer",
												"minimum": -9007199254740991,
												"maximum": 9007199254740991
											}
										},
										"groupId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"unitRole": {
											"anyOf": [
												{
													"type": "string",
													"enum": [
														"retainer",
														"pontic"
													]
												},
												{
													"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": {
											"type": [
												"string",
												"null"
											]
										},
										"durationMin": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"invoiceDescription": {
											"type": [
												"string",
												"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
										},
										"scheduleFeeCents": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"feeDiscountPercent": {
											"default": null,
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"pricedOn": {
											"default": null,
											"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"
												}
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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"
												}
											]
										},
										"completionRecordedByUserId": {
											"default": null,
											"type": [
												"string",
												"null"
											]
										},
										"authoringSource": {
											"type": "string",
											"enum": [
												"staff",
												"ai_draft",
												"import",
												"pms_sync",
												"migration"
											]
										},
										"aiModel": {
											"type": [
												"string",
												"null"
											]
										},
										"aiPromptVersion": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"amendedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"declinedSnapshotId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"billingEntityId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"referrerPractitionerId": {
											"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"
												}
											]
										},
										"showOnInvoice": {
											"default": true,
											"type": "boolean"
										},
										"customFields": {
											"default": null,
											"anyOf": [
												{
													"$ref": "#/components/schemas/ProcedureCustomFields"
												},
												{
													"type": "null"
												}
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"fillsRootSnapshot",
										"resetsToothSnapshot",
										"status",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"surfaces",
										"surfaceHalves",
										"area",
										"spanTeeth",
										"groupId",
										"unitRole",
										"quantity",
										"practitionerId",
										"locationId",
										"appointmentId",
										"serviceDate",
										"completedAt",
										"recordedAt",
										"note",
										"durationMin",
										"invoiceDescription",
										"priceListId",
										"feeScheduleId",
										"priceListItemId",
										"feeScheduleItemId",
										"unitCount",
										"feeCents",
										"scheduleFeeCents",
										"feeDiscountPercent",
										"pricedOn",
										"feeUnknown",
										"benefitRevisionId",
										"insuranceEstimateCents",
										"currency",
										"supersedesId",
										"supersededById",
										"voidedAt",
										"voidReason",
										"voidedByPractitionerId",
										"voidCredentialRevisionId",
										"voidReauthenticatedAt",
										"voidedByUserId",
										"reauthenticatedAt",
										"recordedByPractitionerId",
										"recordedCredentialRevisionId",
										"supervisingPractitionerId",
										"supervisingCredentialRevisionId",
										"completedByPractitionerId",
										"completedCredentialRevisionId",
										"completionRecordedByUserId",
										"authoringSource",
										"aiModel",
										"aiPromptVersion",
										"revision",
										"amendedAt",
										"amendedById",
										"amendedByName",
										"declinedSnapshotId",
										"billingEntityId",
										"referrerPractitionerId",
										"showOnInvoice",
										"customFields",
										"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}/procedure-groups": {
			"post": {
				"summary": "Plan a bridge as one group of units",
				"tags": [
					"pms"
				],
				"description": "One command plans a unit per tooth — each its own `record_procedure` act, priced on its own code, claimed and completed on its own — sharing `id` as their group, and appends them to the plan in chart order in `visitId` when named. A pontic takes the pontic code its code pairs with (`ponticProcedureCodeId`), every other unit the code itself. A shown plan is edited in place, as on planning. With `restoreFromRemovalId` (the Undo of a bridge's removal) it plans, as one new group, a fresh unit for every unit that removal took off: each its own code — retainer or pontic — tooth, part, visit, price list, site, clinician, supervisor and quantity, at the price list's current fee, under the actor's own act. The plan must still be as the removal left it (`expectedPlan`, else 409 PLAN_STATE_STALE); a removal is restored once (409 GROUP_ALREADY_RESTORED), and a code archived since restores nothing and names the tooth (409 PROCEDURE_CODE_ARCHIVED). A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": {
											"restoreFromRemovalId": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"expectedPlan": {
												"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)$"
															},
															"version": {
																"type": "integer",
																"minimum": 1,
																"maximum": 9007199254740991
															},
															"status": {
																"type": "string",
																"enum": [
																	"draft",
																	"presented",
																	"accepted",
																	"in_progress",
																	"completed",
																	"declined",
																	"cancelled"
																]
															}
														},
														"required": [
															"id",
															"version",
															"status"
														]
													},
													{
														"type": "null"
													}
												]
											},
											"forPractitionerId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"id": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
											"restoreFromRemovalId",
											"expectedPlan",
											"id"
										]
									},
									{
										"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)$"
											},
											"units": {
												"minItems": 2,
												"maxItems": 16,
												"type": "array",
												"items": {
													"type": "object",
													"properties": {
														"tooth": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"role": {
															"anyOf": [
																{
																	"type": "string",
																	"enum": [
																		"retainer",
																		"pontic"
																	]
																},
																{
																	"type": "null"
																}
															]
														},
														"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)$"
														}
													},
													"required": [
														"tooth",
														"role"
													]
												}
											},
											"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)$"
											},
											"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)$"
											},
											"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"
													}
												]
											},
											"reopenPlan": {
												"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)$"
													},
													"version": {
														"type": "integer",
														"minimum": 1,
														"maximum": 9007199254740991
													},
													"status": {
														"type": "string",
														"enum": [
															"presented",
															"accepted",
															"in_progress"
														]
													}
												},
												"required": [
													"planId",
													"version",
													"status"
												]
											},
											"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"
													}
												]
											},
											"forPractitionerId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													{
														"type": "null"
													}
												]
											},
											"id": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
											"procedureCodeId",
											"units",
											"priceListId",
											"locationId",
											"treatmentPlanId",
											"id"
										]
									}
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"groupId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ChartedProcedure"
											}
										}
									},
									"required": [
										"groupId",
										"procedures"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"groupId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ChartedProcedure"
											}
										}
									},
									"required": [
										"groupId",
										"procedures"
									],
									"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}/procedure-groups/{groupId}/remove": {
			"post": {
				"summary": "Remove a planned bridge whole",
				"tags": [
					"pms"
				],
				"description": "The clerical void of every live unit of a bridge in one step: each voided under the signed-in member's name with one reason, or none of them. Any unit started, completed, charged, claimed or on an NHS course refuses the whole removal and names its tooth (409 CLINICAL_TRANSITION_REFUSED or PROCEDURE_LOCKED); `expectedUnits` must be exactly the live units at their tokens (409 PROCEDURE_GROUP_CHANGED with `details.current`). The plan's token moves once. Removing one unit of a bridge alone is refused (409 PROCEDURE_IN_GROUP on the single remove). The response is the receipt an Undo restores from. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": "groupId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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
									},
									"expectedUnits": {
										"minItems": 1,
										"maxItems": 16,
										"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)$"
												},
												"updatedAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												}
											},
											"required": [
												"id",
												"updatedAt"
											]
										}
									},
									"expectedPlan": {
										"type": "object",
										"properties": {
											"id": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": 1,
												"maximum": 9007199254740991
											},
											"status": {
												"type": "string",
												"enum": [
													"draft",
													"presented",
													"accepted",
													"in_progress",
													"completed",
													"declined",
													"cancelled"
												]
											}
										},
										"required": [
											"id",
											"version",
											"status"
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
									"expectedUnits",
									"id"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"groupId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/Procedure"
											}
										},
										"plan": {
											"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)$"
														},
														"version": {
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														"status": {
															"type": "string",
															"enum": [
																"draft",
																"presented",
																"accepted",
																"in_progress",
																"completed",
																"declined",
																"cancelled"
															]
														},
														"updatedAt": {
															"type": "string",
															"format": "date-time",
															"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
														}
													},
													"required": [
														"id",
														"version",
														"status",
														"updatedAt"
													],
													"additionalProperties": false
												},
												{
													"type": "null"
												}
											]
										}
									},
									"required": [
										"groupId",
										"procedures",
										"plan"
									],
									"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}/grow": {
			"post": {
				"summary": "Grow a tooth treatment onto another tooth",
				"tags": [
					"pms"
				],
				"description": "Dentally's multi-tooth item, one fee per tooth (owner, 2026-10-23): a new planned row of the same code on `tooth`, at the item's site, price list, plan and visit, priced on its own, sharing a set (`groupId`, no unit roles) with the item. On the first growth the item itself joins the set as a clerical correction: its row is superseded by a copy carrying the set (fee, practitioner, appointment and note kept), which keeps its place on the plan. Only a live planned row of a tooth-area code that is not multi-tooth and not a bridge unit grows (422 CODE_NOT_GROWABLE); a tooth already in the set is 422 TOOTH_IN_SET. Locked, charged, claimed and NHS-course rows, shown plans and stale tokens are refused as a correction is. Removing the set is the group's remove; one row of a set is removed on its own only as a growth's Undo. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": {
									"tooth": {
										"type": "integer",
										"minimum": -9007199254740991,
										"maximum": 9007199254740991
									},
									"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))$"
									},
									"reopenPlan": {
										"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)$"
											},
											"version": {
												"type": "integer",
												"minimum": 1,
												"maximum": 9007199254740991
											},
											"status": {
												"type": "string",
												"enum": [
													"presented",
													"accepted",
													"in_progress"
												]
											}
										},
										"required": [
											"planId",
											"version",
											"status"
										]
									},
									"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"
											}
										]
									},
									"forPractitionerId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											{
												"type": "null"
											}
										]
									},
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"tooth",
									"expectedUpdatedAt",
									"id"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"groupId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ChartedProcedure"
											}
										},
										"grownId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"supersededId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": [
										"groupId",
										"procedures",
										"grownId",
										"supersededId"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"groupId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"procedures": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/ChartedProcedure"
											}
										},
										"grownId": {
											"type": "string",
											"format": "uuid",
											"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
										},
										"supersededId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": [
										"groupId",
										"procedures",
										"grownId",
										"supersededId"
									],
									"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}/planning-context": {
			"get": {
				"summary": "One patient's chart as the treatment planner reads it",
				"tags": [
					"pms"
				],
				"description": "Every tooth's state, active findings and existing work, open plans, active medical alert titles, the patient's price list catalogue with fees, and the practice's dentists — no name, date of birth or notes. Read by the AI assistant's treatment planner only (its delegated read, behind the clinical-AI gate: 403 TREATMENT_PLANNING_UNAVAILABLE outside it) and by signed-in clinical staff. The site is the patient's own, else the practice's only one (409 PLANNING_LOCATION_UNRESOLVED otherwise); the price list the chart would start on — the member price, the patient's list, else the practice's only one (409 PLANNING_PRICE_LIST_UNRESOLVED otherwise, with `why`); an NHS list only at an English site (409 NHS_SITE_UNAVAILABLE). Needs patient:readClinical and treatmentPlan:read.",
				"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": {
										"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)$"
										},
										"ageYears": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"country": {
											"type": "string"
										},
										"notation": {
											"type": "string",
											"enum": [
												"fdi",
												"palmer",
												"universal"
											]
										},
										"teeth": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"tooth": {
														"type": "integer",
														"minimum": -9007199254740991,
														"maximum": 9007199254740991
													},
													"fact": {
														"type": "string",
														"enum": [
															"present",
															"missing",
															"unerupted",
															"implant",
															"root"
														]
													},
													"digest": {
														"type": "string"
													}
												},
												"required": [
													"tooth",
													"fact",
													"digest"
												],
												"additionalProperties": false
											}
										},
										"findings": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"code": {
														"type": "string"
													},
													"name": {
														"type": "string"
													},
													"existing": {
														"type": "boolean"
													},
													"supernumerary": {
														"type": "boolean"
													},
													"position": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"tooth",
													"code",
													"name",
													"existing",
													"supernumerary",
													"position"
												],
												"additionalProperties": false
											}
										},
										"openPlans": {
											"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",
															"null"
														]
													},
													"status": {
														"type": "string",
														"enum": [
															"draft",
															"presented",
															"accepted",
															"in_progress",
															"completed",
															"declined",
															"cancelled"
														]
													},
													"procedures": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"code": {
																	"type": [
																		"string",
																		"null"
																	]
																},
																"name": {
																	"type": "string"
																},
																"teeth": {
																	"type": "array",
																	"items": {
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	}
																},
																"status": {
																	"type": "string",
																	"enum": [
																		"planned",
																		"in_progress",
																		"completed",
																		"referred_out"
																	]
																}
															},
															"required": [
																"code",
																"name",
																"teeth",
																"status"
															],
															"additionalProperties": false
														}
													}
												},
												"required": [
													"id",
													"name",
													"status",
													"procedures"
												],
												"additionalProperties": false
											}
										},
										"alerts": {
											"type": "array",
											"items": {
												"type": "string"
											}
										},
										"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)$"
												},
												"name": {
													"type": "string"
												}
											},
											"required": [
												"id",
												"name"
											],
											"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)$"
												},
												"name": {
													"type": "string"
												}
											},
											"required": [
												"id",
												"name"
											],
											"additionalProperties": false
										},
										"currency": {
											"type": "string",
											"enum": [
												"EUR",
												"GBP",
												"USD"
											]
										},
										"catalogue": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/PlanningCatalogueCode"
											}
										},
										"dentists": {
											"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
											}
										},
										"patientDentistId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"selfDentistId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"readAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?: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",
										"ageYears",
										"country",
										"notation",
										"teeth",
										"findings",
										"openPlans",
										"alerts",
										"priceList",
										"location",
										"currency",
										"catalogue",
										"dentists",
										"patientDentistId",
										"selfDentistId",
										"readAt"
									],
									"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/3d-model/{file}": {
			"get": {
				"summary": "One of the chart 3D window's model files",
				"tags": [
					"pms"
				],
				"description": "The licensed tooth model the chart's 3D window draws (dentition-v1.glb) and its studio lighting (environment-v1.exr), streamed from the cell's storage to signed-in clinical staff who read the chart (finding:read). No patient data. Any other name, or a file not uploaded, answers 404. The version is in the name, so the file is cached privately for a week as immutable.",
				"parameters": [
					{
						"name": "file",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/chart/explore": {
			"post": {
				"summary": "Change the 3D window's model from a request in words",
				"tags": [
					"pms"
				],
				"description": "Explore's show-me chat: GPT-6 Luna answers the member's request with changes to the model state sent, which Explore's own rules apply in order, and a sentence in the request's language naming teeth in the chart's notation. A change naming a tooth not in the state, a zone the tooth lacks or work it cannot take is dropped and counted. Nothing is read from the patient's record and nothing is stored. 403 TREATMENT_PLANNING_UNAVAILABLE outside the clinical-AI gate (practices in the UK, the US and Italy); 502 EXPLORE_UNREADABLE when the answer is cut off, refused or unreadable (nothing applied: ask again); 503 when the AI cannot be reached. Needs aiAssist:use and patient:readClinical.",
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"message": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									},
									"notation": {
										"type": "string",
										"enum": [
											"fdi",
											"universal",
											"palmer"
										]
									},
									"locale": {
										"type": "string",
										"enum": [
											"en",
											"es",
											"it"
										]
									},
									"state": {
										"$ref": "#/components/schemas/ExploreState"
									},
									"history": {
										"maxItems": 12,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"role": {
													"type": "string",
													"enum": [
														"user",
														"assistant"
													]
												},
												"text": {
													"type": "string",
													"maxLength": 2000
												}
											},
											"required": [
												"role",
												"text"
											]
										}
									}
								},
								"required": [
									"message",
									"notation",
									"locale",
									"state",
									"history"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"reply": {
											"type": "string",
											"maxLength": 400
										},
										"changes": {
											"maxItems": 64,
											"type": "array",
											"items": {
												"oneOf": [
													{
														"type": "object",
														"properties": {
															"kind": {
																"type": "string",
																"const": "set_tooth"
															},
															"fdi": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															"main": {
																"type": "string",
																"enum": [
																	"natural",
																	"root",
																	"missing",
																	"pontic",
																	"implant_extracted",
																	"implant_fixture",
																	"implant_abutment",
																	"implant_crown",
																	"crown_prep",
																	"crown_provisional",
																	"crown",
																	"onlay_prep",
																	"onlay",
																	"veneer_prep",
																	"veneer_provisional",
																	"veneer"
																]
															},
															"zones": {
																"type": "object",
																"propertyNames": {
																	"type": "string",
																	"enum": [
																		"cervical",
																		"mesial",
																		"distal",
																		"central",
																		"mesial_angle",
																		"distal_angle",
																		"tip"
																	]
																},
																"additionalProperties": {
																	"anyOf": [
																		{
																			"type": "string",
																			"enum": [
																				"decay",
																				"composite"
																			]
																		},
																		{
																			"type": "null"
																		}
																	]
																}
															},
															"flags": {
																"type": "object",
																"propertyNames": {
																	"type": "string",
																	"enum": [
																		"rootCanal",
																		"infectedRoot",
																		"rootFracture",
																		"apicectomy",
																		"gumGraft",
																		"boneGraft"
																	]
																},
																"additionalProperties": {
																	"type": "boolean"
																}
															}
														},
														"required": [
															"kind",
															"fdi"
														],
														"additionalProperties": false
													},
													{
														"type": "object",
														"properties": {
															"kind": {
																"type": "string",
																"const": "clear_tooth"
															},
															"fdi": {
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															}
														},
														"required": [
															"kind",
															"fdi"
														],
														"additionalProperties": false
													},
													{
														"type": "object",
														"properties": {
															"whitening": {
																"type": "boolean"
															},
															"gums": {
																"type": "string",
																"enum": [
																	"healthy",
																	"gingivitis",
																	"periodontitis"
																]
															},
															"trays": {
																"type": "string",
																"enum": [
																	"none",
																	"upper",
																	"lower",
																	"both"
																]
															},
															"fullArchUpper": {
																"type": "string",
																"enum": [
																	"none",
																	"all_on_4",
																	"all_on_6"
																]
															},
															"fullArchLower": {
																"type": "string",
																"enum": [
																	"none",
																	"all_on_4",
																	"all_on_6"
																]
															},
															"kind": {
																"type": "string",
																"const": "set_mouth"
															}
														},
														"required": [
															"kind"
														],
														"additionalProperties": false
													}
												]
											}
										},
										"state": {
											"$ref": "#/components/schemas/ExploreState"
										},
										"focus": {
											"anyOf": [
												{
													"type": "integer",
													"minimum": -9007199254740991,
													"maximum": 9007199254740991
												},
												{
													"type": "null"
												}
											]
										},
										"dropped": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"reply",
										"changes",
										"state",
										"focus",
										"dropped"
									],
									"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"
								}
							}
						}
					},
					"502": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/placed-devices/{patientId}/procedures/{procedureId}": {
			"get": {
				"summary": "A treatment's placed devices",
				"tags": [
					"pms"
				],
				"description": "The devices recorded on any row of the treatment's repricing chain, each at its latest correction, shown under the chain's current row, plus whether Record device is offered and what the Shop can prefill. Needs `procedure:read`; audited as a clinical read.",
				"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": "procedureId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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": {
										"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)$"
												},
												"name": {
													"type": "string"
												},
												"status": {
													"type": "string"
												},
												"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"
														}
													]
												},
												"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"
														}
													]
												},
												"voided": {
													"type": "boolean"
												},
												"siteKind": {
													"type": "string",
													"enum": [
														"none",
														"tooth",
														"root",
														"implant",
														"supernumerary",
														"area"
													]
												},
												"tooth": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"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"
														}
													]
												}
											},
											"required": [
												"id",
												"name",
												"status",
												"serviceDate",
												"practitionerId",
												"voided",
												"siteKind",
												"tooth",
												"area"
											],
											"additionalProperties": false
										},
										"offered": {
											"type": "boolean"
										},
										"implanted": {
											"type": "boolean"
										},
										"devices": {
											"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)$"
													},
													"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)$"
													},
													"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)$"
															},
															"name": {
																"type": "string"
															},
															"status": {
																"type": "string"
															},
															"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"
																	}
																]
															},
															"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"
																	}
																]
															},
															"voided": {
																"type": "boolean"
															},
															"siteKind": {
																"type": "string",
																"enum": [
																	"none",
																	"tooth",
																	"root",
																	"implant",
																	"supernumerary",
																	"area"
																]
															},
															"tooth": {
																"anyOf": [
																	{
																		"type": "integer",
																		"minimum": -9007199254740991,
																		"maximum": 9007199254740991
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"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"
																	}
																]
															}
														},
														"required": [
															"id",
															"name",
															"status",
															"serviceDate",
															"practitionerId",
															"voided",
															"siteKind",
															"tooth",
															"area"
														],
														"additionalProperties": false
													},
													"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": {
														"type": [
															"string",
															"null"
														]
													},
													"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"
															}
														]
													},
													"variantId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"manufacturer": {
														"type": [
															"string",
															"null"
														]
													},
													"product": {
														"type": [
															"string",
															"null"
														]
													},
													"gtin": {
														"type": [
															"string",
															"null"
														]
													},
													"lot": {
														"type": [
															"string",
															"null"
														]
													},
													"serial": {
														"type": [
															"string",
															"null"
														]
													},
													"expiryOn": {
														"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"
															}
														]
													},
													"size": {
														"type": [
															"string",
															"null"
														]
													},
													"source": {
														"type": "string",
														"enum": [
															"scan",
															"manual",
															"shop"
														]
													},
													"correctsId": {
														"anyOf": [
															{
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
															},
															{
																"type": "null"
															}
														]
													},
													"enteredInError": {
														"type": "boolean"
													},
													"correctionReason": {
														"type": [
															"string",
															"null"
														]
													},
													"recordedByName": {
														"type": [
															"string",
															"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",
													"procedureId",
													"treatment",
													"siteKind",
													"tooth",
													"root",
													"supernumeraryPosition",
													"area",
													"variantId",
													"manufacturer",
													"product",
													"gtin",
													"lot",
													"serial",
													"expiryOn",
													"size",
													"source",
													"correctsId",
													"enteredInError",
													"correctionReason",
													"recordedByName",
													"createdAt"
												],
												"additionalProperties": false
											}
										},
										"shopVariants": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"variantId": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"manufacturer": {
														"type": [
															"string",
															"null"
														]
													},
													"product": {
														"type": "string"
													},
													"size": {
														"type": "string"
													},
													"gtin": {
														"type": [
															"string",
															"null"
														]
													}
												},
												"required": [
													"variantId",
													"manufacturer",
													"product",
													"size",
													"gtin"
												],
												"additionalProperties": false
											}
										},
										"replacements": {
											"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"
													},
													"status": {
														"type": "string"
													},
													"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"
															}
														]
													},
													"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"
															}
														]
													},
													"voided": {
														"type": "boolean"
													},
													"siteKind": {
														"type": "string",
														"enum": [
															"none",
															"tooth",
															"root",
															"implant",
															"supernumerary",
															"area"
														]
													},
													"tooth": {
														"anyOf": [
															{
																"type": "integer",
																"minimum": -9007199254740991,
																"maximum": 9007199254740991
															},
															{
																"type": "null"
															}
														]
													},
													"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"
															}
														]
													}
												},
												"required": [
													"id",
													"name",
													"status",
													"serviceDate",
													"practitionerId",
													"voided",
													"siteKind",
													"tooth",
													"area"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"treatment",
										"offered",
										"implanted",
										"devices",
										"shopVariants",
										"replacements"
									],
									"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": "Record a placed device",
				"tags": [
					"pms"
				],
				"description": "Records the device on the current row of the treatment's repricing chain, which must be completed and not voided (409 PROCEDURE_NOT_COMPLETED, PROCEDURE_VOIDED). The same serial number already recorded on the chain is refused (409 DEVICE_ALREADY_RECORDED). Needs `procedure:record`; no Shop. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": "procedureId",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"manufacturer": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"product": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 200
											},
											{
												"type": "null"
											}
										]
									},
									"gtin": {
										"anyOf": [
											{
												"type": "string",
												"pattern": "^\\d{14}$",
												"description": "14 digits with a valid GS1 check digit"
											},
											{
												"type": "null"
											}
										]
									},
									"lot": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"serial": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"expiryOn": {
										"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"
											}
										]
									},
									"size": {
										"anyOf": [
											{
												"type": "string",
												"minLength": 1,
												"maxLength": 100
											},
											{
												"type": "null"
											}
										]
									},
									"variantId": {
										"anyOf": [
											{
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": [
											"scan",
											"manual",
											"shop"
										]
									}
								},
								"required": [
									"id",
									"source"
								],
								"description": "The command id and the device's fields. A lot or a serial number identifies the device placed."
							}
						}
					}
				},
				"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)$"
										},
										"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)$"
										},
										"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)$"
												},
												"name": {
													"type": "string"
												},
												"status": {
													"type": "string"
												},
												"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"
														}
													]
												},
												"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"
														}
													]
												},
												"voided": {
													"type": "boolean"
												},
												"siteKind": {
													"type": "string",
													"enum": [
														"none",
														"tooth",
														"root",
														"implant",
														"supernumerary",
														"area"
													]
												},
												"tooth": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"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"
														}
													]
												}
											},
											"required": [
												"id",
												"name",
												"status",
												"serviceDate",
												"practitionerId",
												"voided",
												"siteKind",
												"tooth",
												"area"
											],
											"additionalProperties": false
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"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"
												}
											]
										},
										"variantId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"manufacturer": {
											"type": [
												"string",
												"null"
											]
										},
										"product": {
											"type": [
												"string",
												"null"
											]
										},
										"gtin": {
											"type": [
												"string",
												"null"
											]
										},
										"lot": {
											"type": [
												"string",
												"null"
											]
										},
										"serial": {
											"type": [
												"string",
												"null"
											]
										},
										"expiryOn": {
											"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"
												}
											]
										},
										"size": {
											"type": [
												"string",
												"null"
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"scan",
												"manual",
												"shop"
											]
										},
										"correctsId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"enteredInError": {
											"type": "boolean"
										},
										"correctionReason": {
											"type": [
												"string",
												"null"
											]
										},
										"recordedByName": {
											"type": [
												"string",
												"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",
										"procedureId",
										"treatment",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"area",
										"variantId",
										"manufacturer",
										"product",
										"gtin",
										"lot",
										"serial",
										"expiryOn",
										"size",
										"source",
										"correctsId",
										"enteredInError",
										"correctionReason",
										"recordedByName",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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)$"
										},
										"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)$"
										},
										"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)$"
												},
												"name": {
													"type": "string"
												},
												"status": {
													"type": "string"
												},
												"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"
														}
													]
												},
												"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"
														}
													]
												},
												"voided": {
													"type": "boolean"
												},
												"siteKind": {
													"type": "string",
													"enum": [
														"none",
														"tooth",
														"root",
														"implant",
														"supernumerary",
														"area"
													]
												},
												"tooth": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"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"
														}
													]
												}
											},
											"required": [
												"id",
												"name",
												"status",
												"serviceDate",
												"practitionerId",
												"voided",
												"siteKind",
												"tooth",
												"area"
											],
											"additionalProperties": false
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"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"
												}
											]
										},
										"variantId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"manufacturer": {
											"type": [
												"string",
												"null"
											]
										},
										"product": {
											"type": [
												"string",
												"null"
											]
										},
										"gtin": {
											"type": [
												"string",
												"null"
											]
										},
										"lot": {
											"type": [
												"string",
												"null"
											]
										},
										"serial": {
											"type": [
												"string",
												"null"
											]
										},
										"expiryOn": {
											"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"
												}
											]
										},
										"size": {
											"type": [
												"string",
												"null"
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"scan",
												"manual",
												"shop"
											]
										},
										"correctsId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"enteredInError": {
											"type": "boolean"
										},
										"correctionReason": {
											"type": [
												"string",
												"null"
											]
										},
										"recordedByName": {
											"type": [
												"string",
												"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",
										"procedureId",
										"treatment",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"area",
										"variantId",
										"manufacturer",
										"product",
										"gtin",
										"lot",
										"serial",
										"expiryOn",
										"size",
										"source",
										"correctsId",
										"enteredInError",
										"correctionReason",
										"recordedByName",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/placed-devices/{patientId}/devices/{id}/correct": {
			"post": {
				"summary": "Correct a placed device, or mark it entered in error",
				"tags": [
					"pms"
				],
				"description": "A new entry replaces the device's latest one, which is kept: the replacement fields (optionally on another completed, live treatment of the patient), or entered in error with a reason. An entry already corrected answers 409 DEVICE_ALREADY_CORRECTED. Needs `procedure:record`. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command).",
				"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": {
								"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)$"
											},
											"enteredInError": {
												"type": "boolean",
												"const": true
											},
											"reason": {
												"type": "string",
												"minLength": 1,
												"maxLength": 1000
											}
										},
										"required": [
											"id",
											"enteredInError",
											"reason"
										]
									},
									{
										"type": "object",
										"properties": {
											"id": {
												"type": "string",
												"format": "uuid",
												"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
											},
											"enteredInError": {
												"type": "boolean",
												"const": false
											},
											"reason": {
												"type": "string",
												"minLength": 1,
												"maxLength": 1000
											},
											"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)$"
											},
											"manufacturer": {
												"anyOf": [
													{
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													{
														"type": "null"
													}
												]
											},
											"product": {
												"anyOf": [
													{
														"type": "string",
														"minLength": 1,
														"maxLength": 200
													},
													{
														"type": "null"
													}
												]
											},
											"gtin": {
												"anyOf": [
													{
														"type": "string",
														"pattern": "^\\d{14}$",
														"description": "14 digits with a valid GS1 check digit"
													},
													{
														"type": "null"
													}
												]
											},
											"lot": {
												"anyOf": [
													{
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													{
														"type": "null"
													}
												]
											},
											"serial": {
												"anyOf": [
													{
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													{
														"type": "null"
													}
												]
											},
											"expiryOn": {
												"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"
													}
												]
											},
											"size": {
												"anyOf": [
													{
														"type": "string",
														"minLength": 1,
														"maxLength": 100
													},
													{
														"type": "null"
													}
												]
											},
											"variantId": {
												"anyOf": [
													{
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{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": [
													"scan",
													"manual",
													"shop"
												]
											}
										},
										"required": [
											"id",
											"enteredInError",
											"reason",
											"source"
										]
									}
								],
								"description": "Entered in error (the reason only), or the replacement fields in full. A lot or a serial number identifies the device placed."
							}
						}
					}
				},
				"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)$"
										},
										"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)$"
										},
										"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)$"
												},
												"name": {
													"type": "string"
												},
												"status": {
													"type": "string"
												},
												"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"
														}
													]
												},
												"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"
														}
													]
												},
												"voided": {
													"type": "boolean"
												},
												"siteKind": {
													"type": "string",
													"enum": [
														"none",
														"tooth",
														"root",
														"implant",
														"supernumerary",
														"area"
													]
												},
												"tooth": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"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"
														}
													]
												}
											},
											"required": [
												"id",
												"name",
												"status",
												"serviceDate",
												"practitionerId",
												"voided",
												"siteKind",
												"tooth",
												"area"
											],
											"additionalProperties": false
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"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"
												}
											]
										},
										"variantId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"manufacturer": {
											"type": [
												"string",
												"null"
											]
										},
										"product": {
											"type": [
												"string",
												"null"
											]
										},
										"gtin": {
											"type": [
												"string",
												"null"
											]
										},
										"lot": {
											"type": [
												"string",
												"null"
											]
										},
										"serial": {
											"type": [
												"string",
												"null"
											]
										},
										"expiryOn": {
											"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"
												}
											]
										},
										"size": {
											"type": [
												"string",
												"null"
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"scan",
												"manual",
												"shop"
											]
										},
										"correctsId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"enteredInError": {
											"type": "boolean"
										},
										"correctionReason": {
											"type": [
												"string",
												"null"
											]
										},
										"recordedByName": {
											"type": [
												"string",
												"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",
										"procedureId",
										"treatment",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"area",
										"variantId",
										"manufacturer",
										"product",
										"gtin",
										"lot",
										"serial",
										"expiryOn",
										"size",
										"source",
										"correctsId",
										"enteredInError",
										"correctionReason",
										"recordedByName",
										"createdAt"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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)$"
										},
										"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)$"
										},
										"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)$"
												},
												"name": {
													"type": "string"
												},
												"status": {
													"type": "string"
												},
												"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"
														}
													]
												},
												"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"
														}
													]
												},
												"voided": {
													"type": "boolean"
												},
												"siteKind": {
													"type": "string",
													"enum": [
														"none",
														"tooth",
														"root",
														"implant",
														"supernumerary",
														"area"
													]
												},
												"tooth": {
													"anyOf": [
														{
															"type": "integer",
															"minimum": -9007199254740991,
															"maximum": 9007199254740991
														},
														{
															"type": "null"
														}
													]
												},
												"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"
														}
													]
												}
											},
											"required": [
												"id",
												"name",
												"status",
												"serviceDate",
												"practitionerId",
												"voided",
												"siteKind",
												"tooth",
												"area"
											],
											"additionalProperties": false
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"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"
												}
											]
										},
										"variantId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"manufacturer": {
											"type": [
												"string",
												"null"
											]
										},
										"product": {
											"type": [
												"string",
												"null"
											]
										},
										"gtin": {
											"type": [
												"string",
												"null"
											]
										},
										"lot": {
											"type": [
												"string",
												"null"
											]
										},
										"serial": {
											"type": [
												"string",
												"null"
											]
										},
										"expiryOn": {
											"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"
												}
											]
										},
										"size": {
											"type": [
												"string",
												"null"
											]
										},
										"source": {
											"type": "string",
											"enum": [
												"scan",
												"manual",
												"shop"
											]
										},
										"correctsId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"type": "null"
												}
											]
										},
										"enteredInError": {
											"type": "boolean"
										},
										"correctionReason": {
											"type": [
												"string",
												"null"
											]
										},
										"recordedByName": {
											"type": [
												"string",
												"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",
										"procedureId",
										"treatment",
										"siteKind",
										"tooth",
										"root",
										"supernumeraryPosition",
										"area",
										"variantId",
										"manufacturer",
										"product",
										"gtin",
										"lot",
										"serial",
										"expiryOn",
										"size",
										"source",
										"correctsId",
										"enteredInError",
										"correctionReason",
										"recordedByName",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/placed-devices/search": {
			"get": {
				"summary": "Lot recall search",
				"tags": [
					"pms"
				],
				"description": "Every current device entry matching the GTIN, lot and serial given (at least one; lot and serial ignore case), devices under a voided treatment included and labelled. Lists only patients the caller may see; each patient on the page is audited as a clinical read, and nothing is answered if that audit fails. Needs `patient:read` and `procedure:read`. One page at a time: pass `nextCursor` back as `cursor` until it is null.",
				"parameters": [
					{
						"name": "gtin",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 14
						}
					},
					{
						"name": "lot",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 100
						}
					},
					{
						"name": "serial",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 100
						}
					},
					{
						"name": "limit",
						"in": "query",
						"required": false,
						"schema": {
							"default": 50,
							"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": {
												"type": "object",
												"properties": {
													"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",
																		"format": "date",
																		"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[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",
															"firstName",
															"lastName",
															"dateOfBirth"
														],
														"additionalProperties": false
													},
													"device": {
														"type": "object",
														"properties": {
															"id": {
																"type": "string",
																"format": "uuid",
																"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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)$"
															},
															"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)$"
																	},
																	"name": {
																		"type": "string"
																	},
																	"status": {
																		"type": "string"
																	},
																	"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"
																			}
																		]
																	},
																	"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"
																			}
																		]
																	},
																	"voided": {
																		"type": "boolean"
																	},
																	"siteKind": {
																		"type": "string",
																		"enum": [
																			"none",
																			"tooth",
																			"root",
																			"implant",
																			"supernumerary",
																			"area"
																		]
																	},
																	"tooth": {
																		"anyOf": [
																			{
																				"type": "integer",
																				"minimum": -9007199254740991,
																				"maximum": 9007199254740991
																			},
																			{
																				"type": "null"
																			}
																		]
																	},
																	"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"
																			}
																		]
																	}
																},
																"required": [
																	"id",
																	"name",
																	"status",
																	"serviceDate",
																	"practitionerId",
																	"voided",
																	"siteKind",
																	"tooth",
																	"area"
																],
																"additionalProperties": false
															},
															"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": {
																"type": [
																	"string",
																	"null"
																]
															},
															"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"
																	}
																]
															},
															"variantId": {
																"anyOf": [
																	{
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"manufacturer": {
																"type": [
																	"string",
																	"null"
																]
															},
															"product": {
																"type": [
																	"string",
																	"null"
																]
															},
															"gtin": {
																"type": [
																	"string",
																	"null"
																]
															},
															"lot": {
																"type": [
																	"string",
																	"null"
																]
															},
															"serial": {
																"type": [
																	"string",
																	"null"
																]
															},
															"expiryOn": {
																"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"
																	}
																]
															},
															"size": {
																"type": [
																	"string",
																	"null"
																]
															},
															"source": {
																"type": "string",
																"enum": [
																	"scan",
																	"manual",
																	"shop"
																]
															},
															"correctsId": {
																"anyOf": [
																	{
																		"type": "string",
																		"format": "uuid",
																		"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
																	},
																	{
																		"type": "null"
																	}
																]
															},
															"enteredInError": {
																"type": "boolean"
															},
															"correctionReason": {
																"type": [
																	"string",
																	"null"
																]
															},
															"recordedByName": {
																"type": [
																	"string",
																	"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",
															"procedureId",
															"treatment",
															"siteKind",
															"tooth",
															"root",
															"supernumeraryPosition",
															"area",
															"variantId",
															"manufacturer",
															"product",
															"gtin",
															"lot",
															"serial",
															"expiryOn",
															"size",
															"source",
															"correctsId",
															"enteredInError",
															"correctionReason",
															"recordedByName",
															"createdAt"
														],
														"additionalProperties": false
													}
												},
												"required": [
													"patient",
													"device"
												],
												"additionalProperties": false
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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/clinical-storage/prescription-cleanup": {
			"get": {
				"summary": "Unused prescription PDF cleanup needing review",
				"tags": [
					"Clinical storage"
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"scanError": {
											"type": [
												"string",
												"null"
											]
										},
										"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)$"
													},
													"state": {
														"type": "string",
														"enum": [
															"deleting",
															"dispatched",
															"uncertain",
															"parked",
															"deleted"
														]
													},
													"lastError": {
														"type": [
															"string",
															"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",
													"state",
													"lastError",
													"createdAt"
												],
												"additionalProperties": false
											}
										}
									},
									"required": [
										"scanError",
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/settings/clinical-storage/prescription-cleanup/{id}/replay": {
			"post": {
				"summary": "Replay a parked unused PDF deletion",
				"tags": [
					"Clinical storage"
				],
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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/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": {
											"type": [
												"string",
												"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",
												"unfiled_scan"
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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",
												"unfiled_scan"
											]
										},
										"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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": {
											"type": [
												"string",
												"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, type, jurisdiction and, for an image, its latest details revision (null when none was recorded). 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)$"
						}
					},
					{
						"name": "includeVoided",
						"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/PatientDocumentListItem"
											}
										}
									},
									"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 a document onto a patient",
				"tags": [
					"Clinical storage"
				],
				"description": "multipart/form-data with a single `file` field (any file whose type the bytes name — a picture, camera RAW, DICOM, video, PDF, Office or email file, text, an archive, a 3D file… — stored as received, with Part 10 DICOM filed only as an x-ray or photo; max 32 MiB — the bound is the Worker's memory, not a cost) and the fields `kind` (xray | photo | letter | correspondence | consent | referral | lab | insurance | other; the generated kinds — invoice, statement, signature, prescription, export — are refused with 400), `title`, `takenOn` (optional ISO date) and `locationId`. An x-ray or photo may also carry its first details revision (siteKind, tooth, root, supernumeraryPosition, area, modality, view, appointmentId, procedureId, operatorPractitionerId, justification, qualityGrade), written with the document in one transaction; the operator defaults to the uploader when they are a clinician. Any other field, or details on another kind (400 DETAILS_NOT_AN_IMAGE), is refused: the field list is fixed so the body stays bounded. The type is read from the bytes, a zip's or compound file's from its own directory, never from the browser's claim (415 UNSUPPORTED_MEDIA for one nothing names, or DICOM as another kind: the upload is kept for a person). The object lands in the encrypted clinical store; the same bytes uploaded again onto the same patient as the same kind return the existing document with `alreadyUploaded: true` and write nothing (the details sent are not applied: correct them from Details), so a retry after a lost response is safe; its current details are served, and audited as a clinical read, only to an uploader who may read the patient's documents — anyone else gets its id alone. The same bytes as another kind are refused with 409 DOCUMENT_ALREADY_FILED, whose `details` name the kind they are filed under and when (`{ kind, filedAt }`). 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",
											"letter",
											"correspondence",
											"consent",
											"referral",
											"lab",
											"insurance",
											"other",
											"smileguide_file"
										]
									},
									"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)$"
									},
									"categoryId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"fromFile": {
										"type": "string",
										"pattern": "^(kind|modality|takenOn)(,(kind|modality|takenOn)){0,2}$"
									},
									"siteKind": {
										"type": "string",
										"enum": [
											"none",
											"tooth",
											"root",
											"implant",
											"supernumerary",
											"area"
										]
									},
									"tooth": {
										"type": "string"
									},
									"root": {
										"type": "string",
										"enum": [
											"single",
											"mesial",
											"distal",
											"buccal",
											"lingual",
											"palatal",
											"mesiobuccal",
											"distobuccal",
											"mesiolingual",
											"distolingual"
										]
									},
									"supernumeraryPosition": {
										"type": "string"
									},
									"area": {
										"type": "string",
										"enum": [
											"upper_arch",
											"lower_arch",
											"upper_right",
											"upper_left",
											"lower_right",
											"lower_left",
											"anterior",
											"posterior",
											"full_mouth",
											"soft_tissue"
										]
									},
									"modality": {
										"type": "string",
										"enum": [
											"periapical",
											"bitewing",
											"occlusal",
											"panoramic",
											"cephalometric",
											"cbct",
											"intraoral_photo",
											"extraoral_photo",
											"scan"
										]
									},
									"view": {
										"type": "string"
									},
									"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)$"
									},
									"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)$"
									},
									"operatorPractitionerId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"justification": {
										"type": "string"
									},
									"qualityGrade": {
										"type": "string",
										"enum": [
											"A",
											"N"
										]
									},
									"file": {
										"type": "string",
										"description": "The image or PDF bytes"
									}
								},
								"required": [
									"kind",
									"title",
									"locationId",
									"file"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"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)$"
												},
												"organizationId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^[0-9a-f]{8}-[0-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",
														"voice_recording",
														"smileguide_file"
													]
												},
												"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",
														"scanner",
														"patient_app",
														"lab"
													]
												},
												"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"
													}
												},
												"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": {
													"type": [
														"string",
														"null"
													]
												},
												"voidedByUserId": {
													"type": [
														"string",
														"null"
													]
												},
												"voidedByName": {
													"type": [
														"string",
														"null"
													]
												},
												"correctsId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"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"
														}
													]
												},
												"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"
														}
													]
												},
												"archivedByUserId": {
													"type": [
														"string",
														"null"
													]
												},
												"archivedByName": {
													"type": [
														"string",
														"null"
													]
												},
												"createdById": {
													"type": [
														"string",
														"null"
													]
												},
												"createdByName": {
													"type": [
														"string",
														"null"
													]
												},
												"createdBySource": {
													"type": "string",
													"enum": [
														"user",
														"patient",
														"automation",
														"campaign",
														"ai",
														"api",
														"import",
														"system",
														"lab"
													]
												},
												"createdAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"updatedAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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
												},
												"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",
														"ie"
													]
												},
												"sha256": {
													"type": "string",
													"pattern": "^[0-9a-f]{64}$"
												},
												"dicomSeriesUid": {
													"type": [
														"string",
														"null"
													]
												},
												"details": {
													"anyOf": [
														{
															"$ref": "#/components/schemas/ClinicalImageDetails"
														},
														{
															"type": "null"
														}
													]
												},
												"check": {
													"anyOf": [
														{
															"$ref": "#/components/schemas/ImageCheckSummary"
														},
														{
															"type": "null"
														}
													]
												},
												"preview": {
													"anyOf": [
														{
															"$ref": "#/components/schemas/DocumentPreview"
														},
														{
															"type": "null"
														}
													]
												},
												"alreadyUploaded": {
													"type": "boolean"
												}
											},
											"required": [
												"id",
												"organizationId",
												"patientId",
												"clinicalDocumentId",
												"kind",
												"title",
												"appointmentId",
												"takenOn",
												"source",
												"messageId",
												"tags",
												"voidedAt",
												"voidReason",
												"voidedByUserId",
												"voidedByName",
												"correctsId",
												"categoryId",
												"archivedAt",
												"archivedByUserId",
												"archivedByName",
												"createdById",
												"createdByName",
												"createdBySource",
												"createdAt",
												"updatedAt",
												"mime",
												"bytes",
												"jurisdiction",
												"sha256",
												"dicomSeriesUid",
												"details",
												"check",
												"preview",
												"alreadyUploaded"
											],
											"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)$"
												},
												"alreadyUploaded": {
													"type": "boolean",
													"const": true
												}
											},
											"required": [
												"id",
												"alreadyUploaded"
											],
											"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"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. `patientId` names the record it is opened from: a patient's own document opens from their record, an account's (an invoice, a statement, a payment plan agreement) only from the record of a patient it names, and only while every patient it names is visible — 404 otherwise. Without `patientId` the record is the patient who filed it. The read is audited (04 §2) for every patient the document names.",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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)$"
						}
					}
				],
				"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/cbct-cache-key": {
			"get": {
				"summary": "The key for one patient's CBCT copies on this computer",
				"tags": [
					"Clinical storage"
				],
				"description": "SmileGuide keeps each CBCT file it opens encrypted in the browser's own storage, under this key. It is computed from a server secret on each request and never stored: the same practice and patient always get the same key, anyone else a different one. It is issued under the same door as a document link (patientDocument read, in the member's practice). `organizationId` names the practice the browser's copies are for: another than the member's answers 409 PRACTICE_CHANGED before the patient is looked up. A patient who is missing, another practice's or being erased answers 404, the one answer on which the browser deletes that patient's copies. `purpose=check` makes the same checks and answers 204 with no key; it is not audited. Never cached (`Cache-Control: private, no-store`). Each key issued is audited (04 §2) as a read of the patient's record, for an open or for downloading ahead.",
				"parameters": [
					{
						"name": "organizationId",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^[0-9a-f]{8}-[0-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": "patientId",
						"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": "purpose",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"enum": [
								"open",
								"ahead",
								"check"
							]
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"key": {
											"type": "string",
											"pattern": "^[A-Za-z0-9_-]{43}$"
										},
										"version": {
											"type": "number",
											"const": 1
										}
									},
									"required": [
										"key",
										"version"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/smileguide-segmenter/{build}/{name}": {
			"get": {
				"summary": "SmileGuide's AI segmentation model",
				"tags": [
					"Clinical storage"
				],
				"description": "The model SmileGuide's AI segmentation runs on the member's own graphics card (DentalSegmentator, CC BY 4.0, converted to ONNX), by its build and name: the whole file, or one `Range: bytes=` window of it (206; 416 past its end). Only the current build is served. A build's file never changes, so the browser may keep it for a year; SmileGuide checks its SHA-256 before it reads it. 503 SMILEGUIDE_SEGMENTER_UNAVAILABLE while the file isn't in place, and SmileGuide's automatic tools then work as before. Needs `patientDocument:read`, the door SmileGuide's scans come through; no patient's data reaches this route.",
				"parameters": [
					{
						"name": "build",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"const": "dentalsegmentator-v1.0.0-fp16w-a4a2b7f8"
						}
					},
					{
						"name": "name",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"const": "dentalsegmentator-v100-fp16w.onnx"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string",
									"format": "binary"
								}
							}
						}
					},
					"206": {
						"description": "Partial Content",
						"content": {
							"application/octet-stream": {
								"schema": {
									"type": "string",
									"format": "binary"
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"416": {
						"description": "Range Not Satisfiable"
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/smileguide-plans": {
			"get": {
				"summary": "A patient's SmileGuide plans",
				"tags": [
					"Clinical storage"
				],
				"description": "Every current plan (one per CBCT) and saved version of the patient, the most recently changed first, without the plans themselves. `canSave`: the member may upload the patient's documents and the practice has a site to keep the plan under (`locationId`, the patient's own site, else the practice's first; null when it has none). 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": {
										"canSave": {
											"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"
												}
											]
										},
										"items": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SmileGuidePlanSummary"
											}
										}
									},
									"required": [
										"canSave",
										"locationId",
										"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": "Save a CBCT's current SmileGuide plan",
				"tags": [
					"Clinical storage"
				],
				"description": "SmileGuide's autosave. `expectedRevision` 0 makes the CBCT's first current plan; otherwise the save replaces the plan only while its revision is still the one named, and moves it on by one. A save that finds another revision answers 409 SMILEGUIDE_PLAN_CONFLICT with the plan as it stands (`details`: id, revision, updatedAt, updatedByName) and writes nothing. A retry of a save that already landed (the same `writeId` made the current revision) answers 200 with it, writing nothing. The body is at most 5 MiB and the plan's JSON (compact UTF-8) at most 4 MiB (413 PAYLOAD_TOO_LARGE, nothing written), naming at most 4096 files — finite Worker memory, not a cost. Every file's digest must be a live, landed document of this patient (any kind, archived ones included); otherwise 409 SMILEGUIDE_PLAN_FILES_MISSING names the digests (`details.sha256`) and nothing is written. The site is set from the patient's. 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": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"volumeKey": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1024
									},
									"seriesUid": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 64,
												"pattern": "^[0-9]+(\\.[0-9]+)*$"
											},
											{
												"type": "null"
											}
										]
									},
									"plan": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									},
									"files": {
										"maxItems": 4096,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SmileGuideManifestFile"
										}
									},
									"expectedRevision": {
										"type": "integer",
										"minimum": 0,
										"maximum": 2147483647
									},
									"writeId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
									"volumeKey",
									"seriesUid",
									"plan",
									"files",
									"expectedRevision",
									"writeId"
								]
							}
						}
					}
				},
				"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)$"
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"revision",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/smileguide-plans/{id}": {
			"get": {
				"summary": "One SmileGuide plan",
				"tags": [
					"Clinical storage"
				],
				"description": "The plan as saved, with each file it reads and the patient document holding those bytes now — only a live, landed document of this patient, of any kind; null when there is none. Another patient's or practice's plan answers 404 NOT_FOUND. 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)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{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)$"
										},
										"volumeKey": {
											"type": "string"
										},
										"seriesUid": {
											"type": [
												"string",
												"null"
											]
										},
										"label": {
											"type": [
												"string",
												"null"
											]
										},
										"revision": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"implants": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"reduced": {
											"type": [
												"number",
												"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))$"
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"plan": {},
										"files": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SmileGuidePlanFile"
											}
										}
									},
									"required": [
										"id",
										"volumeKey",
										"seriesUid",
										"label",
										"revision",
										"implants",
										"reduced",
										"createdAt",
										"createdByName",
										"updatedAt",
										"updatedByName",
										"plan",
										"files"
									],
									"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"
								}
							}
						}
					}
				}
			},
			"delete": {
				"summary": "Delete a saved SmileGuide version",
				"tags": [
					"Clinical storage"
				],
				"description": "Versions only: the current plan answers 409 SMILEGUIDE_PLAN_CURRENT. Another patient's or practice's plan answers 404 NOT_FOUND. 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)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/smileguide-plans/versions": {
			"post": {
				"summary": "Save a SmileGuide plan as a named version",
				"tags": [
					"Clinical storage"
				],
				"description": "A version is kept beside the current plan under its name until a person deletes it. The body is at most 5 MiB and the plan's JSON (compact UTF-8) at most 4 MiB (413 PAYLOAD_TOO_LARGE, nothing written), naming at most 4096 files — finite Worker memory, not a cost. Every file's digest must be a live, landed document of this patient (any kind, archived ones included); otherwise 409 SMILEGUIDE_PLAN_FILES_MISSING names the digests (`details.sha256`) and nothing is written. 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": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"volumeKey": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1024
									},
									"seriesUid": {
										"anyOf": [
											{
												"type": "string",
												"maxLength": 64,
												"pattern": "^[0-9]+(\\.[0-9]+)*$"
											},
											{
												"type": "null"
											}
										]
									},
									"plan": {
										"type": "object",
										"propertyNames": {
											"type": "string"
										},
										"additionalProperties": {}
									},
									"files": {
										"maxItems": 4096,
										"type": "array",
										"items": {
											"$ref": "#/components/schemas/SmileGuideManifestFile"
										}
									},
									"label": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"required": [
									"volumeKey",
									"seriesUid",
									"plan",
									"files",
									"label"
								]
							}
						}
					}
				},
				"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)$"
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"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"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/smileguide-plans/{id}/copy-as-version": {
			"post": {
				"summary": "Keep a saved SmileGuide plan as a named version",
				"tags": [
					"Clinical storage"
				],
				"description": "Copies one of the patient's plans, as saved, into a new version — its files are not checked again, so a plan whose file is no longer on the record can still be kept. A plan whose revision is no longer the one named answers 409 SMILEGUIDE_PLAN_CONFLICT with the plan as it stands. 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)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-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,
										"maxLength": 200
									},
									"expectedRevision": {
										"type": "integer",
										"minimum": 1,
										"maximum": 2147483647
									}
								},
								"required": [
									"label",
									"expectedRevision"
								]
							}
						}
					}
				},
				"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)$"
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										}
									},
									"required": [
										"id",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{patientId}/file-shares": {
			"get": {
				"summary": "The patient's shared-files links",
				"tags": [
					"Clinical storage"
				],
				"description": "Newest first: live, expired and turned-off links alike.",
				"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/PatientFileShare"
											}
										}
									},
									"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": "Share some of a patient's files by link",
				"tags": [
					"Clinical storage"
				],
				"description": "Mints a long unguessable link that opens the files without signing in until it expires (1, 2 or 3 months) or is turned off. Every document must be this patient's own filed, unvoided document, and every patient it names must be visible. The link is written to the patient's 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)$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"documentIds": {
										"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)$"
										}
									},
									"recipient": {
										"type": "string",
										"minLength": 1,
										"maxLength": 120
									},
									"note": {
										"type": "string",
										"minLength": 1,
										"maxLength": 1000
									},
									"months": {
										"type": "number",
										"enum": [
											1,
											2,
											3
										]
									}
								},
								"required": [
									"documentIds",
									"recipient",
									"months"
								]
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"share": {
											"$ref": "#/components/schemas/PatientFileShare"
										},
										"url": {
											"type": "string",
											"format": "uri"
										}
									},
									"required": [
										"share",
										"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"
								}
							}
						}
					},
					"413": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{patientId}/file-shares/{id}/link": {
			"get": {
				"summary": "A live shared-files link, to copy again",
				"tags": [
					"Clinical storage"
				],
				"description": "410 once the link has expired or been turned off; 409 LAB_LINK_OWNED for a lab order's link, which its case manages.",
				"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": {
										"url": {
											"type": "string",
											"format": "uri"
										},
										"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": [
										"url",
										"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"
								}
							}
						}
					},
					"410": {
						"description": "Gone",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/patients/{patientId}/file-shares/{id}/turn-off": {
			"post": {
				"summary": "Turn off a shared-files link",
				"tags": [
					"Clinical storage"
				],
				"description": "The link stops opening at once, and so does every file link it already handed out. Turning off a link that is already off or expired answers it as it is. 409 LAB_LINK_OWNED for a lab order's link, which its case manages.",
				"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)$"
										},
										"recipient": {
											"type": "string"
										},
										"note": {
											"type": [
												"string",
												"null"
											]
										},
										"fileCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"state": {
											"type": "string",
											"enum": [
												"live",
												"expired",
												"turned_off"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"createdByName": {
											"type": [
												"string",
												"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))$"
										},
										"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"
												}
											]
										},
										"revokedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"openCount": {
											"type": "integer",
											"minimum": 0,
											"maximum": 9007199254740991
										},
										"lastOpenedAt": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"recipient",
										"note",
										"fileCount",
										"state",
										"createdAt",
										"createdByName",
										"expiresAt",
										"revokedAt",
										"revokedByName",
										"openCount",
										"lastOpenedAt"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/sf": {
			"get": {
				"summary": "Open a shared-files link",
				"tags": [
					"Shared patient files (recipient)"
				],
				"description": "Authorization: Bearer <token>. Counts the open and writes it to the patient's History. `view=practice` is the practice's own look at its lab's page: written to the History, never counted as the lab's open. 404: no such link. 410: the link expired or was turned off; `details` carries `reason` and the practice's name and email.",
				"security": [],
				"parameters": [
					{
						"name": "view",
						"in": "query",
						"required": false,
						"schema": {
							"type": "string",
							"const": "practice"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"practice": {
											"type": "object",
											"properties": {
												"name": {
													"type": "string"
												},
												"phone": {
													"type": [
														"string",
														"null"
													]
												},
												"email": {
													"type": [
														"string",
														"null"
													]
												}
											},
											"required": [
												"name",
												"phone",
												"email"
											],
											"additionalProperties": false
										},
										"patient": {
											"type": "object",
											"properties": {
												"name": {
													"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"
														}
													]
												}
											},
											"required": [
												"name",
												"dateOfBirth"
											],
											"additionalProperties": false
										},
										"recipient": {
											"type": "string"
										},
										"note": {
											"type": [
												"string",
												"null"
											]
										},
										"sharedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"sharedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
											"anyOf": [
												{
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												{
													"type": "null"
												}
											]
										},
										"files": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/SharedFile"
											}
										},
										"zip": {
											"type": "object",
											"properties": {
												"parts": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"alone": {
													"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)$"
													}
												},
												"scans": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"series": {
																"type": "string"
															},
															"parts": {
																"type": "integer",
																"minimum": 0,
																"maximum": 9007199254740991
															}
														},
														"required": [
															"series",
															"parts"
														],
														"additionalProperties": false
													}
												}
											},
											"required": [
												"parts",
												"alone",
												"scans"
											],
											"additionalProperties": false
										}
									},
									"required": [
										"practice",
										"patient",
										"recipient",
										"note",
										"sharedByName",
										"sharedAt",
										"expiresAt",
										"files",
										"zip"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/sf/files/{documentId}/link": {
			"post": {
				"summary": "A one-minute read link for one shared file",
				"tags": [
					"Shared patient files (recipient)"
				],
				"description": "Authorization: Bearer <token>. The view is written to the patient's History; the content route checks the link is still live before a byte leaves.",
				"security": [],
				"parameters": [
					{
						"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
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/sf/zip-link": {
			"post": {
				"summary": "A one-minute link to download one part of the shared files",
				"tags": [
					"Shared patient files (recipient)"
				],
				"description": "Authorization: Bearer <token>. `part` counts from 0. With `series`, the parts are those of that scan's files alone (`zip.scans`); a series not among the link's files is 404. The browser opens the returned path to stream a stored ZIP.",
				"security": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"part": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"series": {
										"type": "string",
										"maxLength": 64,
										"pattern": "^[0-9]+(\\.[0-9]+)*$"
									}
								},
								"required": [
									"part"
								]
							}
						}
					}
				},
				"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
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/{id}/void": {
			"post": {
				"summary": "Mark a document entered in error",
				"tags": [
					"Clinical storage"
				],
				"description": "Withdraws the document under the member's name and the reason; it stays as history, left out of the list unless includeVoided=true. An invoice, credit note, statement or agreement is corrected through its own document, and a signature a form or plan acceptance cites is evidence: both answer 409 DOCUMENT_IS_EVIDENCE.",
				"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": 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"
										},
										"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",
												"voice_recording",
												"smileguide_file"
											]
										},
										"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",
												"scanner",
												"patient_app",
												"lab"
											]
										},
										"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"
											}
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"voidedByUserId": {
											"type": [
												"string",
												"null"
											]
										},
										"voidedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"correctsId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"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"
												}
											]
										},
										"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"
												}
											]
										},
										"archivedByUserId": {
											"type": [
												"string",
												"null"
											]
										},
										"archivedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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",
										"voidedAt",
										"voidReason",
										"voidedByUserId",
										"voidedByName",
										"correctsId",
										"categoryId",
										"archivedAt",
										"archivedByUserId",
										"archivedByName",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes"
									],
									"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}/{id}/refile": {
			"post": {
				"summary": "Move a misfiled document to the right patient",
				"tags": [
					"Clinical storage"
				],
				"description": "Copies the document onto the right patient — under that patient's own retention and legal holds — and then marks it entered in error here; neither record names the other. A retry finds the copy instead of making a second one. Another patient only (409 DOCUMENT_SAME_PATIENT); evidence documents answer 409 DOCUMENT_IS_EVIDENCE, as for a void. The write is audited with both ids.",
				"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": {
									"targetPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
									},
									"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": [
									"targetPatientId",
									"reason",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"voided": {
											"$ref": "#/components/schemas/PatientDocument"
										},
										"copy": {
											"$ref": "#/components/schemas/PatientDocument"
										}
									},
									"required": [
										"voided",
										"copy"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/{id}/kind": {
			"post": {
				"summary": "Change an image between x-ray and photo",
				"tags": [
					"Clinical storage"
				],
				"description": "Clinical command `change_image_kind`: the image is marked entered in error (\"Filed as x-ray, changed to photo\") and the same bytes are filed again on the same patient as the other kind, at a site of the jurisdiction it was filed under, replacing it (`correctsId`). Its visit, treatment, teeth, date taken and the rest of its details stay, but for a type that does not fit the new kind and, on a photo or outside the UK, the IR(ME)R justification and grade; the copy gets its own image check. The kind it already has answers 409 DOCUMENT_SAME_KIND, a document that is not an x-ray or photo 409 NOT_AN_IMAGE. A retry of a committed command (same `id`) answers 200 with the first response (409 ID_TAKEN when the id names a different command); a new command on an image already changed answers its replacement only while that is still of the kind asked for, else 409 DOCUMENT_VOIDED. Audited with both ids.",
				"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": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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"
										]
									}
								},
								"required": [
									"id",
									"kind"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"voided": {
											"$ref": "#/components/schemas/PatientDocument"
										},
										"copy": {
											"$ref": "#/components/schemas/PatientDocument"
										}
									},
									"required": [
										"voided",
										"copy"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/{id}/category": {
			"patch": {
				"summary": "Set or clear a document's category",
				"tags": [
					"Clinical storage"
				],
				"description": "A label only: the document's kind, source, custody, read access, signature and retention are untouched. The category must be the practice's and not archived, unless it is the one the document already has (422 DOCUMENT_CATEGORY_INVALID). A document marked entered in error takes none (409 DOCUMENT_VOIDED). A token other than the document's `updatedAt` is 409 DOCUMENT_CONFLICT with the current document in `details.current`. Audited with the before and after values.",
				"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": {
									"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"
											}
										]
									},
									"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": [
									"categoryId",
									"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)$"
										},
										"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",
												"voice_recording",
												"smileguide_file"
											]
										},
										"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",
												"scanner",
												"patient_app",
												"lab"
											]
										},
										"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"
											}
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"voidedByUserId": {
											"type": [
												"string",
												"null"
											]
										},
										"voidedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"correctsId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"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"
												}
											]
										},
										"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"
												}
											]
										},
										"archivedByUserId": {
											"type": [
												"string",
												"null"
											]
										},
										"archivedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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",
										"voidedAt",
										"voidReason",
										"voidedByUserId",
										"voidedByName",
										"correctsId",
										"categoryId",
										"archivedAt",
										"archivedByUserId",
										"archivedByName",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/{id}/archive": {
			"post": {
				"summary": "Archive or restore an image",
				"tags": [
					"Clinical storage"
				],
				"description": "Chart › Images' archive: the x-ray or photo is hidden from the default view under the member's name, or shown again. Nothing else about it changes, and it is not marked entered in error. Another kind of document answers 409 NOT_AN_IMAGE, one marked entered in error 409 DOCUMENT_VOIDED; asking for the state it already has changes nothing. Audited with the before and after values.",
				"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": {
									"archived": {
										"type": "boolean"
									}
								},
								"required": [
									"archived"
								]
							}
						}
					}
				},
				"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)$"
										},
										"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",
												"voice_recording",
												"smileguide_file"
											]
										},
										"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",
												"scanner",
												"patient_app",
												"lab"
											]
										},
										"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"
											}
										},
										"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": {
											"type": [
												"string",
												"null"
											]
										},
										"voidedByUserId": {
											"type": [
												"string",
												"null"
											]
										},
										"voidedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"correctsId": {
											"anyOf": [
												{
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
												},
												{
													"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"
												}
											]
										},
										"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"
												}
											]
										},
										"archivedByUserId": {
											"type": [
												"string",
												"null"
											]
										},
										"archivedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdById": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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",
										"voidedAt",
										"voidReason",
										"voidedByUserId",
										"voidedByName",
										"correctsId",
										"categoryId",
										"archivedAt",
										"archivedByUserId",
										"archivedByName",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"mime",
										"bytes"
									],
									"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}/series/{seriesUid}/archive": {
			"post": {
				"summary": "Archive or restore a whole scan",
				"tags": [
					"Clinical storage"
				],
				"description": "Chart › Images' archive for a CBCT shown as one scan: every live x-ray or photo of the patient whose DICOM series is this one is archived (or restored) in one transaction under the member's name, each change audited as the single image's archive is. The server reads which files are the scan's at the request; asking again changes nothing, so a retry after a lost answer is safe. A series the patient has no live image of answers 404.",
				"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": "seriesUid",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"maxLength": 64,
							"pattern": "^[0-9]+(\\.[0-9]+)*$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"archived": {
										"type": "boolean"
									}
								},
								"required": [
									"archived"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"documents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"changed": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"documents",
										"changed"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/series/{seriesUid}/void": {
			"post": {
				"summary": "Mark a whole scan entered in error",
				"tags": [
					"Clinical storage"
				],
				"description": "A CBCT shown as one scan, withdrawn whole: every live x-ray or photo of the patient whose DICOM series is this one is marked entered in error under the member's name and the reason, in one transaction, each audited as a single document's void is. Each stays as history. The server reads which files are the scan's at the request. A series the patient has no live image of answers 404, as asking again does once the scan is 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": "seriesUid",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"maxLength": 64,
							"pattern": "^[0-9]+(\\.[0-9]+)*$"
						}
					}
				],
				"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": {
										"documents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"documents"
									],
									"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}/series/{seriesUid}/refile": {
			"post": {
				"summary": "Move a whole scan to the right patient",
				"tags": [
					"Clinical storage"
				],
				"description": "A CBCT shown as one scan, moved whole: each live x-ray or photo of the patient whose DICOM series is this one moves as a single document's refile moves it — copied onto the right patient under their own retention and legal holds, then marked entered in error here, audited with both ids — and keeps its series, so it is one scan there too. A request moves a slice of the files, as many as one request can copy, and answers how many remain: the caller asks again until none do. Each file's move is final once made, so a request cut short loses nothing, and asking again moves the rest. Another patient only (409 DOCUMENT_SAME_PATIENT). A series the patient has no live image of answers 404.",
				"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": "seriesUid",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"maxLength": 64,
							"pattern": "^[0-9]+(\\.[0-9]+)*$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"targetPatientId": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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
									},
									"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": [
									"targetPatientId",
									"reason",
									"locationId"
								]
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"documents": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"moved": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										},
										"remaining": {
											"type": "integer",
											"minimum": -9007199254740991,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"documents",
										"moved",
										"remaining"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/parked": {
			"get": {
				"summary": "Uploads kept for a person",
				"tags": [
					"Clinical storage"
				],
				"description": "Uploads onto the patient that could not be filed — a field, kind, category or type refused, or the database unavailable — kept with their bytes, encrypted under the practice's clinical key, until a person retries, files them as another kind or category, or discards them; the patient's erasure takes them too. Oldest 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/ParkedUpload"
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/parked/{id}/retry": {
			"post": {
				"summary": "File a kept upload",
				"tags": [
					"Clinical storage"
				],
				"description": "Files the kept bytes exactly as a fresh upload would (same checks, same answers), with any File as… choice applied. Filed once: the upload is settled and its staged copy removed. A refusal answers as the upload would and keeps 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": {
									"kind": {
										"type": "string",
										"enum": [
											"xray",
											"photo",
											"letter",
											"correspondence",
											"consent",
											"referral",
											"lab",
											"insurance",
											"other"
										]
									},
									"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"
											}
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"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)$"
									}
								}
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"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)$"
												},
												"organizationId": {
													"type": "string",
													"format": "uuid",
													"pattern": "^[0-9a-f]{8}-[0-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",
														"voice_recording",
														"smileguide_file"
													]
												},
												"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",
														"scanner",
														"patient_app",
														"lab"
													]
												},
												"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"
													}
												},
												"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": {
													"type": [
														"string",
														"null"
													]
												},
												"voidedByUserId": {
													"type": [
														"string",
														"null"
													]
												},
												"voidedByName": {
													"type": [
														"string",
														"null"
													]
												},
												"correctsId": {
													"anyOf": [
														{
															"type": "string",
															"format": "uuid",
															"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
														},
														{
															"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"
														}
													]
												},
												"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"
														}
													]
												},
												"archivedByUserId": {
													"type": [
														"string",
														"null"
													]
												},
												"archivedByName": {
													"type": [
														"string",
														"null"
													]
												},
												"createdById": {
													"type": [
														"string",
														"null"
													]
												},
												"createdByName": {
													"type": [
														"string",
														"null"
													]
												},
												"createdBySource": {
													"type": "string",
													"enum": [
														"user",
														"patient",
														"automation",
														"campaign",
														"ai",
														"api",
														"import",
														"system",
														"lab"
													]
												},
												"createdAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
												},
												"updatedAt": {
													"type": "string",
													"format": "date-time",
													"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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
												},
												"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",
														"ie"
													]
												},
												"sha256": {
													"type": "string",
													"pattern": "^[0-9a-f]{64}$"
												},
												"dicomSeriesUid": {
													"type": [
														"string",
														"null"
													]
												},
												"details": {
													"anyOf": [
														{
															"$ref": "#/components/schemas/ClinicalImageDetails"
														},
														{
															"type": "null"
														}
													]
												},
												"check": {
													"anyOf": [
														{
															"$ref": "#/components/schemas/ImageCheckSummary"
														},
														{
															"type": "null"
														}
													]
												},
												"preview": {
													"anyOf": [
														{
															"$ref": "#/components/schemas/DocumentPreview"
														},
														{
															"type": "null"
														}
													]
												},
												"alreadyUploaded": {
													"type": "boolean"
												}
											},
											"required": [
												"id",
												"organizationId",
												"patientId",
												"clinicalDocumentId",
												"kind",
												"title",
												"appointmentId",
												"takenOn",
												"source",
												"messageId",
												"tags",
												"voidedAt",
												"voidReason",
												"voidedByUserId",
												"voidedByName",
												"correctsId",
												"categoryId",
												"archivedAt",
												"archivedByUserId",
												"archivedByName",
												"createdById",
												"createdByName",
												"createdBySource",
												"createdAt",
												"updatedAt",
												"mime",
												"bytes",
												"jurisdiction",
												"sha256",
												"dicomSeriesUid",
												"details",
												"check",
												"preview",
												"alreadyUploaded"
											],
											"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)$"
												},
												"alreadyUploaded": {
													"type": "boolean",
													"const": true
												}
											},
											"required": [
												"id",
												"alreadyUploaded"
											],
											"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"
								}
							}
						}
					},
					"415": {
						"description": "",
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/parked/{id}/discard": {
			"post": {
				"summary": "Discard a kept upload",
				"tags": [
					"Clinical storage"
				],
				"description": "A person's decision, with why: the kept bytes are deleted and the upload is settled as discarded. Audited.",
				"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": {
									"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": [
												"resolved",
												"discarded"
											]
										}
									},
									"required": [
										"id",
										"state"
									],
									"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}/upload-sessions": {
			"post": {
				"summary": "Start an upload in parts",
				"tags": [
					"Clinical storage"
				],
				"description": "Opens a staged upload for one file of any size and any type the upload route files (a 3D file, or anything over what the route takes at once), sent in parts. The fields are the upload form's (`kind`, `title`, `locationId`, … — for a 3D file in Images, kind `photo` with modality `scan`), refused with 400 as the upload route refuses them; a type nothing names parks as `unsupported_type`, its bytes kept. Answers the part size and count. 404 PATIENT_ERASED for a patient erased or being erased.",
				"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": {
									"fileName": {
										"type": "string",
										"minLength": 1,
										"maxLength": 255
									},
									"bytes": {
										"type": "integer",
										"exclusiveMinimum": 0,
										"maximum": 9007199254740991
									},
									"fields": {
										"type": "object",
										"propertyNames": {
											"type": "string",
											"enum": [
												"kind",
												"title",
												"takenOn",
												"locationId",
												"categoryId",
												"fromFile",
												"siteKind",
												"tooth",
												"root",
												"supernumeraryPosition",
												"area",
												"modality",
												"view",
												"appointmentId",
												"procedureId",
												"operatorPractitionerId",
												"justification",
												"qualityGrade"
											]
										},
										"additionalProperties": {
											"type": "string",
											"maxLength": 1000
										}
									}
								},
								"required": [
									"fileName",
									"bytes",
									"fields"
								],
								"additionalProperties": false
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"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)$"
										},
										"partSize": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										},
										"parts": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"sessionId",
										"partSize",
										"parts"
									],
									"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"
								}
							}
						}
					},
					"422": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"get": {
				"summary": "A patient's unfinished and kept 3D uploads",
				"tags": [
					"Clinical storage"
				],
				"description": "Uploads being sent (with the parts already stored and each one's SHA-256, for Resume), being filed, or kept for a person with their reason, oldest first. A filed upload leaves the list: its document is in the record. 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": {
												"type": "object",
												"properties": {
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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": [
															"uploading",
															"finalizing",
															"parked"
														]
													},
													"fileName": {
														"type": "string"
													},
													"declaredBytes": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"partSize": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"parts": {
														"type": "integer",
														"exclusiveMinimum": 0,
														"maximum": 9007199254740991
													},
													"storedParts": {
														"type": "array",
														"items": {
															"type": "object",
															"properties": {
																"partNumber": {
																	"type": "integer",
																	"exclusiveMinimum": 0,
																	"maximum": 9007199254740991
																},
																"sha256": {
																	"type": "string",
																	"pattern": "^[0-9a-f]{64}$"
																}
															},
															"required": [
																"partNumber",
																"sha256"
															],
															"additionalProperties": false
														}
													},
													"receivedBytes": {
														"type": "integer",
														"minimum": 0,
														"maximum": 9007199254740991
													},
													"parkedReason": {
														"anyOf": [
															{
																"type": "string",
																"enum": [
																	"unsupported_type",
																	"too_large",
																	"filing_refused",
																	"already_filed",
																	"patient_merged",
																	"attempts_exhausted",
																	"dead_lettered"
																]
															},
															{
																"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",
													"state",
													"fileName",
													"declaredBytes",
													"partSize",
													"parts",
													"storedParts",
													"receivedBytes",
													"parkedReason",
													"createdAt"
												],
												"additionalProperties": false
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/upload-sessions/{id}/parts/{n}": {
			"put": {
				"summary": "Send one part of a 3D upload",
				"tags": [
					"Clinical storage"
				],
				"description": "The raw body is part `n` (from 1): `Content-Length` must be its exact size (`partSize`, the remainder for the last), and the query's `sha256` its SHA-256 as 64 lowercase hex. The bytes are stored only if they match that digest (422 UPLOAD_PART_DIGEST_MISMATCH otherwise, nothing stored). A part already stored with the same digest answers 200 and writes nothing; any other digest for a part already sent is refused with 409 UPLOAD_PART_DIGEST_CONFLICT and never overwrites it. 409 UPLOAD_SESSION_CLOSED once the upload is complete or discarded; 503 UPLOAD_PART_NOT_STORED when the part could not be stored — send it again.",
				"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": "n",
						"in": "path",
						"required": true,
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 10000
						}
					},
					{
						"name": "sha256",
						"in": "query",
						"required": true,
						"schema": {
							"type": "string",
							"pattern": "^[0-9a-f]{64}$"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/octet-stream": {
							"schema": {
								"type": "string",
								"description": "The part's bytes",
								"format": "binary"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"partNumber": {
											"type": "integer",
											"exclusiveMinimum": 0,
											"maximum": 9007199254740991
										}
									},
									"required": [
										"partNumber"
									],
									"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"
								}
							}
						}
					},
					"503": {
						"description": "Service Unavailable",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/upload-sessions/{id}/complete": {
			"post": {
				"summary": "Finish sending a 3D upload",
				"tags": [
					"Clinical storage"
				],
				"description": "Every part stored: the upload is filed in the background, and the answer comes at once (202, `finalizing`); poll the list until it leaves it (filed) or parks with its reason. 409 UPLOAD_PARTS_MISSING `{ missing }` names the parts still to send. Completing again answers the upload as it is.",
				"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": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"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)$"
												},
												"state": {
													"type": "string",
													"enum": [
														"uploading",
														"finalizing",
														"parked"
													]
												},
												"fileName": {
													"type": "string"
												},
												"declaredBytes": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												"partSize": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												"parts": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												"storedParts": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"partNumber": {
																"type": "integer",
																"exclusiveMinimum": 0,
																"maximum": 9007199254740991
															},
															"sha256": {
																"type": "string",
																"pattern": "^[0-9a-f]{64}$"
															}
														},
														"required": [
															"partNumber",
															"sha256"
														],
														"additionalProperties": false
													}
												},
												"receivedBytes": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"parkedReason": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"unsupported_type",
																"too_large",
																"filing_refused",
																"already_filed",
																"patient_merged",
																"attempts_exhausted",
																"dead_lettered"
															]
														},
														{
															"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",
												"state",
												"fileName",
												"declaredBytes",
												"partSize",
												"parts",
												"storedParts",
												"receivedBytes",
												"parkedReason",
												"createdAt"
											],
											"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)$"
												},
												"state": {
													"type": "string",
													"const": "filed"
												},
												"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)$"
												}
											},
											"required": [
												"id",
												"state",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/upload-sessions/{id}/retry": {
			"post": {
				"summary": "File a kept 3D upload again",
				"tags": [
					"Clinical storage"
				],
				"description": "A parked upload is filed again in the background (202), with any File as… choice applied (an empty body keeps the last one); its fields are checked first, as the upload route checks them. 409 UPLOAD_SESSION_NOT_PARKED otherwise.",
				"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": [
											"xray",
											"photo",
											"letter",
											"correspondence",
											"consent",
											"referral",
											"lab",
											"insurance",
											"other"
										]
									},
									"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"
											}
										]
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									},
									"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)$"
									}
								}
							}
						}
					}
				},
				"responses": {
					"202": {
						"description": "Accepted",
						"content": {
							"application/json": {
								"schema": {
									"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)$"
												},
												"state": {
													"type": "string",
													"enum": [
														"uploading",
														"finalizing",
														"parked"
													]
												},
												"fileName": {
													"type": "string"
												},
												"declaredBytes": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												"partSize": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												"parts": {
													"type": "integer",
													"exclusiveMinimum": 0,
													"maximum": 9007199254740991
												},
												"storedParts": {
													"type": "array",
													"items": {
														"type": "object",
														"properties": {
															"partNumber": {
																"type": "integer",
																"exclusiveMinimum": 0,
																"maximum": 9007199254740991
															},
															"sha256": {
																"type": "string",
																"pattern": "^[0-9a-f]{64}$"
															}
														},
														"required": [
															"partNumber",
															"sha256"
														],
														"additionalProperties": false
													}
												},
												"receivedBytes": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"parkedReason": {
													"anyOf": [
														{
															"type": "string",
															"enum": [
																"unsupported_type",
																"too_large",
																"filing_refused",
																"already_filed",
																"patient_merged",
																"attempts_exhausted",
																"dead_lettered"
															]
														},
														{
															"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",
												"state",
												"fileName",
												"declaredBytes",
												"partSize",
												"parts",
												"storedParts",
												"receivedBytes",
												"parkedReason",
												"createdAt"
											],
											"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)$"
												},
												"state": {
													"type": "string",
													"const": "filed"
												},
												"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)$"
												}
											},
											"required": [
												"id",
												"state",
												"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"
								}
							}
						}
					},
					"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"
								}
							}
						}
					}
				}
			}
		},
		"/documents/patient/{patientId}/upload-sessions/{id}/discard": {
			"post": {
				"summary": "Discard a 3D upload",
				"tags": [
					"Clinical storage"
				],
				"description": "A person's decision on an unfinished or kept upload, with why: it is removed and every byte received goes. 409 UPLOAD_SESSION_BUSY while it is being filed. Audited with the 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": {
									"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)$"
										}
									},
									"required": [
										"id"
									],
									"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}/upload-sessions/{id}/content": {
			"get": {
				"summary": "Download a kept 3D upload",
				"tags": [
					"Clinical storage"
				],
				"description": "The kept file's bytes exactly as received, streamed part by part, as a download. Only a parked upload (409 UPLOAD_SESSION_NOT_PARKED otherwise). 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)$"
						}
					},
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string",
							"format": "uuid",
							"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-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",
									"format": "binary"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/document-categories": {
			"get": {
				"summary": "List document 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/DocumentCategory"
											}
										}
									},
									"required": [
										"items"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ApiError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a document category",
				"tags": [
					"settings"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"label": {
										"type": "string",
										"minLength": 1,
										"maxLength": 80
									},
									"position": {
										"type": "integer",
										"minimum": 0,
										"maximum": 9007199254740991
									},
									"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)$"
									}
								},
								"required": [
									"label",
									"requestId"
								]
							}
						}
					}
				},
				"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"
										},
										"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
								}
							}
						}
					},
					"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/document-categories/{id}": {
			"patch": {
				"summary": "Update a document 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": {
									"label": {
										"type": "string",
										"minLength": 1,
										"maxLength": 80
									},
									"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"
										},
										"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
								}
							}
						}
					},
					"400": {
						"description": "Bad Request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/document-categories/{id}/archive": {
			"post": {
				"summary": "Archive a document 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"
										},
										"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
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/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/document-categories/{id}/restore": {
			"post": {
				"summary": "Restore an archived document 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"
										},
										"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
								}
							}
						}
					},
					"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/document-categories/reorder": {
			"post": {
				"summary": "Reorder document 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/DocumentCategory"
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/episodes/{patientId}": {
			"get": {
				"summary": "A patient's episodes",
				"tags": [
					"Episodes"
				],
				"description": "Every episode of the patient, newest first, with the links and counts the reader may read (a lab case or referral needs its own read grant). Needs treatment-plan read; audited as a clinical read.",
				"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/ClinicalEpisodeDetail"
											}
										}
									},
									"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 episode",
				"tags": [
					"Episodes"
				],
				"description": "Needs treatment-plan authoring, and for each inline link the grant its kind needs (a lab case or referral: manage). A link names the patient's own record (404 otherwise), one not already in another episode (409 EPISODE_LINK_TAKEN with `details.episodeId`). A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command); the replay needs treatment-plan read access and is audited as a read.",
				"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": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
										"minLength": 1,
										"maxLength": 200
									},
									"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)$"
									},
									"openedOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"links": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"type": "string",
													"enum": [
														"treatmentPlan",
														"clinicalReferral",
														"labCase"
													]
												},
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
												"id"
											]
										}
									}
								},
								"required": [
									"id",
									"title",
									"locationId",
									"openedOn"
								]
							}
						}
					}
				},
				"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)$"
										},
										"title": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"closed",
												"entered_in_error"
											]
										},
										"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)$"
										},
										"openedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"closedOn": {
											"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"
												}
											]
										},
										"statusReason": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedById": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"links": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"enum": [
															"treatmentPlan",
															"clinicalReferral",
															"labCase"
														]
													},
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
													"id"
												],
												"additionalProperties": false
											}
										},
										"counts": {
											"type": "object",
											"properties": {
												"treatmentPlan": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"labCase": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"clinicalReferral": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"additionalProperties": false
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"title",
										"status",
										"locationId",
										"openedOn",
										"closedOn",
										"statusReason",
										"statusChangedById",
										"statusChangedByName",
										"statusChangedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"links",
										"counts"
									],
									"additionalProperties": false
								}
							}
						}
					},
					"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)$"
										},
										"title": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"closed",
												"entered_in_error"
											]
										},
										"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)$"
										},
										"openedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"closedOn": {
											"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"
												}
											]
										},
										"statusReason": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedById": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"links": {
											"type": "array",
											"items": {
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"enum": [
															"treatmentPlan",
															"clinicalReferral",
															"labCase"
														]
													},
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
													"id"
												],
												"additionalProperties": false
											}
										},
										"counts": {
											"type": "object",
											"properties": {
												"treatmentPlan": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"labCase": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												},
												"clinicalReferral": {
													"type": "integer",
													"minimum": 0,
													"maximum": 9007199254740991
												}
											},
											"additionalProperties": false
										}
									},
									"required": [
										"id",
										"organizationId",
										"patientId",
										"title",
										"status",
										"locationId",
										"openedOn",
										"closedOn",
										"statusReason",
										"statusChangedById",
										"statusChangedByName",
										"statusChangedAt",
										"createdById",
										"createdByName",
										"createdBySource",
										"createdAt",
										"updatedAt",
										"links",
										"counts"
									],
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/episodes/{patientId}/{id}/timeline": {
			"get": {
				"summary": "An episode's timeline",
				"tags": [
					"Episodes"
				],
				"description": "Newest first, one row per record (a lab case reached both directly and through a treatment appears once), a page at a time: the page size bounds one read, never the whole — follow `nextCursor` to the end. Each kind shows only to a reader holding its read grant (procedure, appointment, clinical note, lab case, referral, patient document). Audited as a clinical read.",
				"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": "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/EpisodeTimelineItem"
											}
										},
										"nextCursor": {
											"type": [
												"string",
												"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"
								}
							}
						}
					}
				}
			}
		},
		"/episodes/{patientId}/{id}/open": {
			"get": {
				"summary": "What an episode still has open",
				"tags": [
					"Episodes"
				],
				"description": "Plans not completed, declined or cancelled; lab cases not fitted, returned or cancelled; referrals not completed, rejected or cancelled — those the reader may read. Shown before Close; closing changes none of them. Audited as a clinical read.",
				"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": {
												"type": "object",
												"properties": {
													"kind": {
														"type": "string",
														"enum": [
															"plan",
															"labCase",
															"referral"
														]
													},
													"id": {
														"type": "string",
														"format": "uuid",
														"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
													},
													"label": {
														"type": [
															"string",
															"null"
														]
													},
													"status": {
														"type": "string"
													}
												},
												"required": [
													"kind",
													"id",
													"label",
													"status"
												],
												"additionalProperties": false
											}
										}
									},
									"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"
								}
							}
						}
					}
				}
			}
		},
		"/episodes/{patientId}/{id}": {
			"patch": {
				"summary": "Rename an episode",
				"tags": [
					"Episodes"
				],
				"description": "A token other than the episode's `updatedAt` is 409 EPISODE_CONFLICT with the current episode in `details.current`. Audited.",
				"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": {
									"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))$"
									},
									"title": {
										"type": "string",
										"minLength": 1,
										"maxLength": 200
									}
								},
								"required": [
									"expectedUpdatedAt",
									"title"
								]
							}
						}
					}
				},
				"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)$"
										},
										"title": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"closed",
												"entered_in_error"
											]
										},
										"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)$"
										},
										"openedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"closedOn": {
											"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"
												}
											]
										},
										"statusReason": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedById": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"title",
										"status",
										"locationId",
										"openedOn",
										"closedOn",
										"statusReason",
										"statusChangedById",
										"statusChangedByName",
										"statusChangedAt",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/episodes/{patientId}/{id}/status": {
			"post": {
				"summary": "Close, reopen or mark an episode entered in error",
				"tags": [
					"Episodes"
				],
				"description": "Closing changes nothing it links: plans, lab cases and referrals stay open where they are. An episode already in the status asked for is answered as it is, nothing written. A stale token is 409 EPISODE_CONFLICT with `details.current`. Audited.",
				"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": {
									"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))$"
									},
									"status": {
										"type": "string",
										"enum": [
											"active",
											"closed",
											"entered_in_error"
										]
									},
									"closedOn": {
										"type": "string",
										"format": "date",
										"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
									},
									"reason": {
										"type": "string",
										"minLength": 1,
										"maxLength": 2000
									}
								},
								"required": [
									"expectedUpdatedAt",
									"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)$"
										},
										"title": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"closed",
												"entered_in_error"
											]
										},
										"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)$"
										},
										"openedOn": {
											"type": "string",
											"format": "date",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
										},
										"closedOn": {
											"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"
												}
											]
										},
										"statusReason": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedById": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedByName": {
											"type": [
												"string",
												"null"
											]
										},
										"statusChangedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|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": {
											"type": [
												"string",
												"null"
											]
										},
										"createdByName": {
											"type": [
												"string",
												"null"
											]
										},
										"createdBySource": {
											"type": "string",
											"enum": [
												"user",
												"patient",
												"automation",
												"campaign",
												"ai",
												"api",
												"import",
												"system",
												"lab"
											]
										},
										"createdAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
										},
										"updatedAt": {
											"type": "string",
											"format": "date-time",
											"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?: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",
										"title",
										"status",
										"locationId",
										"openedOn",
										"closedOn",
										"statusReason",
										"statusChangedById",
										"statusChangedByName",
										"statusChangedAt",
										"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"
								}
							}
						}
					}
				}
			}
		},
		"/episodes/{patientId}/{id}/links": {
			"put": {
				"summary": "Link or unlink records",
				"tags": [
					"Episodes"
				],
				"description": "Only while the episode is active (409 EPISODE_NOT_ACTIVE). Each kind needs its own grant (a plan: treatment-plan authoring; a lab case or referral: manage). An added record is the patient's own (404 otherwise) and in no other episode (409 EPISODE_LINK_TAKEN with `details.episodeId`; moving one is a removal there and an add here). A real change moves the episode's version; a stale token is 409 EPISODE_CONFLICT with `details.current`. Every change is audited. A retry of a committed command (same `id`) answers 200 with the first response unchanged (409 ID_TAKEN when the id names a different command); the replay needs treatment-plan read access and is audited as a read.",
				"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": {
									"id": {
										"type": "string",
										"format": "uuid",
										"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
									},
									"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))$"
									},
									"add": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"type": "string",
													"enum": [
														"treatmentPlan",
														"clinicalReferral",
														"labCase"
													]
												},
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
												"id"
											]
										}
									},
									"remove": {
										"maxItems": 100,
										"type": "array",
										"items": {
											"type": "object",
											"properties": {
												"kind": {
													"type": "string",
													"enum": [
														"treatmentPlan",
														"clinicalReferral",
														"labCase"
													]
												},
												"id": {
													"type": "string",
													"format": "uuid",
													"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-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",
												"id"
											]
										}
									}
								},
								"required": [
									"id",
									"expectedUpdatedAt",
									"add",
									"remove"
								]
							}
						}
					}
				},
				"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)$"
										},
										"title": {
											"type": "string"
										},
										"status": {
											"type": "string",
											"enum": [
												"active",
												"closed",
												"entered_in_error"
											]
										},
										"lo