{"openapi":"3.1.0","info":{"title":"ANISIVO Clinic portal API reference","version":"1.1.0","description":"Read-only reference for existing authenticated portal operations. External partner credentials are not generally available. This reference does not activate API access or include internal control-plane operations. Examples are synthetic."},"servers":[{"url":"/","description":"The authorized Clinic environment; use an approved test environment for evaluation."}],"security":[{"portalSession":[]}],"paths":{"/api/v1/clinic/context":{"get":{"operationId":"getClinicContext","x-anisivo-audience":"portal","summary":"Resolve the authorized tenant, branch, role, subscription, and entitlements","x-anisivo-summary-ar":"سياق العيادة والصلاحيات","description":"Session resolves authorized clinic/branch selection; returns membership and entitlement context.","responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicContextResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","clinic":{"id":"22222222-2222-4222-8222-222222222222","slug":"example-clinic","name":"Example Clinic","timezone":"Asia/Riyadh","currency":"SAR","locale":"en-SA","status":"active","isDemo":true},"branch":{"id":"33333333-3333-4333-8333-333333333333","name":"Example Branch","city":"Riyadh"},"access":{"role":"manager","permissions":["manage_schedule"],"operational":{"allowed":true,"reason":null}},"subscription":null,"entitlements":{}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/clinics":{"get":{"operationId":"listAuthorizedClinics","x-anisivo-audience":"portal","summary":"List clinic projections authorized by the current portal session","x-anisivo-summary-ar":"العيادات المصرّح بها","description":"Returns only clinic memberships available to the signed-in user.","responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicsResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","currentClinicId":"22222222-2222-4222-8222-222222222222","clinics":[{"id":"22222222-2222-4222-8222-222222222222","slug":"example-clinic","name":"Example Clinic","city":"Riyadh","timezone":"Asia/Riyadh","currency":"SAR","locale":"en-SA","status":"active","isDemo":true,"demoExpiresAt":"2026-09-30T00:00:00.000Z","access":{"role":"owner","branchAccess":"all","branchIds":["33333333-3333-4333-8333-333333333333"]}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/branches":{"get":{"operationId":"listAuthorizedBranches","x-anisivo-audience":"portal","summary":"List branch projections authorized inside the active clinic","x-anisivo-summary-ar":"الفروع المصرّح بها","description":"Requires operational access; returns branches available inside the selected clinic.","responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchesResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","clinicId":"22222222-2222-4222-8222-222222222222","currentBranchId":"33333333-3333-4333-8333-333333333333","branches":[{"id":"33333333-3333-4333-8333-333333333333","name":"Example Branch","city":"Riyadh","isMain":true,"isCurrent":true}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/services":{"get":{"operationId":"listServices","x-anisivo-audience":"portal","summary":"List the active tenant service catalog","x-anisivo-summary-ar":"دليل خدمات العيادة","description":"Requires operational access. Results are limited; this route has no offset or total-count field.","parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"includeInactive","description":"Only the literal true enables this for manage_tenant users; ignored for other users.","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServicesResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","context":{"clinicId":"22222222-2222-4222-8222-222222222222","currency":"SAR"},"services":[{"id":"44444444-4444-4444-8444-444444444444","name":"Example consultation","category":"Consultation","price":100,"currency":"SAR","taxable":true,"active":true,"createdAt":"2026-09-01T08:00:00.000Z"}],"page":{"limit":50,"returned":1}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/staff":{"get":{"operationId":"listStaff","x-anisivo-audience":"portal","summary":"List manager-authorized staff and branch-access projections","x-anisivo-summary-ar":"دليل فريق العيادة","description":"Requires manage_staff and operational access.","responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","clinicId":"22222222-2222-4222-8222-222222222222","staff":[{"id":"44444444-4444-4444-8444-444444444444","userId":"55555555-5555-4555-8555-555555555555","fullName":"Example Veterinarian","email":"veterinarian@example.invalid","role":"veterinarian","active":true,"createdAt":"2026-09-01T08:00:00.000Z","access":{"membershipId":"66666666-6666-4666-8666-666666666666","status":"active","branchAccess":"scoped","branchIds":["33333333-3333-4333-8333-333333333333"],"acceptedAt":"2026-09-01T08:00:00.000Z"}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/customers":{"get":{"operationId":"listCustomerProjections","x-anisivo-audience":"portal","summary":"List care-role-authorized customer and pet identity projections","x-anisivo-summary-ar":"بيانات المالكين والأليفة","description":"Requires view_clinical and operational access. Uses offset/limit paging and returns no total count.","parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomersResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","context":{"clinicId":"22222222-2222-4222-8222-222222222222","identityOwner":"ANISIVO"},"customers":[{"id":"77777777-7777-4777-8777-777777777777","fullName":"Example Owner","phone":"+966500000000","email":"owner@example.invalid","city":"Riyadh","createdAt":"2026-09-01T08:00:00.000Z","updatedAt":"2026-09-15T08:00:00.000Z","animals":[{"id":"88888888-8888-4888-8888-888888888888","name":"Example Pet","species":"dog","breed":"Saluki","sex":"female","birthDate":"2024-01-15","weightKg":18.5,"microchip":"SYNTHETIC-CHIP","updatedAt":"2026-09-15T08:00:00.000Z"}]}],"page":{"limit":50,"offset":0,"returned":1}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/appointments":{"get":{"operationId":"listAppointments","x-anisivo-audience":"portal","summary":"List branch-scoped appointments with customer, pet, and resource projections","x-anisivo-summary-ar":"مواعيد الفرع","description":"Requires manage_schedule and operational access. Results are limited; this route has no cursor or total count. Invalid status values are ignored.","parameters":[{"in":"query","name":"from","description":"Inclusive lower bound; missing or invalid values default to the current time.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"to","description":"Exclusive upper bound; defaults to seven days after from when missing, invalid, not later than from, or beyond 31 days.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"status","schema":{"type":"string","enum":["requested","confirmed","checked_in","waiting","in_consultation","completed","cancelled","no_show"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":250,"default":100}}],"responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentsResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","context":{"clinicId":"22222222-2222-4222-8222-222222222222","branchId":"33333333-3333-4333-8333-333333333333"},"window":{"from":"2026-09-15T00:00:00.000Z","to":"2026-09-16T00:00:00.000Z","maximumDays":31},"appointments":[],"page":{"limit":100,"returned":0}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/availability":{"get":{"operationId":"getAvailability","x-anisivo-audience":"portal","summary":"Get branch-scoped resources, rules, assignments, and active holds","x-anisivo-summary-ar":"موارد وجدول الإتاحة","description":"Requires scheduling.advanced entitlement and operational access. Returns rules and allocations, not calculated bookable slots.","parameters":[{"in":"query","name":"from","description":"Inclusive lower bound; missing or invalid values default to the current time.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"to","description":"Exclusive upper bound; defaults to seven days after from when missing, invalid, not later than from, or beyond 31 days.","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AvailabilityResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","window":{"from":"2026-09-15T08:00:00.000Z","to":"2026-09-22T08:00:00.000Z","maximumDays":31},"context":{"clinicId":"22222222-2222-4222-8222-222222222222","branchId":"33333333-3333-4333-8333-333333333333","timezone":"Asia/Riyadh"},"resources":[{"id":"99999999-9999-4999-8999-999999999999","resource_type":"veterinarian","name":"Example Vet","capacity":1,"timezone":"Asia/Riyadh","status":"active","metadata":{}}],"rules":[{"id":"aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa","resource_id":"99999999-9999-4999-8999-999999999999","weekday":1,"starts_at":"09:00:00","ends_at":"17:00:00","valid_from":"2026-09-01","valid_until":null,"rule_type":"available","recurrence":{}}],"assignments":[],"holds":[]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}},"/api/v1/queue":{"get":{"operationId":"getQueue","x-anisivo-audience":"portal","summary":"Get active front-desk tickets for the authorized branch","x-anisivo-summary-ar":"قائمة الانتظار الحالية","description":"Requires operational access. Includes the active queue and a legacy appointment queue projection.","responses":{"200":{"description":"Successful authorized response. Example values are synthetic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueResponse"},"example":{"ok":true,"apiVersion":"v1","correlationId":"11111111-1111-4111-8111-111111111111","generatedAt":"2026-09-15T08:00:00.000Z","context":{"clinicId":"22222222-2222-4222-8222-222222222222","branchId":"33333333-3333-4333-8333-333333333333"},"tickets":[{"id":"bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb","appointment_id":"cccccccc-cccc-4ccc-8ccc-cccccccccccc","visit_id":null,"animal_id":"88888888-8888-4888-8888-888888888888","ticket_number":"Q-001","queue_date":"2026-09-15","arrival_type":"appointment","priority":"normal","status":"waiting","estimated_wait_minutes":10,"checked_in_at":"2026-09-15T08:00:00.000Z","called_at":null,"completed_at":null,"notes":null,"updated_at":"2026-09-15T08:00:00.000Z"}],"summary":{"active":1,"waiting":1,"priority":0},"legacyAppointmentQueue":[]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Clinic context or data source unavailable; retry with bounded backoff."}}}}},"components":{"securitySchemes":{"portalSession":{"type":"apiKey","in":"cookie","name":"sb-PROJECT_REF-auth-token","description":"Informational cookie-name pattern. The actual name is deployment-specific and may be chunked with .0/.1 suffixes. Supabase SSR manages the session after normal portal sign-in. Do not manually construct or distribute cookies. This is not a partner API key or a service-role credential."}},"schemas":{"ClinicContextResponse":{"type":"object","required":["ok","apiVersion","correlationId","clinic","branch","access","entitlements"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"generatedAt":{"type":"string","format":"date-time"},"correlationId":{"type":"string","format":"uuid"},"clinic":{"type":"object","required":["id","slug","name","timezone","currency","locale","status"],"properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"timezone":{"type":"string"},"currency":{"type":"string"},"locale":{"type":"string"},"status":{"type":"string"},"isDemo":{"type":"boolean"}}},"branch":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"city":{"type":["string","null"]}}},"access":{"type":"object"},"subscription":{"type":["object","null"]},"entitlements":{"type":"object","additionalProperties":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"},"limit":{"type":["number","null"]},"effectiveUntil":{"type":["string","null"],"format":"date-time"}}}}}},"ClinicsResponse":{"type":"object","additionalProperties":false,"required":["ok","apiVersion","correlationId","generatedAt","currentClinicId","clinics"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"currentClinicId":{"type":"string","format":"uuid"},"clinics":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","slug","name","city","timezone","currency","locale","status","isDemo","demoExpiresAt","access"],"properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"city":{"type":["string","null"]},"timezone":{"type":"string"},"currency":{"type":"string"},"locale":{"type":"string"},"status":{"type":"string"},"isDemo":{"type":"boolean"},"demoExpiresAt":{"type":["string","null"],"format":"date-time"},"access":{"type":"object","additionalProperties":false,"required":["role","branchAccess","branchIds"],"properties":{"role":{"type":"string"},"branchAccess":{"type":"string"},"branchIds":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}}}},"BranchesResponse":{"type":"object","additionalProperties":false,"required":["ok","apiVersion","correlationId","generatedAt","clinicId","currentBranchId","branches"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"clinicId":{"type":"string","format":"uuid"},"currentBranchId":{"type":"string","format":"uuid"},"branches":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","name","city","isMain","isCurrent"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"city":{"type":["string","null"]},"isMain":{"type":"boolean"},"isCurrent":{"type":"boolean"}}}}}},"ServicesResponse":{"type":"object","required":["ok","apiVersion","correlationId","generatedAt","context","services","page"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"context":{"type":"object","required":["clinicId","currency"],"properties":{"clinicId":{"type":"string","format":"uuid"},"currency":{"type":"string"}}},"services":{"type":"array","items":{"type":"object","required":["id","name","category","price","currency","taxable","active","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"category":{"type":["string","null"]},"price":{"type":"number"},"currency":{"type":"string"},"taxable":{"type":"boolean"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}}}},"page":{"$ref":"#/components/schemas/LimitedPage"}}},"LimitedPage":{"type":"object","description":"A limited result set, not a total count or an export of every record.","required":["limit","returned"],"properties":{"limit":{"type":"integer","minimum":1},"returned":{"type":"integer","minimum":0}}},"StaffResponse":{"type":"object","additionalProperties":false,"required":["ok","apiVersion","correlationId","generatedAt","clinicId","staff"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"clinicId":{"type":"string","format":"uuid"},"staff":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","userId","fullName","email","role","active","createdAt","access"],"properties":{"id":{"type":"string","format":"uuid"},"userId":{"type":["string","null"],"format":"uuid"},"fullName":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"role":{"type":"string"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"access":{"oneOf":[{"type":"null"},{"type":"object","additionalProperties":false,"required":["membershipId","status","branchAccess","branchIds","acceptedAt"],"properties":{"membershipId":{"type":"string","format":"uuid"},"status":{"type":"string"},"branchAccess":{"type":"string"},"branchIds":{"type":"array","items":{"type":"string","format":"uuid"}},"acceptedAt":{"type":["string","null"],"format":"date-time"}}}]}}}}}},"CustomersResponse":{"type":"object","additionalProperties":false,"required":["ok","apiVersion","correlationId","generatedAt","context","customers","page"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"context":{"type":"object","additionalProperties":false,"required":["clinicId","identityOwner"],"properties":{"clinicId":{"type":"string","format":"uuid"},"identityOwner":{"type":"string","const":"ANISIVO"}}},"customers":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","fullName","phone","email","city","createdAt","updatedAt","animals"],"properties":{"id":{"type":"string","format":"uuid"},"fullName":{"type":"string"},"phone":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"city":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"animals":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","name","species","breed","sex","birthDate","weightKg","microchip","updatedAt"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"species":{"type":"string"},"breed":{"type":["string","null"]},"sex":{"type":["string","null"]},"birthDate":{"type":["string","null"],"format":"date"},"weightKg":{"type":["number","null"]},"microchip":{"type":["string","null"]},"updatedAt":{"type":"string","format":"date-time"}}}}}}},"page":{"type":"object","additionalProperties":false,"required":["limit","offset","returned"],"properties":{"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0},"returned":{"type":"integer","minimum":0}}}}},"AppointmentsResponse":{"type":"object","required":["ok","apiVersion","correlationId","generatedAt","context","window","appointments","page"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"context":{"type":"object","required":["clinicId","branchId"],"properties":{"clinicId":{"type":"string","format":"uuid"},"branchId":{"type":"string","format":"uuid"}}},"window":{"type":"object","required":["from","to","maximumDays"],"properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"maximumDays":{"type":"integer","const":31}}},"appointments":{"type":"array","items":{"type":"object","required":["id","scheduledAt","durationMinutes","reason","status","notes","createdAt","updatedAt","animal","customer","resources"],"properties":{"id":{"type":"string","format":"uuid"},"scheduledAt":{"type":"string","format":"date-time"},"durationMinutes":{"type":"integer"},"reason":{"type":["string","null"]},"status":{"type":"string"},"notes":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"animal":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"species":{"type":"string"},"breed":{"type":["string","null"]}}},"customer":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"fullName":{"type":"string"}}},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":["string","null"]},"name":{"type":["string","null"]},"allocationStart":{"type":"string","format":"date-time"},"allocationEnd":{"type":"string","format":"date-time"},"status":{"type":"string"}}}}}}},"page":{"$ref":"#/components/schemas/LimitedPage"}}},"AvailabilityResponse":{"type":"object","additionalProperties":false,"required":["ok","apiVersion","correlationId","window","context","resources","rules","assignments","holds"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"window":{"type":"object","additionalProperties":false,"required":["from","to","maximumDays"],"properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"maximumDays":{"type":"integer","const":31}}},"context":{"type":"object","additionalProperties":false,"required":["clinicId","branchId","timezone"],"properties":{"clinicId":{"type":"string","format":"uuid"},"branchId":{"type":"string","format":"uuid"},"timezone":{"type":"string"}}},"resources":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","resource_type","name","capacity","timezone","status","metadata"],"properties":{"id":{"type":"string","format":"uuid"},"resource_type":{"type":"string"},"name":{"type":"string"},"capacity":{"type":"number","minimum":0},"timezone":{"type":"string"},"status":{"type":"string"},"metadata":{"type":"object","additionalProperties":true}}}},"rules":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","resource_id","weekday","starts_at","ends_at","valid_from","valid_until","rule_type","recurrence"],"properties":{"id":{"type":"string","format":"uuid"},"resource_id":{"type":"string","format":"uuid"},"weekday":{"type":"integer","minimum":0,"maximum":6},"starts_at":{"type":"string"},"ends_at":{"type":"string"},"valid_from":{"type":["string","null"],"format":"date"},"valid_until":{"type":["string","null"],"format":"date"},"rule_type":{"type":"string"},"recurrence":{"type":["object","null"],"additionalProperties":true}}}},"assignments":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","appointment_id","resource_id","allocation_start","allocation_end","status"],"properties":{"id":{"type":"string","format":"uuid"},"appointment_id":{"type":"string","format":"uuid"},"resource_id":{"type":"string","format":"uuid"},"allocation_start":{"type":"string","format":"date-time"},"allocation_end":{"type":"string","format":"date-time"},"status":{"type":"string"}}}},"holds":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","resource_id","starts_at","ends_at","expires_at","status"],"properties":{"id":{"type":"string","format":"uuid"},"resource_id":{"type":["string","null"],"format":"uuid"},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"status":{"type":"string"}}}}}},"QueueResponse":{"type":"object","additionalProperties":false,"required":["ok","apiVersion","correlationId","generatedAt","context","tickets","summary","legacyAppointmentQueue"],"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string","const":"v1"},"correlationId":{"type":"string","format":"uuid"},"generatedAt":{"type":"string","format":"date-time"},"context":{"type":"object","additionalProperties":false,"required":["clinicId","branchId"],"properties":{"clinicId":{"type":"string","format":"uuid"},"branchId":{"type":"string","format":"uuid"}}},"tickets":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","appointment_id","visit_id","animal_id","ticket_number","queue_date","arrival_type","priority","status","estimated_wait_minutes","checked_in_at","called_at","completed_at","notes","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"appointment_id":{"type":["string","null"],"format":"uuid"},"visit_id":{"type":["string","null"],"format":"uuid"},"animal_id":{"type":["string","null"],"format":"uuid"},"ticket_number":{"type":"string"},"queue_date":{"type":"string","format":"date"},"arrival_type":{"type":"string"},"priority":{"type":"string"},"status":{"type":"string"},"estimated_wait_minutes":{"type":["integer","null"]},"checked_in_at":{"type":"string","format":"date-time"},"called_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"notes":{"type":["string","null"]},"updated_at":{"type":"string","format":"date-time"}}}},"summary":{"type":"object","additionalProperties":false,"required":["active","waiting","priority"],"properties":{"active":{"type":"integer","minimum":0},"waiting":{"type":"integer","minimum":0},"priority":{"type":"integer","minimum":0}}},"legacyAppointmentQueue":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","animal_id","scheduled_at","duration_minutes","reason","status"],"properties":{"id":{"type":"string","format":"uuid"},"animal_id":{"type":"string","format":"uuid"},"scheduled_at":{"type":"string","format":"date-time"},"duration_minutes":{"type":"integer","minimum":1},"reason":{"type":["string","null"]},"status":{"type":"string"}}}}}}},"responses":{"Unauthorized":{"description":"Authentication is required."},"Forbidden":{"description":"Tenant, branch, role, lifecycle, or entitlement does not permit access."}}}}