# OHN-61 OpenAPI 3.1 contract (W28 triage contracts, 2026-11-23). Source of truth for W29 (server/modules/ohn-61) and W31 (frontend).
openapi: 3.1.0
info:
  title: OHN-61 Triage and Patient Queue
  version: 1.3.7
  description: 'Arrival/check-in, per-department live queues, call screens, vital signs, acuity on a configurable jurisdiction-approved triage scale (fail closed), reassessment timers, handover to consultation,
    outcomes and reports. Deployable: care-exchange. Module key: triage. Tables: ohn61_*. Every write needs Idempotency-Key (same key + same body replays the first answer; same key + other body is 409 idempotency_mismatch)
    and, on an existing aggregate, expected_version. Request bodies are strict: unknown keys are 422 validation_failed. Facility scope comes from the token (workspace facility); a ticket of another facility
    is 404.'
servers:
- url: https://opeshealthnetwork.com
security:
- bearer: []
paths:
  /api/ohn/v1/triage/departments:
    get:
      operationId: OHN_61_API_001
      summary: List departments of the caller's facility
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      - triage_admin
      - triage_service
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: active
        in: query
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Department'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: OHN_61_API_002
      summary: Create a department (facility configuration)
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepartmentWrite'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Department'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: 'conflict: duplicate code or ticket_prefix in the facility'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/departments/{department_id}:
    get:
      operationId: OHN_61_API_003
      summary: Get one department (also used by OHN-62 to verify a binding)
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      - triage_admin
      - triage_service
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: department_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Department'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: OHN_61_API_004
      summary: Update a department (expected_version required)
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: department_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepartmentWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Department'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/scales:
    get:
      operationId: OHN_61_API_005
      summary: List triage scale versions of the jurisdiction
      x-roles:
      - triage_governance_admin
      - triage_admin
      - triage_officer
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - name: jurisdiction_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: state
        in: query
        required: false
        schema:
          type: string
          enum:
          - draft
          - active
          - retired
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: OHN_61_API_006
      summary: 'Load a scale version as draft (validated: unique level codes and ranks, every rule/discriminator level exists, inputs are known vitals/discriminators)'
      x-roles:
      - triage_governance_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: jurisdiction_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriageScaleDocument'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/scales/active:
    get:
      operationId: OHN_61_API_007
      summary: 'The active scale of the caller''s jurisdiction. 1.3.6: cashier may read it (purpose triage_billing, read-only) to show the pilot banner from synthetic_demo and clinically_approved'
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      - triage_admin
      - triage_governance_admin
      - cashier
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: jurisdiction_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 'not_configured: no active, approved triage scale for the jurisdiction (fail closed)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-purposes:
      - triage_assessment
      - triage_billing
  /api/ohn/v1/triage/scales/{scale_id}:
    get:
      operationId: OHN_61_API_008
      summary: Get one scale version
      x-roles:
      - triage_governance_admin
      - triage_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - name: scale_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/scales/{scale_id}/activate:
    post:
      operationId: OHN_61_API_009
      summary: Activate a draft (retires the previous active version of the jurisdiction)
      x-roles:
      - triage_governance_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - name: scale_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScaleActivate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: 'validation_failed, or scale_not_approved: a real scale cannot use the demo approval_ref'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/scales/{scale_id}/retire:
    post:
      operationId: OHN_61_API_010
      summary: Retire a version (no active scale afterwards means 503 not_configured for acuity)
      x-roles:
      - triage_governance_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - name: scale_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Reasoned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/scales/load-demo:
    post:
      operationId: OHN_61_API_011
      summary: Load the SYNTHETIC demo scale (NOT clinically approved). Served only when OHN61_ALLOW_DEMO_CONFIG=true and the profile is not production
      x-roles:
      - triage_governance_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: jurisdiction_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: demo_config_disabled (the route does not exist in production)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/scales/load-reference:
    post:
      operationId: OHN_61_API_105
      summary: Load the reference SATS triage scale (South African Triage Scale adult chart, SATS Training Manual 2012, with WHO ETAT 2016 emergency and priority signs for children; every
        item cited, see modules/OHN-61/docs/sats-reference-scale.md) as a draft with synthetic_demo false. It is never activated here; clinical governance verifies it and activates it with its own approval
        reference, so clinically_approved stays false until then. Served in every profile.
      x-since: 1.3.7
      x-roles:
      - triage_governance_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: jurisdiction_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageScaleVersion'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found (another jurisdiction)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets:
    post:
      operationId: OHN_61_API_012
      summary: 'Check in: create a queue ticket (walk-in or OHN-54 appointment)'
      x-roles:
      - receptionist
      - triage_officer
      x-purpose: triage_reception
      security:
      - bearer: []
      description: Verifies the patient with OHN-03 (GET /api/ohn/v1/mpi/patients/{id}); for an appointment, verifies it with OHN-54 and calls its check-in (POST /api/ohn/v1/appointments/{id}/check-in).
        Attaches pre-consultation answers through OHN-62 (POST /api/ohn/v1/pre-consult/tickets/{ticket_id}/attach); if OHN-62 is unavailable the ticket is still created with preconsult.state=unknown. Ticket
        number = department prefix + daily sequence.
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckIn'
      responses:
        '201':
          description: Created; public_token returned once
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckInResult'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: 'conflict: patient already has an open ticket in this department (details.ticket_id), or appointment already checked in'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed, patient_not_identified (unidentified only where allows_unidentified), appointment_mismatch (other patient/facility/day), department_inactive; emergency_bypass never
            fails on identity, questionnaire or payment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: upstream_unavailable (OHN-03/09/54 dependency failed; nothing was changed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}:
    get:
      operationId: OHN_61_API_013
      summary: Get a ticket
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      - triage_service
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/Ticket'
                - $ref: '#/components/schemas/TicketServiceProjection'
                description: Ticket for receptionist, triage_officer and clinician; TicketServiceProjection for triage_service
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      description: 'Response depends on the caller role: triage_service (OHN-62 service token) receives TicketServiceProjection (ids and states only: id, ticket_number, facility_id, department_id, patient_id,
        state, financial_state, version); receptionist, triage_officer and clinician receive the full Ticket.'
      x-since-roles:
        triage_service: 1.3.1
  /api/ohn/v1/triage/queue:
    get:
      operationId: OHN_61_API_014
      summary: 'Live queue of one department: triage view (waiting/called/in_triage) or consultation view (triaged/consult_called/in_consultation)'
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      x-purpose: triage_reception
      security:
      - bearer: []
      description: 'Order: untriaged tickets by priority_flag (configured OHN-62 red flags) then arrival time; triaged tickets by acuity rank (1 first) then arrival time. waiting_minutes, target_breached
        and reassessment_overdue are computed at read time from the active scale. Receptionists see no vitals or complaint, only ticket, name, wait and acuity colour.'
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: department_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: view
        in: query
        required: true
        schema:
          type: string
          enum:
          - triage
          - consultation
          - nurse_ready
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueueView'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/departments/{department_id}/call-next:
    post:
      operationId: OHN_61_API_015
      summary: Call the next ticket of the view (first in queue order)
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      x-purpose: triage_reception
      security:
      - bearer: []
      description: waiting -> called (triage view) or triaged -> consult_called (consultation view). Increments call_count, updates the waiting-room displays and, when notify_opt_in, asks OHN-53 to send
        the call by SMS/USSD.
      parameters:
      - name: department_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CallNext'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: nothing_to_call
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch; payment_required (routine ticket not R_CLEAR or E_BYPASS under pay_before_nurse)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/call:
    post:
      operationId: OHN_61_API_016
      summary: 'Call (or re-call) a specific ticket. 1.3.7 (consultation view, role clinician): if the calling clinician has no active care_team relationship for this ticket''s patient, it is registered
        first, best effort: a failure is audited and does not stop this action (see POST /handover: OHN-61 (its own service identity, OHN-16 role care_team_registrar (OHN-16 1.3.0: care_team only, at most
        72 h, revokes only its own), purpose relationship_registration) registers POST /api/ohn/v1/access/relationships with relationship_type care_team, actor_ref = the clinician''s OHN-06 practitioner
        id, patient_ref = the linked patient, facility_ref = the ticket''s facility, evidence_ref = ticket_id, valid_from = now - 1 minute, expires_at = valid_from + the facility''s care_team_relationship_hours
        (default 24, max 72); nothing is registered while an assertion for the same practitioner, patient and facility is still active. Audited (care_relationship.register), announced (triage.care_team.registered))'
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Call'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch; payment_required (routine ticket not R_CLEAR or E_BYPASS under pay_before_nurse)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/missed:
    post:
      operationId: OHN_61_API_017
      summary: 'Patient did not answer the call: back to the queue, or no_show once call_count reaches max_calls_before_no_show'
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/start-triage:
    post:
      operationId: OHN_61_API_018
      summary: called -> in_triage (opens the OHN-09 triage encounter when the patient is identified)
      x-roles:
      - triage_officer
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch; claimed_by_other (another user holds the claim); payment_required (routine ticket not R_CLEAR or E_BYPASS under pay_before_nurse)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: upstream_unavailable (OHN-03/09/54 dependency failed; nothing was changed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/link-patient:
    post:
      operationId: OHN_61_API_019
      summary: Link an unidentified ticket to an OHN-03 patient (after search or quick registration); flushes pending vitals to OHN-10
      x-roles:
      - receptionist
      - triage_officer
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LinkPatient'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: upstream_unavailable (OHN-03/09/54 dependency failed; nothing was changed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/vitals:
    get:
      operationId: OHN_61_API_020
      summary: Vital sign sets of a ticket
      x-roles:
      - triage_officer
      - clinician
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/VitalSet'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: OHN_61_API_021
      summary: Record a vital sign set (state in_triage or triaged). Each value becomes an OHN-10 observation coded with LOINC (validated via OHN-23); pending until the patient is identified or OHN-10 accepts
      x-roles:
      - triage_officer
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VitalsCreate'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VitalSet'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch; claimed_by_other (another user holds the claim); payment_required (routine ticket not R_CLEAR or E_BYPASS under pay_before_nurse)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: 'validation_failed: unit/type errors, values outside the configured input_limits, diastolic >= systolic, measured_at in the future'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/acuity/evaluate:
    post:
      operationId: OHN_61_API_022
      summary: Preview the acuity the active scale computes for vitals and discriminators (no write)
      x-roles:
      - triage_officer
      x-purpose: triage_assessment
      security:
      - bearer: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluateRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Evaluation'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 'not_configured: no active, approved triage scale for the jurisdiction (fail closed)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/assessment:
    post:
      operationId: OHN_61_API_023
      summary: 'Complete triage: computed level (+ optional override with reason), presenting complaint; in_triage -> triaged and into the consultation queue of handover_department_id (default: same department).
        1.3.7: a handover_department_id of another department is a handover for care_team access: it ends the previous department''s assertions (re_handover); no receiving clinician is named here, so the
        lazy path applies (see POST /handover)'
      x-roles:
      - triage_officer
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssessmentCreate'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Assessment'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch; claimed_by_other (another user holds the claim)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed, override_reason_required, unknown level or discriminator, or downgrade not allowed by the scale; missing_vital_reason_required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 'not_configured: no active, approved triage scale for the jurisdiction (fail closed)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: upstream_unavailable (OHN-03/09/54 dependency failed; nothing was changed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/reassessments:
    post:
      operationId: OHN_61_API_024
      summary: Reassess a triaged ticket (new vitals set + level); resets the reassessment timer
      x-roles:
      - triage_officer
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssessmentCreate'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Assessment'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch; claimed_by_other (another user holds the claim)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: 'validation_failed, missing_vital_reason_required, override_reason_required, downgrade_requires_lead (a reassessment never lowers the level automatically: a lower computed level is
            shown as a suggestion and the previous level is kept unless a triage_lead overrides with a reason)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 'not_configured: no active, approved triage scale for the jurisdiction (fail closed)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/assessments:
    get:
      operationId: OHN_61_API_025
      summary: Assessments of a ticket, oldest first
      x-roles:
      - triage_officer
      - clinician
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Assessment'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/handover:
    post:
      operationId: OHN_61_API_026
      summary: 'Move a triaged ticket to another department''s consultation queue. 1.3.7 (owner decision): the receiving department''s clinicians get a time-limited OHN-16 care_team relationship. The shift
        roster holds platform user ids, not practitioner ids, so the main path is lazy: a clinician who calls the ticket (consultation view), starts its consultation, acknowledges the handover or opens
        its summary is registered with the practitioner_id of their own token. At call, start-consultation and acknowledge this is best effort: a missing practitioner_id or a failed registration is audited
        (care_relationship.register, outcome no_practitioner or failed) and the call, start or receipt still succeeds. GET /summary, the patient-data read, fails closed: no practitioner_id answers 403 forbidden
        (audit reason no_practitioner, as in 1.3.6) and a failed registration answers 503 dependency_unavailable (audited), before OHN-16 is asked for the read decision. Here, at the handover itself, each
        receiving_practitioner_ids entry in the body is registered at once (through the outbox; it never blocks or fails the handover). OHN-61 (its own service identity, OHN-16 role care_team_registrar
        (OHN-16 1.3.0: care_team only, at most 72 h, revokes only its own), purpose relationship_registration) registers POST /api/ohn/v1/access/relationships with relationship_type care_team, actor_ref
        = the clinician''s OHN-06 practitioner id, patient_ref = the linked patient, facility_ref = the ticket''s facility, evidence_ref = ticket_id, valid_from = now - 1 minute, expires_at = valid_from
        + the facility''s care_team_relationship_hours (default 24, max 72); nothing is registered while an assertion for the same practitioner, patient and facility is still active. Audited (care_relationship.register),
        announced (triage.care_team.registered). A ticket without a linked patient registers nothing until link-patient. A handover to another department first revokes the assertions registered for the
        previous one (re_handover). Ticket.care_team_access shows the state'
      x-roles:
      - triage_officer
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Handover'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/signals:
    post:
      operationId: OHN_61_API_027
      summary: 'Service call from OHN-62: a configured red-flag rule fired for this ticket''s pre-consultation answers'
      x-roles:
      - preconsult_service
      x-purpose: triage_signals
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignalCreate'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Signal'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: ticket closed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/signals/{signal_id}/acknowledge:
    post:
      operationId: OHN_61_API_028
      summary: Officer acknowledges a red-flag signal
      x-roles:
      - triage_officer
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: signal_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Signal'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/start-consultation:
    post:
      operationId: OHN_61_API_029
      summary: 'consult_called -> in_consultation (clinician; records consultation_started_at). 1.3.7: if the calling clinician has no active care_team relationship for this ticket''s patient, it is registered
        first, best effort: a failure is audited and does not stop this action (see POST /handover: OHN-61 (its own service identity, OHN-16 role care_team_registrar (OHN-16 1.3.0: care_team only, at most
        72 h, revokes only its own), purpose relationship_registration) registers POST /api/ohn/v1/access/relationships with relationship_type care_team, actor_ref = the clinician''s OHN-06 practitioner
        id, patient_ref = the linked patient, facility_ref = the ticket''s facility, evidence_ref = ticket_id, valid_from = now - 1 minute, expires_at = valid_from + the facility''s care_team_relationship_hours
        (default 24, max 72); nothing is registered while an assertion for the same practitioner, patient and facility is still active. Audited (care_relationship.register), announced (triage.care_team.registered))'
      x-roles:
      - clinician
      x-purpose: triage_consultation
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/complete:
    post:
      operationId: OHN_61_API_030
      summary: 'in_consultation -> completed. 1.3.7: closing the ticket revokes every care_team assertion still active for it in OHN-16 (POST /access/relationships/{id}/revoke, reason ''triage ticket closed:
        <state>''; 409 already_revoked counts as done), through the outbox; audited (care_relationship.revoke) and announced (triage.care_team.ended)'
      x-roles:
      - clinician
      x-purpose: triage_consultation
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/outcome:
    post:
      operationId: OHN_61_API_031
      summary: 'Close without consultation: left_without_being_seen, transferred, referred (OHN-27 referral verified) or cancelled (entered in error, before triage only). 1.3.7: closing the ticket revokes
        every care_team assertion still active for it in OHN-16 (POST /access/relationships/{id}/revoke, reason ''triage ticket closed: <state>''; 409 already_revoked counts as done), through the outbox;
        audited (care_relationship.revoke) and announced (triage.care_team.ended)'
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Outcome'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed or referral_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: upstream_unavailable (OHN-03/09/54 dependency failed; nothing was changed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/tickets/{ticket_id}/summary:
    get:
      operationId: OHN_61_API_032
      summary: 'Triage summary for the clinician: vitals, assessments, overrides, signals, pre-consult response ids, state history (audited read). 1.3.7 (role clinician): if the clinician has no active
        care_team relationship for this ticket''s patient, it is registered before the OHN-16 read decision, failing closed: no practitioner_id is 403 forbidden (audit reason no_practitioner), a failed
        registration is 503 dependency_unavailable (audited). See POST /handover'
      x-roles:
      - triage_officer
      - clinician
      x-purpose: triage_consultation
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriageSummary'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/displays:
    get:
      operationId: OHN_61_API_033
      summary: Waiting-room displays of the facility
      x-roles:
      - triage_admin
      - receptionist
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Display'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: OHN_61_API_034
      summary: Register a display (returns a display id; a device token is issued by the platform for role display_device)
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DisplayWrite'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Display'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/displays/{display_id}:
    put:
      operationId: OHN_61_API_035
      summary: Update a display
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: display_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DisplayWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Display'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/displays/{display_id}/feed:
    get:
      operationId: OHN_61_API_036
      summary: Calls to show on the screen (poll every 3-5 s; ETag/If-None-Match supported, 304 when unchanged)
      x-roles:
      - display_device
      - triage_admin
      x-purpose: waiting_room_display
      security:
      - bearer: []
      parameters:
      - name: display_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DisplayFeed'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '304':
          description: Not modified
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/reports/{report_id}:
    get:
      operationId: OHN_61_API_037
      summary: Run a report (daily_attendance, triage_queue_times, assessment_completion, emergency_escalations, doctor_handoffs, access_and_privacy, flow_and_capacity; OHN-61-R001..R003 are 1.0 aliases)
      x-roles:
      - triage_admin
      - triage_report_viewer
      - triage_manager
      - triage_auditor
      x-purpose: triage_reporting
      security:
      - bearer: []
      parameters:
      - name: report_id
        in: path
        required: true
        schema:
          type: string
          enum:
          - daily_attendance
          - triage_queue_times
          - assessment_completion
          - emergency_escalations
          - doctor_handoffs
          - access_and_privacy
          - flow_and_capacity
          - OHN-61-R001
          - OHN-61-R002
          - OHN-61-R003
          - sync_health
          - payment_gate_audit
          - cashier_to_nurse_latency
          - queue_reprioritizations
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: from
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: to
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: department_id
        in: query
        required: false
        schema:
          type: string
          format: uuid
      - name: group_by
        in: query
        required: false
        schema:
          type: array
          items:
            type: string
            enum:
            - facility
            - department
            - date
            - shift
            - acuity
            - staff_role
            - time
            - protocol_version
            - destination
            - day
            - zone
            - hour
            - device
        description: dimensions, comma-separated; default the report's documented default
      - name: shift_id
        in: query
        required: false
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Report'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: 'validation_failed: range over 366 days or to < from'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/ohn/v1/triage/reports/{report_id}/export:
    post:
      operationId: OHN_61_API_038
      summary: Export CSV or PDF, watermarked through OHN-16 marks (resource type report_export); counts under 5 suppressed
      x-roles:
      - triage_admin
      - triage_report_viewer
      - triage_manager
      - triage_auditor
      x-purpose: triage_reporting
      security:
      - bearer: []
      parameters:
      - name: report_id
        in: path
        required: true
        schema:
          type: string
          enum:
          - daily_attendance
          - triage_queue_times
          - assessment_completion
          - emergency_escalations
          - doctor_handoffs
          - access_and_privacy
          - flow_and_capacity
          - OHN-61-R001
          - OHN-61-R002
          - OHN-61-R003
          - sync_health
          - payment_gate_audit
          - cashier_to_nurse_latency
          - queue_reprioritizations
      - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: File with X-OHN-Mark-Id header
          content:
            text/csv:
              schema:
                type: string
            application/pdf:
              schema:
                type: string
                format: binary
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: export_not_allowed by OHN-16
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: upstream_unavailable (OHN-03/09/54 dependency failed; nothing was changed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportRequest'
  /api/ohn/v1/triage/tickets/{ticket_id}/claim:
    post:
      operationId: OHN_61_API_039
      summary: Claim the ticket (lease of claim_ttl_minutes, renewed by claiming again). Required for start-triage, vitals, assessment and reassessment
      x-roles:
      - triage_officer
      - clinician
      - triage_lead
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaimRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: claimed_by_other (details.claimed_by, details.claim_expires_at), version_conflict, invalid_transition; payment_required (routine ticket not R_CLEAR or E_BYPASS under pay_before_nurse)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/tickets/{ticket_id}/release:
    post:
      operationId: OHN_61_API_040
      summary: Release own claim (or triage_lead releases any; audited)
      x-roles:
      - triage_officer
      - clinician
      - triage_lead
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/tickets/{ticket_id}/recall:
    post:
      operationId: OHN_61_API_041
      summary: 'Recall: call a called/consult_called ticket again (call_count+1), or reinstate a no_show into the queue at its original arrival time within no_show_reinstate_minutes (reason required)'
      x-roles:
      - receptionist
      - triage_officer
      - clinician
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Recall'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed or reinstate_window_passed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/escalations:
    get:
      operationId: OHN_61_API_042
      summary: 'Emergency tracking: escalations of the facility (open first, by raised_at)'
      x-roles:
      - triage_officer
      - clinician
      - triage_lead
      - triage_manager
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: state
        in: query
        required: false
        schema:
          type: string
          enum:
          - open
          - acknowledged
          - handed_off
          - cancelled
      - name: department_id
        in: query
        required: false
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Escalation'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/tickets/{ticket_id}/escalations:
    post:
      operationId: OHN_61_API_043
      summary: Raise an emergency escalation by staff (automatic escalations come from scale levels/rules marked emergency/escalate)
      x-roles:
      - triage_officer
      - clinician
      - triage_lead
      - receptionist
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EscalationCreate'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Escalation'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: an open escalation exists (details.escalation_id)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/escalations/{escalation_id}:
    get:
      operationId: OHN_61_API_044
      summary: Get one escalation
      x-roles:
      - triage_officer
      - clinician
      - triage_lead
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: escalation_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Escalation'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/escalations/{escalation_id}/acknowledge:
    post:
      operationId: OHN_61_API_045
      summary: Staff acknowledgement (one per user; state acknowledged once every required_ack_role has acknowledged)
      x-roles:
      - triage_officer
      - clinician
      - triage_lead
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: escalation_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Escalation'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: escalation_closed or already acknowledged by this user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/escalations/{escalation_id}/handoff:
    post:
      operationId: OHN_61_API_046
      summary: Hand off to the receiving department/clinician; records handoff latency
      x-roles:
      - clinician
      - triage_lead
      x-purpose: triage_consultation
      security:
      - bearer: []
      parameters:
      - name: escalation_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EscalationHandoff'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Escalation'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/escalations/{escalation_id}/cancel:
    post:
      operationId: OHN_61_API_047
      summary: Cancel an escalation raised in error (triage_lead, reason)
      x-roles:
      - triage_lead
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: escalation_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Reasoned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Escalation'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/self-check-in:
    post:
      operationId: OHN_61_API_048
      summary: 'Patient self check-in at /p/triage (kiosk device or logged-in patient): Health ID + date of birth, appointment QR, or access card'
      x-roles:
      - kiosk_device
      - patient
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SelfCheckIn'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckInResult'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: self check-in disabled for the facility
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed, token_invalid, card_revoked (identification failures are generic and audited as public_token.fail)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: rate limited (10/min per device, 5 failures lock the device for 5 min)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/public/tickets/{token}:
    get:
      operationId: OHN_61_API_049
      summary: Privacy-safe live ticket status for /p/triage/ticket (no login; no name, Health ID, acuity or clinical data)
      x-roles: []
      x-purpose: triage_public_status
      security: []
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          minLength: 20
          maxLength: 64
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicTicketStatus'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: token expired or ticket closed for more than 1 h
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/tickets/{ticket_id}/slip:
    get:
      operationId: OHN_61_API_050
      summary: Printable ticket slip (ticket number, department, QR of the public status link); the public token is re-issued and the old one revoked
      x-roles:
      - receptionist
      - triage_officer
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: format
        in: query
        required: true
        schema:
          type: string
          enum:
          - pdf
          - escpos
      responses:
        '200':
          description: Slip
          content:
            application/pdf:
              schema:
                type: string
                format: binary
            application/octet-stream:
              schema:
                type: string
                format: binary
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/access-cards:
    post:
      operationId: OHN_61_API_051
      summary: Issue a facility access card for a patient (QR + number); replaces an older card
      x-roles:
      - receptionist
      - triage_admin
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccessCardIssue'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessCard'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/access-cards/lookup:
    get:
      operationId: OHN_61_API_052
      summary: Resolve a scanned card to its patient (receptionist; audited)
      x-roles:
      - receptionist
      - triage_officer
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: card_number
        in: query
        required: true
        schema:
          type: string
          minLength: 6
          maxLength: 64
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessCard'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: unknown card
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: card_revoked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/access-cards/{card_id}/revoke:
    post:
      operationId: OHN_61_API_053
      summary: Revoke a card
      x-roles:
      - receptionist
      - triage_admin
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: card_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Reasoned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessCard'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/settings:
    get:
      operationId: OHN_61_API_054
      summary: Facility triage settings
      x-roles:
      - triage_admin
      - triage_officer
      - receptionist
      - triage_lead
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FacilitySettings'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
    put:
      operationId: OHN_61_API_055
      summary: 'Update facility triage settings (operating rules). 1.3.7: care_team_relationship_hours (1-72, default 24) applies to registrations made after the change; existing assertions keep their expiry'
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FacilitySettingsWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FacilitySettings'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/rooms:
    get:
      operationId: OHN_61_API_056
      summary: Rooms of the facility
      x-roles:
      - triage_admin
      - triage_officer
      - receptionist
      - clinician
      - triage_lead
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: department_id
        in: query
        required: false
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Room'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
    post:
      operationId: OHN_61_API_057
      summary: Create a room
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoomWrite'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Room'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/rooms/{room_id}:
    put:
      operationId: OHN_61_API_058
      summary: Update a room
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: room_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoomWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Room'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/shifts:
    get:
      operationId: OHN_61_API_059
      summary: Shifts with staff assignments (roster)
      x-roles:
      - triage_admin
      - triage_manager
      - triage_lead
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: from
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: to
        in: query
        required: true
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Shift'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
    post:
      operationId: OHN_61_API_060
      summary: Create a shift with assignments
      x-roles:
      - triage_admin
      - triage_lead
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShiftWrite'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Shift'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: 'validation_failed: ends_at <= starts_at, over 24 h, unknown room, user not a member of the facility'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/shifts/{shift_id}:
    put:
      operationId: OHN_61_API_061
      summary: Replace a shift and its assignments
      x-roles:
      - triage_admin
      - triage_lead
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: shift_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShiftWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Shift'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/sync/batches:
    post:
      operationId: OHN_61_API_062
      summary: 'Offline sync from an OHN-26 edge node or offline tablet: apply queued operations in performed_at order; per-operation result'
      x-roles:
      - edge_sync
      - triage_officer
      - receptionist
      x-purpose: triage_sync
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SyncBatch'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncResult'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: offline_allowed is false for the facility
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
      description: 'Authorization is per operation: each operation is checked against the roles its online endpoint admits. A signed-in user uploads only their own work: an operation whose performed_by
        is someone else is rejected with performer_mismatch. An edge_sync node relays only the work of a person on a shift of the facility that covers performed_at; the operation then runs with that person''s
        shift role. Otherwise it is rejected with performer_not_on_shift, or forbidden when the shift role is not admitted by the online endpoint. These are per-operation errors in SyncResult.results[].error,
        not a failure of the batch. Each operation is applied exactly once, atomically with its idempotency record (client_op_id); a resend returns duplicate. An offline assessment or reassessment may set
        payload.vital_set_id to the client_op_id of a vitals operation from the same device; the server maps it to the vital set it created.'
  /api/ohn/v1/triage/sync/status:
    get:
      operationId: OHN_61_API_063
      summary: Sync state of a device
      x-roles:
      - triage_sync_operator
      - triage_admin
      x-purpose: triage_sync
      security:
      - bearer: []
      parameters:
      - name: device_id
        in: query
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 128
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncStatus'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/sync/conflicts:
    get:
      operationId: OHN_61_API_064
      summary: Open/resolved sync conflicts of the facility
      x-roles:
      - triage_sync_operator
      - triage_admin
      - triage_lead
      x-purpose: triage_sync
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: state
        in: query
        required: false
        schema:
          type: string
          enum:
          - open
          - resolved
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SyncConflict'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/sync/conflicts/{conflict_id}/resolve:
    post:
      operationId: OHN_61_API_065
      summary: 'Resolve a conflict (keep_server, apply_client, apply_as_reassessment, discard); clinical data is never silently discarded: discard needs a reason and keeps the payload in the audit'
      x-roles:
      - triage_sync_operator
      - triage_lead
      x-purpose: triage_sync
      security:
      - bearer: []
      parameters:
      - name: conflict_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SyncResolve'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncConflict'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: 'invalid_transition: the conflict is already resolved'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
      description: 'Resolution is serialized: once a conflict is resolved, a second resolver gets 409 invalid_transition (this conflict is already resolved) and the first resolution stands; the request
        carries no expected_version.'
  /api/ohn/v1/triage/audit:
    get:
      operationId: OHN_61_API_066
      summary: Immutable, scoped triage audit log (hash-chained; reads, mutations, denials, break-glass, public-token failures)
      x-roles:
      - triage_auditor
      x-purpose: triage_audit
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: from
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: to
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: ticket_id
        in: query
        required: false
        schema:
          type: string
          format: uuid
      - name: actor
        in: query
        required: false
        schema:
          type: string
      - name: action
        in: query
        required: false
        schema:
          type: string
      - name: outcome
        in: query
        required: false
        schema:
          type: string
          enum:
          - allowed
          - denied
          - failed
      - name: cursor
        in: query
        required: false
        schema:
          type: string
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 500
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AuditEntry'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/audit/verify:
    get:
      operationId: OHN_61_API_067
      summary: Verify the hash chain for a range (returns first broken seq or ok)
      x-roles:
      - triage_auditor
      x-purpose: triage_audit
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: from
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: to
        in: query
        required: true
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  ok:
                    type: boolean
                  checked:
                    type: integer
                  first_broken_seq:
                    type:
                    - integer
                    - 'null'
                required:
                - ok
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.1.0
  /api/ohn/v1/triage/tickets/{ticket_id}/assign:
    post:
      operationId: OHN_61_API_068
      summary: Assign a room and/or the receiving clinician (must be on a current shift of the department, else 422 clinician_not_on_shift)
      x-roles:
      - triage_officer
      - triage_lead
      - clinician
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Assign'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed or clinician_not_on_shift
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.2.0
  /api/ohn/v1/triage/tickets/{ticket_id}/handover/acknowledge:
    post:
      operationId: OHN_61_API_069
      summary: 'Receiving clinician acknowledges the handover (handover_state pending_ack -> acknowledged); unacknowledged after the facility''s escalation_ack_within_seconds becomes failed, stays visible
        and can be re-sent with POST /handover. 1.3.7: if the calling clinician has no active care_team relationship for this ticket''s patient, it is registered first, best effort: a failure is audited
        and does not stop this action (see POST /handover: OHN-61 (its own service identity, OHN-16 role care_team_registrar (OHN-16 1.3.0: care_team only, at most 72 h, revokes only its own), purpose relationship_registration)
        registers POST /api/ohn/v1/access/relationships with relationship_type care_team, actor_ref = the clinician''s OHN-06 practitioner id, patient_ref = the linked patient, facility_ref = the ticket''s
        facility, evidence_ref = ticket_id, valid_from = now - 1 minute, expires_at = valid_from + the facility''s care_team_relationship_hours (default 24, max 72); nothing is registered while an assertion
        for the same practitioner, patient and facility is still active. Audited (care_relationship.register), announced (triage.care_team.registered))'
      x-roles:
      - clinician
      - triage_lead
      x-purpose: triage_consultation
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Versioned'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: handover_not_pending or version_conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.2.0
  /api/ohn/v1/triage/payment-policy:
    get:
      operationId: OHN_61_API_070
      summary: The facility's active payment policy (read-only for admins; signed revision)
      x-roles:
      - triage_admin
      - triage_officer
      - receptionist
      - cashier
      - triage_lead
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentPolicy'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
    put:
      operationId: OHN_61_API_071
      summary: 'Set a new signed policy revision (approval_ref required). mode none keeps the 1.2 flow; pay_before_nurse turns the routine gate on. 1.3.6: a triage_admin (purpose triage_administration)
        signs only for the facility of its token''s organization_id, another facility answers 404; triage_governance_admin (purpose triage_governance) keeps every facility of the jurisdiction'
      x-roles:
      - triage_governance_admin
      - triage_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentPolicyWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentPolicy'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed or policy_not_signed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
      x-purposes:
      - triage_governance
      - triage_administration
  /api/ohn/v1/triage/tickets/{ticket_id}/first-look:
    post:
      operationId: OHN_61_API_072
      summary: Immediate trained-staff safety first-look, before any payment. Outcome emergency authorizes the emergency bypass at once (no billing call)
      x-roles:
      - triage_officer
      - triage_lead
      - emergency_clinician
      - receptionist
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FirstLook'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: receptionist may record only if the facility trained-staff list includes them
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/tickets/{ticket_id}/billing-intent:
    post:
      operationId: OHN_61_API_073
      summary: Ask the facility billing system (FacilityBillingPort; OHN-58 billing sandbox now, real hospital billing or mobile money later through the same port) to create the consultation invoice for
        this visit; stores the invoice reference only
      x-roles:
      - receptionist
      - cashier
      x-purpose: triage_billing
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingIntent'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancialState'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: 'billing_unavailable: the ticket stays payment_pending with a human resolution route'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/tickets/{ticket_id}/financial-state:
    get:
      operationId: OHN_61_API_074
      summary: Safe payment gate state of a ticket (staff). The patient reads their own payment details through GET /public/tickets/{token}/payment
      x-roles:
      - receptionist
      - cashier
      - triage_officer
      - triage_lead
      x-purpose: triage_billing
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancialState'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/billing/payment-verifications:
    post:
      operationId: OHN_61_API_075
      summary: Server-to-server from the authoritative billing system (service role billing_service, mutually authenticated). Idempotent per finance_event_id. OHN-61 re-queries the ledger; only a settled,
        exact match clears the gate and recomputes the nurse-ready queue. Client callbacks, receipt photos and unverified webhooks are never accepted, except a cashier's audited manual confirmation (OHN_61_API_104)
      x-roles:
      - billing_service
      x-purpose: triage_billing
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentVerification'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentVerificationResult'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: mismatch (visit, facility, invoice, amount or currency differ)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: billing_unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/tickets/{ticket_id}/emergency-bypass:
    post:
      operationId: OHN_61_API_076
      summary: 'Emergency-only bypass after check-in: no identity, payment, billing or network dependency; records reason, authorizer and authorizer role, and the immediate destination; charges are deferred,
        never marked paid or waived. A cashier bypass (waiting-area deterioration) also raises an escalation that clinical staff must acknowledge at once (handover to clinical staff)'
      x-roles:
      - triage_officer
      - triage_lead
      - emergency_clinician
      - cashier
      x-purpose: triage_emergency_bypass
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmergencyBypass'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: role not in the policy's bypass_roles
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/tickets/{ticket_id}/deferred-charges:
    post:
      operationId: OHN_61_API_077
      summary: Record deferred billing for a bypassed ticket (for later lawful processing); does not change clinical state
      x-roles:
      - cashier
      x-purpose: triage_billing
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeferredCharges'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancialState'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/queues/payment-pending:
    get:
      operationId: OHN_61_API_078
      summary: Register of routine tickets awaiting payment, by original arrival_seq (with first-look status; reassessment access stays open)
      x-roles:
      - receptionist
      - cashier
      - triage_officer
      - triage_lead
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: department_id
        in: query
        required: false
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PaymentPendingEntry'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/queues/nurse-ready:
    get:
      operationId: OHN_61_API_079
      summary: 'Eligible nurse queue only: tickets with no gate (financial_state not_applicable, policy none), R_CLEAR or E_BYPASS; emergency first, then acuity, then original arrival_seq; claimed/called/in-service
        tickets are never displaced'
      x-roles:
      - triage_officer
      - triage_lead
      x-purpose: triage_assessment
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: department_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueueView'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/queues/revisions:
    get:
      operationId: OHN_61_API_080
      summary: Audited queue position revisions (queue_reprioritizations report source)
      x-roles:
      - triage_lead
      - triage_manager
      - triage_auditor
      x-purpose: triage_reporting
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: department_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: from
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: to
        in: query
        required: true
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/QueueRevision'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/external-systems:
    get:
      operationId: OHN_61_API_081
      summary: Registered third-party triage systems
      x-roles:
      - triage_governance_admin
      - triage_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ExternalSystem'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
    post:
      operationId: OHN_61_API_082
      summary: Register a third-party triage system and its acuity code map (governance)
      x-roles:
      - triage_governance_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExternalSystemWrite'
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalSystem'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/external-systems/{system_id}:
    put:
      operationId: OHN_61_API_083
      summary: Update or suspend a third-party triage system
      x-roles:
      - triage_governance_admin
      x-purpose: triage_governance
      security:
      - bearer: []
      parameters:
      - name: system_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExternalSystemWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalSystem'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/external/encounters:
    post:
      operationId: OHN_61_API_084
      summary: 'Inbound triage from a registered third-party system: a FHIR R4 Bundle mapped to a ticket and assessment with Provenance; idempotent per Bundle.identifier; unmapped acuity stored as external_unmapped
        (never assigned); Flags raise the normal escalation path'
      x-roles:
      - external_triage_system
      x-purpose: triage_external_intake
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FhirBundle'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalIntakeResult'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: external_system_unknown or suspended, or facility not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: bundle_invalid (details per entry)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/patients/{patient_id}/triage-history:
    get:
      operationId: OHN_61_API_085
      summary: 'Triage history of a patient for the chart (OHN-08): every ticket, final level, encounter, vitals and preconsult documents, internal or external (OHN-16 decision purpose treatment; audited)'
      x-roles:
      - clinician
      - triage_officer
      - chart_service
      x-purpose: triage_consultation
      security:
      - bearer: []
      parameters:
      - name: patient_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: from
        in: query
        required: false
        schema:
          type: string
          format: date-time
      - name: cursor
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TriageHistoryItem'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Encounter:
    get:
      operationId: OHN_61_API_086
      summary: FHIR R4 search Encounter (patient, encounter, date, status, _lastUpdated); read-only facade over OHN-61 data; OHN-16 evaluated per resource
      x-roles:
      - clinician
      - triage_officer
      - external_triage_system
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: patient
        in: query
        required: false
        schema:
          type: string
      - name: encounter
        in: query
        required: false
        schema:
          type: string
      - name: date
        in: query
        required: false
        schema:
          type: string
      - name: _count
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Encounter/{resource_id}:
    get:
      operationId: OHN_61_API_087
      summary: FHIR R4 read Encounter
      x-roles:
      - clinician
      - triage_officer
      - external_triage_system
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: resource_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[A-Za-z0-9\-\.]{1,64}$
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Observation:
    get:
      operationId: OHN_61_API_088
      summary: FHIR R4 search Observation (patient, encounter, date, status, _lastUpdated); read-only facade over OHN-61 data; OHN-16 evaluated per resource
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: patient
        in: query
        required: false
        schema:
          type: string
      - name: encounter
        in: query
        required: false
        schema:
          type: string
      - name: date
        in: query
        required: false
        schema:
          type: string
      - name: _count
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Observation/{resource_id}:
    get:
      operationId: OHN_61_API_089
      summary: FHIR R4 read Observation
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: resource_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[A-Za-z0-9\-\.]{1,64}$
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/QuestionnaireResponse:
    get:
      operationId: OHN_61_API_090
      summary: FHIR R4 search QuestionnaireResponse (patient, encounter, date, status, _lastUpdated); read-only facade over OHN-61 data; OHN-16 evaluated per resource
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: patient
        in: query
        required: false
        schema:
          type: string
      - name: encounter
        in: query
        required: false
        schema:
          type: string
      - name: date
        in: query
        required: false
        schema:
          type: string
      - name: _count
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/QuestionnaireResponse/{resource_id}:
    get:
      operationId: OHN_61_API_091
      summary: FHIR R4 read QuestionnaireResponse
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: resource_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[A-Za-z0-9\-\.]{1,64}$
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Flag:
    get:
      operationId: OHN_61_API_092
      summary: FHIR R4 search Flag (patient, encounter, date, status, _lastUpdated); read-only facade over OHN-61 data; OHN-16 evaluated per resource
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: patient
        in: query
        required: false
        schema:
          type: string
      - name: encounter
        in: query
        required: false
        schema:
          type: string
      - name: date
        in: query
        required: false
        schema:
          type: string
      - name: _count
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Flag/{resource_id}:
    get:
      operationId: OHN_61_API_093
      summary: FHIR R4 read Flag
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: resource_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[A-Za-z0-9\-\.]{1,64}$
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Task:
    get:
      operationId: OHN_61_API_094
      summary: FHIR R4 search Task (patient, encounter, date, status, _lastUpdated); read-only facade over OHN-61 data; OHN-16 evaluated per resource
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: patient
        in: query
        required: false
        schema:
          type: string
      - name: encounter
        in: query
        required: false
        schema:
          type: string
      - name: date
        in: query
        required: false
        schema:
          type: string
      - name: _count
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Task/{resource_id}:
    get:
      operationId: OHN_61_API_095
      summary: FHIR R4 read Task
      x-roles:
      - clinician
      - triage_officer
      - fhir_client
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: resource_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[A-Za-z0-9\-\.]{1,64}$
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Provenance:
    get:
      operationId: OHN_61_API_096
      summary: FHIR R4 search Provenance (patient, encounter, date, status, _lastUpdated); read-only facade over OHN-61 data; OHN-16 evaluated per resource
      x-roles:
      - clinician
      - fhir_client
      - triage_auditor
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: patient
        in: query
        required: false
        schema:
          type: string
      - name: encounter
        in: query
        required: false
        schema:
          type: string
      - name: date
        in: query
        required: false
        schema:
          type: string
      - name: _count
        in: query
        required: false
        schema:
          type: integer
          maximum: 200
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/Provenance/{resource_id}:
    get:
      operationId: OHN_61_API_097
      summary: FHIR R4 read Provenance
      x-roles:
      - clinician
      - fhir_client
      - triage_auditor
      x-purpose: triage_interop
      security:
      - bearer: []
      parameters:
      - name: resource_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[A-Za-z0-9\-\.]{1,64}$
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/fhir/R4/metadata:
    get:
      operationId: OHN_61_API_098
      summary: FHIR R4 CapabilityStatement of the triage facade (public, no data)
      x-roles: []
      x-purpose: triage_interop
      security: []
      responses:
        '200':
          description: FHIR R4 resource or searchset Bundle
          content:
            application/fhir+json:
              schema:
                type: object
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/public/tickets/{token}/payment:
    get:
      operationId: OHN_61_API_099
      summary: The patient's own payment details for /p/triage/payment, by ticket token (no login; own ticket only). Shows 'verified_paid' only after billing verification; emergency_care never shows an
        amount due. Kept separate from the public status projection, which never carries payment data. Token failures are audited and rate-limited like /public/tickets/{token}
      x-roles: []
      x-purpose: triage_public_status
      security: []
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
          minLength: 20
          maxLength: 64
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicPaymentStatus'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: token expired or ticket closed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.0
  /api/ohn/v1/triage/public/departments:
    get:
      operationId: OHN_61_API_100
      summary: 'Departments a patient may choose at self check-in (/p/triage self check-in). Returns only active departments of a facility whose self_check_in_enabled is true. kiosk_device: facility_id
        must equal the token''s facility (else 403). patient: any facility of the token''s jurisdiction. 404 when the facility is unknown or self check-in is off. Every call is audited (actor, facility,
        result count). Since 1.3.4 each entry has name (the real name; null for sensitive departments), kind (null for sensitive) and public_label (what to display).'
      x-roles:
      - kiosk_device
      - patient
      x-purpose: triage_reception
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PublicDepartment'
                maxItems: 200
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: 'forbidden: kiosk_device token for another facility, or patient token for another jurisdiction'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'not_found: unknown facility, or self check-in is off for it'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.2
  /api/ohn/v1/triage/tariffs:
    get:
      operationId: OHN_61_API_101
      summary: The facility's price list (past and future entries) with its version
      x-roles:
      - triage_admin
      - cashier
      - triage_manager
      - triage_auditor
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TariffSchedule'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.4
    put:
      operationId: OHN_61_API_102
      summary: Replace the facility's price list (versioned and audited, same pattern as PUT /settings). Entries already in effect cannot be changed or removed (422 tariff_in_past); duplicate service_code
        + effective_from is 422 validation_failed
      x-roles:
      - triage_admin
      x-purpose: triage_administration
      security:
      - bearer: []
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TariffScheduleWrite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TariffSchedule'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: version_conflict, invalid_transition or idempotency_mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (details per field)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.4
  /api/ohn/v1/triage/tariffs/effective:
    get:
      operationId: OHN_61_API_103
      summary: 'The price in effect for a facility service at an instant (default now). 404 when none: the gate then never clears by itself and the cashier confirms payment by hand'
      x-roles:
      - triage_admin
      - cashier
      - receptionist
      - triage_manager
      - billing_service
      x-purpose: triage_billing
      security:
      - bearer: []
      parameters:
      - name: facility_id
        in: query
        required: true
        schema:
          type: string
          format: uuid
      - name: service_code
        in: query
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 64
      - name: at
        in: query
        required: false
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  facility_id:
                    type: string
                    format: uuid
                  service_code:
                    type: string
                  amount_minor:
                    type: integer
                  currency:
                    type: string
                  effective_from:
                    type: string
                    format: date-time
                  schedule_version:
                    type: integer
                required:
                - facility_id
                - service_code
                - amount_minor
                - currency
                - effective_from
                - schedule_version
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (bad query)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.4
  /api/ohn/v1/triage/tickets/{ticket_id}/payment-confirmations:
    post:
      operationId: OHN_61_API_104
      summary: 'A cashier confirms payment by hand when no automatic billing match exists (owner decision). Allowed only while the ticket is payment_pending with an outstanding financial_state under facility
        policy pay_before_nurse. If the visit has a charge (fixed charge, else the listed price in effect at billing intent, else the configured tariff), amount_minor and currency must equal it, else 409
        payment_not_verified with details.outcome mismatch. If the visit is unpriced (no price was in effect at billing intent: the case TariffSchedule leaves to the cashier), the confirmed amount and currency
        become the visit''s charge (FinancialState.charge_source cashier_entered); note is then required (at least 5 characters, the basis of the amount), else 422 validation_failed, and the audit action
        is payment.manual_confirm_unpriced. A visit never has its charge changed once set. On success the gate clears exactly as a verified payment does: financial_state becomes manually_confirmed_by_cashier,
        the ticket moves to waiting or triaged, the nurse-ready queue is recomputed, receipt_ref and the cashier are stored, triage.payment.confirmed is emitted with method manual, and audit action payment.manual_confirm
        is written'
      x-roles:
      - cashier
      x-purpose: triage_billing
      security:
      - bearer: []
      parameters:
      - name: ticket_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManualPaymentConfirmation'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentVerificationResult'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Role or OHN-16 policy denies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found or outside the caller's facility (never discloses existence)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: payment_not_verified (details.outcome mismatch), invalid_transition (not outstanding) or version_conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: validation_failed (for an unpriced visit, note with the basis of the amount is required)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-since: 1.3.6
  /health/ohn-61:
    get:
      operationId: OHN_61_HEALTH
      summary: Liveness/readiness of the module
      security: []
      responses:
        '200':
          description: OK
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 255
  schemas:
    Error:
      type: object
      additionalProperties: true
      properties:
        error:
          type: string
          description: 'Stable code: unauthenticated, forbidden, not_found, validation_failed, idempotency_key_required, idempotency_mismatch, version_conflict, invalid_transition, not_configured, demo_config_disabled,
            scale_not_approved, patient_not_identified, appointment_mismatch, upstream_unavailable, nothing_to_call, department_inactive, call_limit_reached, override_reason_required, referral_mismatch,
            export_not_allowed, claimed_by_other, claim_required, missing_vital_reason_required, reinstate_window_passed, escalation_closed, sync_conflict, token_invalid, card_revoked, break_glass_invalid,
            downgrade_requires_lead, clinician_not_on_shift, handover_not_pending, payment_required, payment_not_verified, billing_unavailable, policy_not_signed, first_look_required, external_system_unknown,
            bundle_invalid, acuity_unmapped, conflict, tariff_in_past, performer_mismatch, performer_not_on_shift (1.3.6: payment_not_verified details.outcome is mismatch for a manual confirmation)'
        message:
          type: string
        details: {}
      required:
      - error
    I18nText:
      type: object
      additionalProperties: false
      properties:
        en:
          type: string
          minLength: 1
          maxLength: 500
        fr:
          type: string
          minLength: 1
          maxLength: 500
      required:
      - en
      - fr
    Department:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        facility_id:
          type: string
          format: uuid
        code:
          type: string
          pattern: ^[A-Z0-9_]{2,16}$
        kind:
          type: string
          enum:
          - emergency
          - opd_general
          - eye
          - dental
          - maternity
          - paediatrics
          - cardiology
          - diabetes
          - ent
          - dermatology
          - mental_health
          - surgery
          - orthopaedics
          - anc_pnc
          - obgyn
          - neurology
          - nephrology
          - gastroenterology
          - respiratory
          - urology
          - hiv_art
          - oncology
          - immunization
          - laboratory
          - imaging
          - pharmacy
          - family_planning
          - other
        name:
          $ref: '#/components/schemas/I18nText'
        ticket_prefix:
          type: string
          pattern: ^[A-Z]{1,3}$
        max_calls_before_no_show:
          type: integer
          minimum: 1
          maximum: 10
        triage_required:
          type: boolean
          description: 'false: check-in goes straight to the consultation queue (no acuity); default true'
        allows_unidentified:
          type: boolean
          description: 'true only for kind emergency: tickets may start without an OHN-03 patient'
        rooms:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 32
          maxItems: 50
          description: 'deprecated in 1.1.0: use /rooms'
        active:
          type: boolean
        version:
          type: integer
        sensitive:
          type: boolean
          description: 'true for private services (default for hiv_art, mental_health, family_planning): public display, public status and SMS use public_label, never the department name; capture only in
            private rooms or by the patient''s own device'
        public_label:
          $ref: '#/components/schemas/I18nText'
          description: neutral label shown publicly when sensitive (required then), e.g. 'Clinic B'
        safety_screen_required:
          type: boolean
          description: 'default true: the universal danger-sign screen (OHN-62 kind safety_screen) runs before department questions at check-in'
      required:
      - id
      - facility_id
      - code
      - kind
      - name
      - ticket_prefix
      - max_calls_before_no_show
      - active
      - version
    DepartmentWrite:
      type: object
      additionalProperties: false
      properties:
        code:
          type: string
          pattern: ^[A-Z0-9_]{2,16}$
        kind:
          type: string
          enum:
          - emergency
          - opd_general
          - eye
          - dental
          - maternity
          - paediatrics
          - cardiology
          - diabetes
          - ent
          - dermatology
          - mental_health
          - surgery
          - orthopaedics
          - anc_pnc
          - obgyn
          - neurology
          - nephrology
          - gastroenterology
          - respiratory
          - urology
          - hiv_art
          - oncology
          - immunization
          - laboratory
          - imaging
          - pharmacy
          - family_planning
          - other
        name:
          $ref: '#/components/schemas/I18nText'
        ticket_prefix:
          type: string
          pattern: ^[A-Z]{1,3}$
        max_calls_before_no_show:
          type: integer
          minimum: 1
          maximum: 10
        triage_required:
          type: boolean
        allows_unidentified:
          type: boolean
        rooms:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 32
          maxItems: 50
        active:
          type: boolean
        expected_version:
          type: integer
          description: required on update
        sensitive:
          type: boolean
          description: 'true for private services (default for hiv_art, mental_health, family_planning): public display, public status and SMS use public_label, never the department name; capture only in
            private rooms or by the patient''s own device'
        public_label:
          $ref: '#/components/schemas/I18nText'
          description: neutral label shown publicly when sensitive (required then), e.g. 'Clinic B'
        safety_screen_required:
          type: boolean
          description: 'default true: the universal danger-sign screen (OHN-62 kind safety_screen) runs before department questions at check-in'
      required:
      - code
      - kind
      - name
      - ticket_prefix
      - max_calls_before_no_show
    ScaleLevel:
      type: object
      additionalProperties: false
      properties:
        code:
          type: string
          pattern: ^[a-z0-9_]{1,32}$
        rank:
          type: integer
          minimum: 1
          maximum: 10
          description: 1 = most urgent
        label:
          $ref: '#/components/schemas/I18nText'
        colour:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
        target_minutes_to_clinician:
          type:
          - integer
          - 'null'
          minimum: 0
          description: from the approved scale; null = no target
        reassess_every_minutes:
          type:
          - integer
          - 'null'
          minimum: 1
        emergency:
          type: boolean
          description: assigning this level raises an emergency escalation automatically
      required:
      - code
      - rank
      - label
      - colour
      - target_minutes_to_clinician
      - reassess_every_minutes
    ScaleCondition:
      type: object
      additionalProperties: false
      properties:
        input:
          type: string
          description: vital name (e.g. heart_rate_bpm), 'age_months', 'discriminator:<id>' or 'preconsult_flag:<rule_id>'
        op:
          type: string
          enum:
          - lt
          - lte
          - gt
          - gte
          - eq
          - neq
          - between
          - in
          - present
          - absent
        value: {}
        value2: {}
      required:
      - input
      - op
    ScaleRule:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          pattern: ^[a-z0-9_.-]{1,64}$
        type:
          type: string
          enum:
          - level_if_all
          - level_if_any
          - score
        applies_to:
          type: object
          additionalProperties: false
          properties:
            age_min_months:
              type: integer
              minimum: 0
            age_max_months:
              type: integer
              minimum: 0
            department_kinds:
              type: array
              items:
                type: string
                enum:
                - emergency
                - opd_general
                - eye
                - dental
                - maternity
                - paediatrics
                - cardiology
                - diabetes
                - ent
                - dermatology
                - mental_health
                - surgery
                - orthopaedics
                - anc_pnc
                - obgyn
                - neurology
                - nephrology
                - gastroenterology
                - respiratory
                - urology
                - hiv_art
                - oncology
                - immunization
                - laboratory
                - imaging
                - pharmacy
                - family_planning
                - other
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/ScaleCondition'
          maxItems: 20
        assign_level:
          type: string
        score_components:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              input:
                type: string
              bands:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    min:
                      type: number
                    max:
                      type: number
                    equals: {}
                    points:
                      type: integer
                  required:
                  - points
            required:
            - input
            - bands
        level_by_score:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              min:
                type: integer
              max:
                type: integer
              level:
                type: string
            required:
            - min
            - level
        explanation:
          $ref: '#/components/schemas/I18nText'
        escalate:
          type: boolean
          description: this rule firing raises an emergency escalation (emergency sign), whatever the level
      required:
      - id
      - type
    Discriminator:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          pattern: ^[a-z0-9_.-]{1,64}$
        label:
          $ref: '#/components/schemas/I18nText'
        level:
          type: string
          description: level code assigned when ticked; may be absent when only used by rules
        applies_to:
          type: object
          additionalProperties: false
          properties:
            age_min_months:
              type: integer
            age_max_months:
              type: integer
            department_kinds:
              type: array
              items:
                type: string
                enum:
                - emergency
                - opd_general
                - eye
                - dental
                - maternity
                - paediatrics
                - cardiology
                - diabetes
                - ent
                - dermatology
                - mental_health
                - surgery
                - orthopaedics
                - anc_pnc
                - obgyn
                - neurology
                - nephrology
                - gastroenterology
                - respiratory
                - urology
                - hiv_art
                - oncology
                - immunization
                - laboratory
                - imaging
                - pharmacy
                - family_planning
                - other
      required:
      - id
      - label
    TriageScaleDocument:
      type: object
      additionalProperties: false
      properties:
        code:
          type: string
          pattern: ^[A-Z0-9_-]{2,32}$
          description: e.g. SATS, ESI, MTS or a ministry code
        name:
          $ref: '#/components/schemas/I18nText'
        source_reference:
          type: string
          minLength: 1
          maxLength: 500
        levels:
          type: array
          items:
            $ref: '#/components/schemas/ScaleLevel'
          minItems: 2
          maxItems: 10
        discriminators:
          type: array
          items:
            $ref: '#/components/schemas/Discriminator'
          maxItems: 500
        rules:
          type: array
          items:
            $ref: '#/components/schemas/ScaleRule'
          maxItems: 500
        default_level_when_no_rule:
          type:
          - string
          - 'null'
          description: level code, or null = the officer must choose (override with reason)
        allow_downgrade_override:
          type: boolean
        input_limits:
          type: object
          description: per vital {min,max} plausibility limits; only these are enforced beyond units
          additionalProperties:
            type: object
            additionalProperties: false
            properties:
              min:
                type: number
              max:
                type: number
        required_inputs:
          type: array
          items:
            type: string
          description: vitals that must be recorded or given a missing reason before an assessment (422 missing_vital_reason_required)
      required:
      - code
      - name
      - levels
      - discriminators
      - rules
      - default_level_when_no_rule
    TriageScaleVersion:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        jurisdiction_id:
          type: string
          format: uuid
        code:
          type: string
        version:
          type: integer
        state:
          type: string
          enum:
          - draft
          - active
          - retired
        approval_ref:
          type:
          - string
          - 'null'
        synthetic_demo:
          type: boolean
        clinically_approved:
          type: boolean
          description: false for the synthetic demo scale
        activated_at:
          type:
          - string
          - 'null'
          format: date-time
        activated_by:
          type:
          - string
          - 'null'
        document:
          $ref: '#/components/schemas/TriageScaleDocument'
        row_version:
          type: integer
      required:
      - id
      - jurisdiction_id
      - code
      - version
      - state
      - synthetic_demo
      - document
    ScaleActivate:
      type: object
      additionalProperties: false
      properties:
        approval_ref:
          type: string
          minLength: 3
          maxLength: 128
        expected_version:
          type: integer
      required:
      - approval_ref
      - expected_version
    UnidentifiedPatient:
      type: object
      additionalProperties: false
      properties:
        sex:
          type: string
          enum:
          - female
          - male
          - unknown
        approx_age_years:
          type: integer
          minimum: 0
          maximum: 130
        description:
          type: string
          minLength: 3
          maxLength: 500
      required:
      - description
    CheckIn:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        arrival_source:
          type: string
          enum:
          - walk_in
          - appointment
          - referral_in
          - transfer_in
          - ambulance
        patient_id:
          type: string
          format: uuid
          description: OHN-03 patient id; required unless unidentified is given
        unidentified:
          $ref: '#/components/schemas/UnidentifiedPatient'
        appointment_id:
          type: string
          format: uuid
          description: required when arrival_source = appointment
        referral_id:
          type: string
          format: uuid
        arrived_at:
          type: string
          format: date-time
          description: default now; not in the future, not more than 12 h back
        presenting_complaint:
          $ref: '#/components/schemas/ComplaintRef'
        notify_opt_in:
          type: boolean
          description: call notification by SMS/USSD via OHN-53 (verified contact only)
        language:
          type: string
          enum:
          - en
          - fr
        identification:
          type: object
          additionalProperties: false
          properties:
            method:
              type: string
              enum:
              - health_id
              - search
              - qr
              - access_card
            value:
              type: string
              minLength: 1
              maxLength: 128
            date_of_birth:
              type: string
              format: date
              description: second factor for health_id at self check-in
          required:
          - method
        room_id:
          type: string
          format: uuid
        emergency_bypass:
          type: object
          additionalProperties: false
          properties:
            reason:
              type: string
              minLength: 3
              maxLength: 500
          required:
          - reason
          description: 'staff-declared emergency: identity optional for any department (ticket is unidentified until linked), no questionnaire, routed to the facility''s emergency department unless department_id
            is itself emergency'
        visit_type:
          type: string
          enum:
          - new
          - follow_up
          - review
      required:
      - facility_id
      - department_id
      - arrival_source
    ComplaintRef:
      type: object
      additionalProperties: false
      properties:
        code_system:
          type: string
          enum:
          - snomed_ct
          - local
        code:
          type: string
          minLength: 1
          maxLength: 64
        text:
          type: string
          minLength: 1
          maxLength: 500
    Signal:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        source:
          type: string
          enum:
          - OHN-62
          - staff
        kind:
          type: string
          enum:
          - flag_officer
          - raise_priority
          - urgent_review
          - screen_incomplete
        rule_id:
          type: string
        response_id:
          type: string
          format: uuid
        message:
          $ref: '#/components/schemas/I18nText'
        raised_at:
          type: string
          format: date-time
        acknowledged_at:
          type:
          - string
          - 'null'
          format: date-time
      required:
      - source
      - kind
      - message
    SignalCreate:
      type: object
      additionalProperties: false
      properties:
        source:
          type: string
          enum:
          - OHN-62
        kind:
          type: string
          enum:
          - flag_officer
          - raise_priority
          - urgent_review
          - screen_incomplete
        rule_id:
          type: string
          minLength: 1
          maxLength: 64
        response_id:
          type: string
          format: uuid
        definition_version:
          type: integer
        message:
          $ref: '#/components/schemas/I18nText'
      required:
      - source
      - kind
      - rule_id
      - response_id
      - message
    Ticket:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        ticket_number:
          type: string
          description: <prefix>-<seq>, sequence per department per local day, e.g. E-014
        facility_id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        patient_id:
          type:
          - string
          - 'null'
          format: uuid
        health_id:
          type:
          - string
          - 'null'
          description: masked except for roles with triage_assessment/triage_consultation
        display_name:
          type:
          - string
          - 'null'
        unidentified:
          oneOf:
          - $ref: '#/components/schemas/UnidentifiedPatient'
          - type: 'null'
        arrival_source:
          type: string
        appointment_id:
          type:
          - string
          - 'null'
          format: uuid
        referral_id:
          type:
          - string
          - 'null'
          format: uuid
        state:
          type: string
          enum:
          - waiting
          - called
          - in_triage
          - triaged
          - consult_called
          - in_consultation
          - completed
          - no_show
          - left_without_being_seen
          - transferred
          - referred
          - cancelled
          - payment_pending
        arrived_at:
          type: string
          format: date-time
        triage_started_at:
          type:
          - string
          - 'null'
          format: date-time
        triaged_at:
          type:
          - string
          - 'null'
          format: date-time
        consultation_started_at:
          type:
          - string
          - 'null'
          format: date-time
        closed_at:
          type:
          - string
          - 'null'
          format: date-time
        acuity:
          oneOf:
          - $ref: '#/components/schemas/AcuityRef'
          - type: 'null'
        priority_flag:
          type: boolean
        signals:
          type: array
          items:
            $ref: '#/components/schemas/Signal'
        call_count:
          type: integer
        last_called_at:
          type:
          - string
          - 'null'
          format: date-time
        called_to:
          type:
          - string
          - 'null'
        waiting_minutes:
          type: integer
        target_breached:
          type: boolean
        reassessment_due_at:
          type:
          - string
          - 'null'
          format: date-time
        reassessment_overdue:
          type: boolean
        handover_department_id:
          type:
          - string
          - 'null'
          format: uuid
        encounter_id:
          type:
          - string
          - 'null'
          format: uuid
          description: OHN-09 triage encounter
        preconsult:
          type: object
          additionalProperties: false
          properties:
            state:
              type: string
              enum:
              - none_configured
              - not_started
              - in_progress
              - submitted
              - unknown
            response_ids:
              type: array
              items:
                type: string
                format: uuid
            red_flag_count:
              type: integer
          required:
          - state
        outcome:
          type:
          - string
          - 'null'
        outcome_reason:
          type:
          - string
          - 'null'
        notify_opt_in:
          type: boolean
        version:
          type: integer
        claimed_by:
          type:
          - string
          - 'null'
          description: user id holding the claim lock
        claim_expires_at:
          type:
          - string
          - 'null'
          format: date-time
        open_escalation_id:
          type:
          - string
          - 'null'
          format: uuid
        identification_method:
          type: string
          enum:
          - health_id
          - search
          - qr
          - access_card
          - unidentified
        room_id:
          type:
          - string
          - 'null'
          format: uuid
        shift_id:
          type:
          - string
          - 'null'
          format: uuid
        sync_origin:
          type: string
          enum:
          - online
          - offline
        offline_number:
          type:
          - string
          - 'null'
          description: ticket number printed offline before sync
        emergency:
          type: boolean
          description: 'emergency bypass: sorted before every other ticket, skips questionnaires, identity and any administrative or payment prerequisite'
        safety_screen:
          type: string
          enum:
          - not_configured
          - pending
          - negative
          - positive
          - incomplete
        assigned_room_id:
          type:
          - string
          - 'null'
          format: uuid
        assigned_clinician:
          type:
          - string
          - 'null'
          description: user id of the clinician the patient is handed to
        handover_state:
          type: string
          enum:
          - none
          - pending_ack
          - acknowledged
          - failed
        handover_acknowledged_at:
          type:
          - string
          - 'null'
          format: date-time
        financial_state:
          type: string
          enum:
          - not_applicable
          - invoice_not_created
          - payment_required
          - payment_pending
          - payment_processing
          - payment_failed
          - partial_payment
          - refund_under_review
          - coverage_pending
          - insurance_eligible_unpaid
          - insurance_authorized_unpaid
          - invoice_paid_in_full_verified
          - manually_confirmed_by_cashier
          - emergency_bypass_authorized
          - visit_cancelled
          - visit_departed
          description: 'payment gate state. not_applicable when the facility payment_policy is none. Nurse-eligible: not_applicable (policy none: no gate, the 1.2 flow), invoice_paid_in_full_verified or
            manually_confirmed_by_cashier (R_CLEAR; 1.3.6: the second is a cashier''s audited manual confirmation, kept distinct for auditors) or emergency_bypass_authorized (E_BYPASS); every other value
            is R_OUTSTANDING or terminal and is not eligible'
        arrival_seq:
          type: integer
          description: original check-in rank within the department and day; kept while payment is pending and used as the tie-break after acuity
        first_look:
          oneOf:
          - type: object
            additionalProperties: false
            properties:
              at:
                type: string
                format: date-time
              by:
                type: string
              outcome:
                type: string
                enum:
                - routine
                - emergency
            required:
            - at
            - by
            - outcome
          - type: 'null'
        queue_position:
          type:
          - integer
          - 'null'
          description: 1-based position in the nurse-ready queue; null while not eligible or once claimed/called/in service
        source_system:
          type:
          - string
          - 'null'
          description: external triage system id when the assessment came in through the interop surface
        bypass:
          oneOf:
          - type: object
            additionalProperties: false
            properties:
              at:
                type: string
                format: date-time
              by:
                type: string
              by_role:
                type: string
                enum:
                - triage_officer
                - triage_lead
                - emergency_clinician
                - cashier
              reason:
                type: string
              escalation_id:
                type:
                - string
                - 'null'
                format: uuid
            required:
            - at
            - by
            - by_role
            - reason
          - type: 'null'
          description: who authorized the emergency bypass (audited)
        care_team_access:
          oneOf:
          - $ref: '#/components/schemas/CareTeamAccess'
          - type: 'null'
          description: '1.3.7: null before any handover'
          x-since: 1.3.7
      required:
      - id
      - ticket_number
      - facility_id
      - department_id
      - state
      - arrived_at
      - call_count
      - version
    AcuityRef:
      type: object
      additionalProperties: false
      properties:
        level:
          type: string
        rank:
          type: integer
        colour:
          type: string
        label:
          $ref: '#/components/schemas/I18nText'
        source:
          type: string
          enum:
          - computed
          - override
        scale_version_id:
          type: string
          format: uuid
        synthetic_demo:
          type: boolean
        target_minutes_to_clinician:
          type:
          - integer
          - 'null'
      required:
      - level
      - rank
      - colour
      - label
      - source
      - scale_version_id
    QueueView:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        view:
          type: string
          enum:
          - triage
          - consultation
          - nurse_ready
        generated_at:
          type: string
          format: date-time
        scale:
          oneOf:
          - type: object
            additionalProperties: false
            properties:
              id:
                type: string
                format: uuid
              code:
                type: string
              version:
                type: integer
              synthetic_demo:
                type: boolean
            required:
            - id
            - code
            - version
            - synthetic_demo
          - type: 'null'
          description: null = no approved scale (acuity cannot be assigned)
        counts:
          type: object
          additionalProperties:
            type: integer
        entries:
          type: array
          items:
            $ref: '#/components/schemas/Ticket'
        revision:
          type: integer
          description: queue revision; changes on every recompute
      required:
      - facility_id
      - department_id
      - view
      - generated_at
      - scale
      - entries
    Call:
      type: object
      additionalProperties: false
      properties:
        room:
          type: string
          minLength: 1
          maxLength: 32
        expected_version:
          type: integer
      required:
      - expected_version
    CallNext:
      type: object
      additionalProperties: false
      properties:
        view:
          type: string
          enum:
          - triage
          - consultation
        room:
          type: string
          minLength: 1
          maxLength: 32
      required:
      - view
    Versioned:
      type: object
      additionalProperties: false
      properties:
        expected_version:
          type: integer
      required:
      - expected_version
    Reasoned:
      type: object
      additionalProperties: false
      properties:
        expected_version:
          type: integer
        reason:
          type: string
          minLength: 5
          maxLength: 1000
      required:
      - expected_version
      - reason
    Vitals:
      type: object
      additionalProperties: false
      properties:
        temperature_c:
          type: number
        heart_rate_bpm:
          type: integer
        respiratory_rate_bpm:
          type: integer
        systolic_mmhg:
          type: integer
        diastolic_mmhg:
          type: integer
        spo2_pct:
          type: integer
          minimum: 0
          maximum: 100
        on_oxygen:
          type: boolean
        weight_kg:
          type: number
        height_cm:
          type: number
        bmi:
          type: number
          readOnly: true
          description: computed weight/height^2 when both are present
        blood_glucose_mmol_l:
          type: number
        pain_score:
          type: integer
          minimum: 0
          maximum: 10
        avpu:
          type: string
          enum:
          - A
          - V
          - P
          - U
        gcs:
          type: object
          additionalProperties: false
          properties:
            eye:
              type: integer
              minimum: 1
              maximum: 4
            verbal:
              type: integer
              minimum: 1
              maximum: 5
            motor:
              type: integer
              minimum: 1
              maximum: 6
            total:
              type: integer
              readOnly: true
          required:
          - eye
          - verbal
          - motor
        paediatric:
          type: object
          additionalProperties: false
          properties:
            capillary_refill_s:
              type: number
            muac_mm:
              type: integer
            length_cm:
              type: number
            head_circumference_cm:
              type: number
            weight_for_age_note:
              type: string
              minLength: 1
              maxLength: 200
        pregnant:
          type:
          - boolean
          - 'null'
        mobility:
          type: string
          enum:
          - walking
          - assisted
          - stretcher
    VitalsCreate:
      type: object
      additionalProperties: false
      properties:
        vitals:
          $ref: '#/components/schemas/Vitals'
        measured_at:
          type: string
          format: date-time
        expected_version:
          type: integer
        not_taken:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              field:
                type: string
              reason_code:
                type: string
                minLength: 1
                maxLength: 64
              note:
                type: string
                minLength: 0
                maxLength: 500
            required:
            - field
            - reason_code
          maxItems: 30
          description: 'reason code from the facility settings list missing_vital_reasons (default list: patient_declined, equipment_unavailable, not_measurable, not_indicated_by_scale, deferred_for_resuscitation);
            the list is configuration'
        kind:
          type: string
          enum:
          - first_look
          - routine
          description: first_look vitals are allowed before payment when clinically necessary to identify an emergency; routine vitals need R_CLEAR or E_BYPASS (409 payment_required)
      required:
      - vitals
      - measured_at
      - expected_version
    VitalSet:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        ticket_id:
          type: string
          format: uuid
        vitals:
          $ref: '#/components/schemas/Vitals'
        measured_at:
          type: string
          format: date-time
        recorded_by:
          type: string
        record_sync:
          type: string
          enum:
          - pending_patient_link
          - pending_upstream
          - synced
          - failed
        observation_ids:
          type: array
          items:
            type: string
            format: uuid
          description: OHN-10 observation ids once synced
        not_taken:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              field:
                type: string
              reason_code:
                type: string
                minLength: 1
                maxLength: 64
              note:
                type: string
                minLength: 0
                maxLength: 500
            required:
            - field
            - reason_code
          maxItems: 30
          description: 'reason code from the facility settings list missing_vital_reasons (default list: patient_declined, equipment_unavailable, not_measurable, not_indicated_by_scale, deferred_for_resuscitation);
            the list is configuration'
        kind:
          type: string
          enum:
          - initial
          - repeat
          - first_look
      required:
      - id
      - ticket_id
      - vitals
      - measured_at
      - recorded_by
      - record_sync
    EvaluateRequest:
      type: object
      additionalProperties: false
      properties:
        ticket_id:
          type: string
          format: uuid
        vitals:
          $ref: '#/components/schemas/Vitals'
        discriminator_ids:
          type: array
          items:
            type: string
          maxItems: 50
      required:
      - ticket_id
    Evaluation:
      type: object
      additionalProperties: false
      properties:
        scale_version_id:
          type: string
          format: uuid
        computed_level:
          type:
          - string
          - 'null'
          description: null when no rule fired and default_level_when_no_rule is null
        fired_rules:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              rule_id:
                type: string
              level:
                type: string
              score:
                type: integer
              explanation:
                $ref: '#/components/schemas/I18nText'
            required:
            - rule_id
            - level
        missing_inputs:
          type: array
          items:
            type: string
        synthetic_demo:
          type: boolean
        disclaimer:
          type:
          - string
          - 'null'
          description: 'set for the demo scale: NOT CLINICALLY APPROVED'
      required:
      - scale_version_id
      - computed_level
      - fired_rules
      - missing_inputs
      - synthetic_demo
    AssessmentCreate:
      type: object
      additionalProperties: false
      properties:
        vital_set_id:
          type: string
          format: uuid
        presenting_complaint:
          $ref: '#/components/schemas/ComplaintRef'
        discriminator_ids:
          type: array
          items:
            type: string
          maxItems: 50
        notes:
          type: string
          minLength: 0
          maxLength: 4000
        override:
          type: object
          additionalProperties: false
          properties:
            level:
              type: string
            reason:
              type: string
              minLength: 10
              maxLength: 1000
              description: required for any override; an override BELOW the previous final level of this ticket also needs role triage_lead (no automatic downgrade)
          required:
          - level
          - reason
        handover_department_id:
          type: string
          format: uuid
        expected_version:
          type: integer
        escalate:
          type: boolean
          description: officer raises an emergency escalation with this assessment
      required:
      - vital_set_id
      - presenting_complaint
      - expected_version
    Assessment:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        ticket_id:
          type: string
          format: uuid
        kind:
          type: string
          enum:
          - initial
          - reassessment
        scale_version_id:
          type: string
          format: uuid
        vital_set_id:
          type: string
          format: uuid
        computed_level:
          type:
          - string
          - 'null'
        final_level:
          type: string
        override:
          oneOf:
          - type: object
            additionalProperties: false
            properties:
              from:
                type:
                - string
                - 'null'
              to:
                type: string
              reason:
                type: string
            required:
            - from
            - to
            - reason
          - type: 'null'
        fired_rules:
          type: array
          items:
            type: string
        discriminator_ids:
          type: array
          items:
            type: string
        presenting_complaint:
          $ref: '#/components/schemas/ComplaintRef'
        notes:
          type:
          - string
          - 'null'
        assessed_by:
          type: string
        assessed_at:
          type: string
          format: date-time
        encounter_id:
          type:
          - string
          - 'null'
          format: uuid
      required:
      - id
      - ticket_id
      - kind
      - scale_version_id
      - computed_level
      - final_level
      - assessed_by
      - assessed_at
    Handover:
      type: object
      additionalProperties: false
      properties:
        department_id:
          type: string
          format: uuid
        note:
          type: string
          minLength: 0
          maxLength: 2000
        expected_version:
          type: integer
        receiving_practitioner_ids:
          type: array
          items:
            type: string
            format: uuid
          maxItems: 20
          uniqueItems: true
          x-since: 1.3.7
          description: '1.3.7: optional OHN-06 practitioner ids of receiving clinicians the handover names; OHN-61 registers their care_team relationships at once. Everyone else is registered lazily when
            they take up the ticket'
      required:
      - department_id
      - expected_version
    Outcome:
      type: object
      additionalProperties: false
      properties:
        outcome:
          type: string
          enum:
          - left_without_being_seen
          - transferred
          - referred
          - cancelled
        reason:
          type: string
          minLength: 5
          maxLength: 1000
        referral_id:
          type: string
          format: uuid
          description: 'required for referred: an OHN-27 referral of the same patient'
        destination_facility_id:
          type: string
          format: uuid
          description: required for transferred
        expected_version:
          type: integer
      required:
      - outcome
      - reason
      - expected_version
    LinkPatient:
      type: object
      additionalProperties: false
      properties:
        patient_id:
          type: string
          format: uuid
        expected_version:
          type: integer
      required:
      - patient_id
      - expected_version
    TriageSummary:
      type: object
      additionalProperties: false
      properties:
        ticket:
          $ref: '#/components/schemas/Ticket'
        patient:
          type: object
          additionalProperties: true
          properties:
            patient_id:
              type: string
              format: uuid
            health_id:
              type: string
            display_name:
              type: string
            sex:
              type: string
            age_years:
              type: integer
        vital_sets:
          type: array
          items:
            $ref: '#/components/schemas/VitalSet'
        assessments:
          type: array
          items:
            $ref: '#/components/schemas/Assessment'
        signals:
          type: array
          items:
            $ref: '#/components/schemas/Signal'
        preconsult_response_ids:
          type: array
          items:
            type: string
            format: uuid
        history:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              at:
                type: string
                format: date-time
              from:
                type:
                - string
                - 'null'
              to:
                type: string
              by:
                type: string
              reason:
                type:
                - string
                - 'null'
            required:
            - at
            - from
            - to
            - by
      required:
      - ticket
      - vital_sets
      - assessments
      - signals
    Display:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        facility_id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 80
        department_ids:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
        language:
          type: string
          enum:
          - en
          - fr
          - en_fr
        active:
          type: boolean
        version:
          type: integer
      required:
      - id
      - facility_id
      - name
      - department_ids
      - active
    DisplayWrite:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 80
        department_ids:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
          maxItems: 20
        language:
          type: string
          enum:
          - en
          - fr
          - en_fr
        active:
          type: boolean
        expected_version:
          type: integer
      required:
      - name
      - department_ids
    DisplayFeed:
      type: object
      additionalProperties: false
      properties:
        display_id:
          type: string
          format: uuid
        generated_at:
          type: string
          format: date-time
        calls:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              ticket_number:
                type: string
              room:
                type:
                - string
                - 'null'
              called_at:
                type: string
                format: date-time
              department_code:
                type: string
              department_name:
                $ref: '#/components/schemas/I18nText'
            required:
            - ticket_number
            - room
            - called_at
            - department_code
          description: last 10 calls, newest first; ticket numbers only, never names, Health IDs or acuity
      required:
      - display_id
      - generated_at
      - calls
    ReportRow:
      type: object
      additionalProperties: true
      properties:
        date:
          type: string
          format: date
        department_id:
          type: string
          format: uuid
        arrivals:
          type: integer
        triaged:
          type: integer
        median_minutes_to_triage:
          type:
          - number
          - 'null'
        p90_minutes_to_triage:
          type:
          - number
          - 'null'
        median_minutes_to_clinician:
          type:
          - number
          - 'null'
        p90_minutes_to_clinician:
          type:
          - number
          - 'null'
        median_total_wait_minutes:
          type:
          - number
          - 'null'
        acuity_mix:
          type: object
          additionalProperties:
            type: integer
        lwbs:
          type: integer
        lwbs_rate:
          type:
          - number
          - 'null'
        no_show:
          type: integer
        target_breaches:
          type: integer
        target_breach_rate:
          type:
          - number
          - 'null'
        overrides:
          type: integer
      required: []
      description: one row per combination of the requested dimensions; metric columns per report (module.md F009)
    Report:
      type: object
      additionalProperties: false
      properties:
        report_id:
          type: string
          enum:
          - daily_attendance
          - triage_queue_times
          - assessment_completion
          - emergency_escalations
          - doctor_handoffs
          - access_and_privacy
          - flow_and_capacity
          - OHN-61-R001
          - OHN-61-R002
          - OHN-61-R003
          - sync_health
          - payment_gate_audit
          - cashier_to_nurse_latency
          - queue_reprioritizations
        from:
          type: string
          format: date
        to:
          type: string
          format: date
        facility_id:
          type: string
          format: uuid
        rows:
          type: array
          items:
            $ref: '#/components/schemas/ReportRow'
        totals:
          $ref: '#/components/schemas/ReportRow'
        small_cell_suppressed:
          type: boolean
        dimensions:
          type: array
          items:
            type: string
            enum:
            - facility
            - department
            - date
            - shift
            - acuity
            - staff_role
            - time
            - protocol_version
            - destination
            - day
            - zone
            - hour
            - device
      required:
      - report_id
      - from
      - to
      - rows
    Page:
      type: object
      additionalProperties: false
      properties:
        items:
          type: array
          items: {}
        next_cursor:
          type:
          - string
          - 'null'
      required:
      - items
    ExportRequest:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        from:
          type: string
          format: date
        to:
          type: string
          format: date
        department_id:
          type: string
          format: uuid
        format:
          type: string
          enum:
          - csv
          - pdf
        group_by:
          type: array
          items:
            type: string
            enum:
            - facility
            - department
            - date
            - shift
            - acuity
            - staff_role
            - time
            - protocol_version
            - destination
            - day
      required:
      - facility_id
      - from
      - to
      - format
    CheckInResult:
      allOf:
      - $ref: '#/components/schemas/Ticket'
      - type: object
        additionalProperties: true
        properties:
          public_token:
            type: string
            description: returned ONCE at check-in; 128-bit, stored hashed
          qr_payload:
            type: string
            description: URL /p/triage/ticket?t=<public_token>
          safety_screen_definition_id:
            type:
            - string
            - 'null'
            format: uuid
    ClaimRequest:
      type: object
      additionalProperties: false
      properties:
        expected_version:
          type: integer
        force:
          type: boolean
          description: 'triage_lead only: take over another user''s claim (audited)'
      required:
      - expected_version
    Recall:
      type: object
      additionalProperties: false
      properties:
        expected_version:
          type: integer
        room:
          type: string
          minLength: 1
          maxLength: 32
        room_id:
          type: string
          format: uuid
        reason:
          type: string
          minLength: 5
          maxLength: 500
      required:
      - expected_version
    Escalation:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        ticket_id:
          type: string
          format: uuid
        facility_id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        trigger:
          type: string
          enum:
          - scale_level
          - scale_rule
          - preconsult_flag
          - staff
          - danger_screen
          - emergency_bypass
        rule_id:
          type:
          - string
          - 'null'
        level:
          type:
          - string
          - 'null'
        scale_version_id:
          type:
          - string
          - 'null'
          format: uuid
          description: protocol_version dimension
        state:
          type: string
          enum:
          - open
          - acknowledged
          - handed_off
          - cancelled
        raised_at:
          type: string
          format: date-time
        raised_by:
          type: string
        note:
          type:
          - string
          - 'null'
        required_ack_roles:
          type: array
          items:
            type: string
            enum:
            - triage_officer
            - clinician
            - triage_lead
        ack_due_at:
          type: string
          format: date-time
        acknowledgements:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              by:
                type: string
              role:
                type: string
              at:
                type: string
                format: date-time
            required:
            - by
            - role
            - at
        handoff:
          oneOf:
          - type: object
            additionalProperties: false
            properties:
              to_department_id:
                type: string
                format: uuid
              accepted_by:
                type: string
              at:
                type: string
                format: date-time
              latency_seconds:
                type: integer
                description: handoff.at - raised_at
            required:
            - to_department_id
            - accepted_by
            - at
            - latency_seconds
          - type: 'null'
        unacknowledged_alerted:
          type: boolean
        version:
          type: integer
      required:
      - id
      - ticket_id
      - trigger
      - state
      - raised_at
      - required_ack_roles
      - acknowledgements
    EscalationCreate:
      type: object
      additionalProperties: false
      properties:
        note:
          type: string
          minLength: 5
          maxLength: 1000
        expected_version:
          type: integer
          description: ticket version
      required:
      - note
      - expected_version
    EscalationHandoff:
      type: object
      additionalProperties: false
      properties:
        to_department_id:
          type: string
          format: uuid
        expected_version:
          type: integer
      required:
      - to_department_id
      - expected_version
    PublicTicketStatus:
      type: object
      additionalProperties: false
      properties:
        ticket_number:
          type: string
        facility_name:
          type: string
        department_name:
          $ref: '#/components/schemas/I18nText'
        status:
          type: string
          enum:
          - waiting
          - called
          - being_seen
          - finished
          - closed
        people_ahead:
          type:
          - integer
          - 'null'
          description: only in the triage stage; null after triage (acuity order must not be inferable)
        called_to:
          type:
          - string
          - 'null'
        updated_at:
          type: string
          format: date-time
      required:
      - ticket_number
      - status
      - updated_at
    SelfCheckIn:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        identification:
          type: object
          additionalProperties: false
          properties:
            method:
              type: string
              enum:
              - health_id
              - search
              - qr
              - access_card
            value:
              type: string
              minLength: 1
              maxLength: 128
            date_of_birth:
              type: string
              format: date
              description: second factor for health_id at self check-in
          required:
          - method
        language:
          type: string
          enum:
          - en
          - fr
        notify_opt_in:
          type: boolean
      required:
      - facility_id
      - department_id
      - identification
    AccessCard:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        card_number:
          type: string
          description: printed number + QR; random, not derived from the Health ID
        patient_id:
          type: string
          format: uuid
        facility_id:
          type: string
          format: uuid
        state:
          type: string
          enum:
          - active
          - revoked
        issued_at:
          type: string
          format: date-time
        revoked_reason:
          type:
          - string
          - 'null'
      required:
      - id
      - card_number
      - patient_id
      - facility_id
      - state
      - issued_at
    AccessCardIssue:
      type: object
      additionalProperties: false
      properties:
        patient_id:
          type: string
          format: uuid
        replaces_card_id:
          type: string
          format: uuid
      required:
      - patient_id
    Room:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 32
        kind:
          type: string
          enum:
          - triage
          - consultation
          - resuscitation
          - waiting
        capacity:
          type: integer
          minimum: 1
          maximum: 50
        active:
          type: boolean
        version:
          type: integer
      required:
      - id
      - department_id
      - name
      - kind
      - capacity
      - active
    RoomWrite:
      type: object
      additionalProperties: false
      properties:
        department_id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 32
        kind:
          type: string
          enum:
          - triage
          - consultation
          - resuscitation
          - waiting
        capacity:
          type: integer
          minimum: 1
          maximum: 50
        active:
          type: boolean
        expected_version:
          type: integer
      required:
      - department_id
      - name
      - kind
      - capacity
    Shift:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        facility_id:
          type: string
          format: uuid
        department_id:
          type:
          - string
          - 'null'
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 64
        starts_at:
          type: string
          format: date-time
        ends_at:
          type: string
          format: date-time
        required:
          type: object
          additionalProperties:
            type: integer
          description: role -> minimum staff (for shift_coverage)
        assignments:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              user_id:
                type: string
              role:
                type: string
                enum:
                - receptionist
                - triage_officer
                - triage_lead
                - clinician
              room_id:
                type:
                - string
                - 'null'
                format: uuid
            required:
            - user_id
            - role
        version:
          type: integer
      required:
      - id
      - facility_id
      - name
      - starts_at
      - ends_at
      - assignments
    ShiftWrite:
      type: object
      additionalProperties: false
      properties:
        department_id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 64
        starts_at:
          type: string
          format: date-time
        ends_at:
          type: string
          format: date-time
        required:
          type: object
          additionalProperties:
            type: integer
        assignments:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              user_id:
                type: string
                minLength: 1
                maxLength: 128
              role:
                type: string
                enum:
                - receptionist
                - triage_officer
                - triage_lead
                - clinician
              room_id:
                type: string
                format: uuid
            required:
            - user_id
            - role
          maxItems: 200
        expected_version:
          type: integer
      required:
      - name
      - starts_at
      - ends_at
    FacilitySettings:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        claim_ttl_minutes:
          type: integer
          minimum: 1
          maximum: 120
        no_show_reinstate_minutes:
          type: integer
          minimum: 0
          maximum: 1440
        escalation_ack_within_seconds:
          type: integer
          minimum: 10
          maximum: 3600
          description: operational acknowledgement window set by the facility, not a clinical threshold
        escalation_ack_roles:
          type: array
          items:
            type: string
            enum:
            - triage_officer
            - clinician
            - triage_lead
        missing_vital_reasons:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              code:
                type: string
                pattern: ^[a-z0-9_]{1,64}$
              label:
                $ref: '#/components/schemas/I18nText'
            required:
            - code
            - label
          minItems: 1
        public_status_enabled:
          type: boolean
        public_token_ttl_hours:
          type: integer
          minimum: 1
          maximum: 72
        self_check_in_enabled:
          type: boolean
        offline_allowed:
          type: boolean
        operating_hours:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              day:
                type: string
                enum:
                - mon
                - tue
                - wed
                - thu
                - fri
                - sat
                - sun
              open:
                type: string
                pattern: ^[0-2][0-9]:[0-5][0-9]$
              close:
                type: string
                pattern: ^[0-2][0-9]:[0-5][0-9]$
            required:
            - day
            - open
            - close
        timezone:
          type: string
        version:
          type: integer
        care_team_relationship_hours:
          type: integer
          minimum: 1
          maximum: 72
          default: 24
          description: '1.3.7: hours a care_team relationship registered in OHN-16 at handover stays valid (default 24, at most 72; above 72 is 422 validation_failed). Operational setting of the facility,
            audited with the settings revision'
          x-since: 1.3.7
      required:
      - facility_id
      - claim_ttl_minutes
      - no_show_reinstate_minutes
      - escalation_ack_within_seconds
      - missing_vital_reasons
      - version
    FacilitySettingsWrite:
      type: object
      additionalProperties: false
      properties:
        claim_ttl_minutes:
          type: integer
          minimum: 1
          maximum: 120
        no_show_reinstate_minutes:
          type: integer
          minimum: 0
          maximum: 1440
        escalation_ack_within_seconds:
          type: integer
          minimum: 10
          maximum: 3600
          description: operational acknowledgement window set by the facility, not a clinical threshold
        escalation_ack_roles:
          type: array
          items:
            type: string
            enum:
            - triage_officer
            - clinician
            - triage_lead
        missing_vital_reasons:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              code:
                type: string
                pattern: ^[a-z0-9_]{1,64}$
              label:
                $ref: '#/components/schemas/I18nText'
            required:
            - code
            - label
          minItems: 1
        public_status_enabled:
          type: boolean
        public_token_ttl_hours:
          type: integer
          minimum: 1
          maximum: 72
        self_check_in_enabled:
          type: boolean
        offline_allowed:
          type: boolean
        operating_hours:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              day:
                type: string
                enum:
                - mon
                - tue
                - wed
                - thu
                - fri
                - sat
                - sun
              open:
                type: string
                pattern: ^[0-2][0-9]:[0-5][0-9]$
              close:
                type: string
                pattern: ^[0-2][0-9]:[0-5][0-9]$
            required:
            - day
            - open
            - close
        timezone:
          type: string
        expected_version:
          type: integer
        care_team_relationship_hours:
          type: integer
          minimum: 1
          maximum: 72
          default: 24
          description: '1.3.7: hours a care_team relationship registered in OHN-16 at handover stays valid (default 24, at most 72; above 72 is 422 validation_failed). Operational setting of the facility,
            audited with the settings revision'
          x-since: 1.3.7
      required:
      - claim_ttl_minutes
      - no_show_reinstate_minutes
      - escalation_ack_within_seconds
      - missing_vital_reasons
      - expected_version
    SyncBatch:
      type: object
      additionalProperties: false
      properties:
        device_id:
          type: string
          minLength: 1
          maxLength: 128
        facility_id:
          type: string
          format: uuid
        operations:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              client_op_id:
                type: string
                format: uuid
                description: idempotency per operation; applied once, atomically with its idempotency record
              op:
                type: string
                enum:
                - check_in
                - call
                - missed
                - start_triage
                - vitals
                - assessment
                - reassessment
                - outcome
                - link_patient
              ticket_id:
                type: string
                format: uuid
              client_ticket_ref:
                type: string
                description: offline-created ticket reference, mapped to a server ticket id in the result
              base_version:
                type: integer
              performed_at:
                type: string
                format: date-time
              performed_by:
                type: string
                minLength: 1
                maxLength: 128
                description: the person who did the work; must be the signed-in user, or for edge_sync a person on a facility shift covering performed_at
              payload:
                type: object
                description: the online request body of the same operation. For an assessment or reassessment, vital_set_id may be the client_op_id of a vitals operation from the same device in this or
                  an earlier batch
            required:
            - client_op_id
            - op
            - performed_at
            - performed_by
            - payload
          minItems: 1
          maxItems: 500
      required:
      - device_id
      - facility_id
      - operations
    SyncResult:
      type: object
      additionalProperties: false
      properties:
        device_id:
          type: string
        results:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              client_op_id:
                type: string
                format: uuid
              outcome:
                type: string
                enum:
                - applied
                - duplicate
                - conflict
                - rejected
              ticket_id:
                type:
                - string
                - 'null'
                format: uuid
              conflict_id:
                type:
                - string
                - 'null'
                format: uuid
              error:
                type:
                - string
                - 'null'
                description: per-operation error code, e.g. performer_mismatch, performer_not_on_shift, forbidden, validation_failed, sync_conflict
            required:
            - client_op_id
            - outcome
      required:
      - device_id
      - results
    SyncConflict:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        device_id:
          type: string
        client_op_id:
          type: string
          format: uuid
        op:
          type: string
          enum:
          - check_in
          - call
          - missed
          - start_triage
          - vitals
          - assessment
          - reassessment
          - outcome
          - link_patient
        ticket_id:
          type:
          - string
          - 'null'
          format: uuid
        reason:
          type: string
          enum:
          - version_mismatch
          - invalid_transition_now
          - duplicate_patient_ticket
          - assessed_by_other
          - closed_on_server
        client_payload:
          type: object
        server_snapshot:
          type: object
        state:
          type: string
          enum:
          - open
          - resolved
        resolution:
          type:
          - string
          - 'null'
          enum:
          - keep_server
          - apply_client
          - apply_as_reassessment
          - discard
          - null
        resolved_by:
          type:
          - string
          - 'null'
        detected_at:
          type: string
          format: date-time
        resolved_at:
          type:
          - string
          - 'null'
          format: date-time
      required:
      - id
      - device_id
      - client_op_id
      - op
      - ticket_id
      - state
      - reason
      - detected_at
    SyncResolve:
      type: object
      additionalProperties: false
      properties:
        resolution:
          type: string
          enum:
          - keep_server
          - apply_client
          - apply_as_reassessment
          - discard
        reason:
          type: string
          minLength: 5
          maxLength: 1000
      required:
      - resolution
      - reason
    SyncStatus:
      type: object
      additionalProperties: false
      properties:
        device_id:
          type: string
        last_batch_at:
          type:
          - string
          - 'null'
          format: date-time
        applied:
          type: integer
        open_conflicts:
          type: integer
      required:
      - device_id
      - last_batch_at
      - open_conflicts
    AuditEntry:
      type: object
      additionalProperties: false
      properties:
        seq:
          type: integer
        at:
          type: string
          format: date-time
        actor:
          type: string
        actor_role:
          type: string
        facility_id:
          type: string
          format: uuid
        action:
          type: string
          description: e.g. ticket.read, ticket.claim, vitals.create, assessment.override, summary.read, escalation.acknowledge, public_token.fail, break_glass.use, export.create
        resource_type:
          type: string
          enum:
          - ticket
          - vital_set
          - assessment
          - escalation
          - scale
          - department
          - room
          - shift
          - settings
          - display
          - access_card
          - report
          - sync_conflict
          - public_token
        resource_id:
          type:
          - string
          - 'null'
        outcome:
          type: string
          enum:
          - allowed
          - denied
          - failed
        purpose:
          type: string
        break_glass_id:
          type:
          - string
          - 'null'
        correlation_id:
          type: string
        hash:
          type: string
          description: SHA-256 over prev_hash + canonical entry
        prev_hash:
          type: string
      required:
      - seq
      - at
      - actor
      - actor_role
      - action
      - resource_type
      - outcome
      - hash
      - prev_hash
    Assign:
      type: object
      additionalProperties: false
      properties:
        room_id:
          type: string
          format: uuid
        clinician_user_id:
          type: string
          minLength: 1
          maxLength: 128
        expected_version:
          type: integer
      required:
      - expected_version
    PaymentPolicy:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        mode:
          type: string
          enum:
          - none
          - pay_before_nurse
          description: 'owner decision 2026-11-29: default none; a facility opts in to pay_before_nurse'
        service_code:
          type:
          - string
          - 'null'
          description: facility tariff/service catalogue code of the consultation charge (from the billing system; no fixed charge in OHN)
        bypass_roles:
          type: array
          items:
            type: string
            enum:
            - triage_officer
            - triage_lead
            - emergency_clinician
            - cashier
          description: 'owner decision 2026-11-29: default all four; a facility may narrow it'
        remote_payment_allowed:
          type: boolean
        revision:
          type: integer
        state:
          type: string
          enum:
          - draft
          - active
          - retired
        approval_ref:
          type:
          - string
          - 'null'
        signed_by:
          type:
          - string
          - 'null'
        signed_at:
          type:
          - string
          - 'null'
          format: date-time
        version:
          type: integer
      required:
      - facility_id
      - mode
      - revision
      - state
    PaymentPolicyWrite:
      type: object
      additionalProperties: false
      properties:
        mode:
          type: string
          enum:
          - none
          - pay_before_nurse
        service_code:
          type: string
          minLength: 1
          maxLength: 64
        bypass_roles:
          type: array
          items:
            type: string
            enum:
            - triage_officer
            - triage_lead
            - emergency_clinician
            - cashier
          minItems: 1
        remote_payment_allowed:
          type: boolean
        approval_ref:
          type: string
          minLength: 3
          maxLength: 128
        expected_version:
          type: integer
      required:
      - mode
      - bypass_roles
      - approval_ref
      - expected_version
    FirstLook:
      type: object
      additionalProperties: false
      properties:
        outcome:
          type: string
          enum:
          - routine
          - emergency
        note:
          type: string
          minLength: 0
          maxLength: 1000
        expected_version:
          type: integer
      required:
      - outcome
      - expected_version
    FinancialState:
      type: object
      additionalProperties: false
      properties:
        ticket_id:
          type: string
          format: uuid
        financial_state:
          type: string
          enum:
          - not_applicable
          - invoice_not_created
          - payment_required
          - payment_pending
          - payment_processing
          - payment_failed
          - partial_payment
          - refund_under_review
          - coverage_pending
          - insurance_eligible_unpaid
          - insurance_authorized_unpaid
          - invoice_paid_in_full_verified
          - manually_confirmed_by_cashier
          - emergency_bypass_authorized
          - visit_cancelled
          - visit_departed
        gate:
          type: string
          enum:
          - R_OUTSTANDING
          - R_CLEAR
          - E_BYPASS
          - terminal
          - not_applicable
        invoice_ref:
          type:
          - string
          - 'null'
          description: billing-system invoice id (reference only)
        amount_due_minor:
          type:
          - integer
          - 'null'
        currency:
          type:
          - string
          - 'null'
          pattern: ^[A-Z]{3}$
        receipt_ref:
          type:
          - string
          - 'null'
        verified_at:
          type:
          - string
          - 'null'
          format: date-time
        policy_revision:
          type:
          - integer
          - 'null'
        cashier_instruction:
          oneOf:
          - $ref: '#/components/schemas/I18nText'
          - type: 'null'
        version:
          type: integer
          description: the ticket's version, for expected_version on billing-intent, deferred-charges and emergency-bypass (1.3.3)
        confirmed_by:
          type:
          - string
          - 'null'
          description: '1.3.6: the cashier who confirmed payment by hand (manually_confirmed_by_cashier); null otherwise'
        confirmation_method:
          type:
          - string
          - 'null'
          enum:
          - billing_verified
          - manual
          - null
          description: '1.3.6: how the gate cleared; null while outstanding'
        charge_source:
          type:
          - string
          - 'null'
          enum:
          - fixed
          - listed_price
          - configured_tariff
          - cashier_entered
          - null
          description: '1.3.6: where the visit''s charge came from; cashier_entered when a cashier confirmed an unpriced visit by hand (audited as payment.manual_confirm_unpriced)'
      required:
      - ticket_id
      - financial_state
      - gate
      - version
    BillingIntent:
      type: object
      additionalProperties: false
      properties:
        expected_version:
          type: integer
        payer:
          type: string
          enum:
          - self
          - insurer
          - employer
          - other
      required:
      - expected_version
    PaymentVerification:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        ticket_id:
          type: string
          format: uuid
        invoice_ref:
          type: string
          minLength: 1
          maxLength: 128
        finance_event_id:
          type: string
          minLength: 1
          maxLength: 128
          description: idempotency key from the billing system; OHN-61 then re-queries the ledger and clears only on a settled, exact visit/facility/invoice/amount/currency match
      required:
      - facility_id
      - ticket_id
      - invoice_ref
      - finance_event_id
    PaymentVerificationResult:
      type: object
      additionalProperties: false
      properties:
        ticket_id:
          type: string
          format: uuid
        outcome:
          type: string
          enum:
          - cleared
          - not_settled
          - mismatch
          - duplicate
          - billing_unavailable
        financial_state:
          type: string
          enum:
          - not_applicable
          - invoice_not_created
          - payment_required
          - payment_pending
          - payment_processing
          - payment_failed
          - partial_payment
          - refund_under_review
          - coverage_pending
          - insurance_eligible_unpaid
          - insurance_authorized_unpaid
          - invoice_paid_in_full_verified
          - manually_confirmed_by_cashier
          - emergency_bypass_authorized
          - visit_cancelled
          - visit_departed
        queue_position:
          type:
          - integer
          - 'null'
      required:
      - ticket_id
      - outcome
      - financial_state
    EmergencyBypass:
      type: object
      additionalProperties: false
      properties:
        reason:
          type: string
          minLength: 5
          maxLength: 1000
        destination_department_id:
          type: string
          format: uuid
          description: optional since 1.3.3; omitted means the ticket's own department
        expected_version:
          type: integer
      required:
      - reason
      - expected_version
    DeferredCharges:
      type: object
      additionalProperties: false
      properties:
        invoice_ref:
          type: string
          minLength: 1
          maxLength: 128
        note:
          type: string
          minLength: 0
          maxLength: 1000
        expected_version:
          type: integer
      required:
      - expected_version
    PaymentPendingEntry:
      type: object
      additionalProperties: false
      properties:
        ticket_id:
          type: string
          format: uuid
        ticket_number:
          type: string
        arrival_seq:
          type: integer
        financial_state:
          type: string
          enum:
          - not_applicable
          - invoice_not_created
          - payment_required
          - payment_pending
          - payment_processing
          - payment_failed
          - partial_payment
          - refund_under_review
          - coverage_pending
          - insurance_eligible_unpaid
          - insurance_authorized_unpaid
          - invoice_paid_in_full_verified
          - manually_confirmed_by_cashier
          - emergency_bypass_authorized
          - visit_cancelled
          - visit_departed
        waiting_minutes:
          type: integer
        first_look:
          oneOf:
          - type: object
            additionalProperties: false
            properties:
              at:
                type: string
                format: date-time
              by:
                type: string
              outcome:
                type: string
                enum:
                - routine
                - emergency
            required:
            - at
            - by
            - outcome
          - type: 'null'
        display_name:
          type:
          - string
          - 'null'
          description: reception and cashier roles only
        version:
          type: integer
          description: the ticket's version, for expected_version on billing-intent, deferred-charges and emergency-bypass (1.3.3)
        department_id:
          type: string
          format: uuid
          description: the ticket's department (1.3.3)
      required:
      - ticket_id
      - ticket_number
      - arrival_seq
      - financial_state
      - waiting_minutes
      - version
      - department_id
    QueueRevision:
      type: object
      additionalProperties: false
      properties:
        revision:
          type: integer
        at:
          type: string
          format: date-time
        trigger:
          type: string
          enum:
          - payment_verified
          - emergency_bypass
          - claimed
          - called
          - reassessment
          - no_show
          - cancelled
          - capacity_changed
        changes:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              ticket_id:
                type: string
                format: uuid
              from:
                type:
                - integer
                - 'null'
              to:
                type:
                - integer
                - 'null'
            required:
            - ticket_id
            - from
            - to
      required:
      - revision
      - at
      - trigger
      - changes
    ExternalSystem:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 128
        client_id:
          type: string
          description: platform-registered OAuth client (role external_triage_system)
        facility_ids:
          type: array
          items:
            type: string
            format: uuid
        state:
          type: string
          enum:
          - active
          - suspended
        acuity_code_map:
          type: object
          additionalProperties:
            type: string
          description: external acuity code -> level code of the active approved scale; unmapped codes are stored as external_unmapped and never assigned
        version:
          type: integer
      required:
      - id
      - name
      - client_id
      - state
      - acuity_code_map
    ExternalSystemWrite:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 128
        client_id:
          type: string
          minLength: 1
          maxLength: 128
        facility_ids:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
        acuity_code_map:
          type: object
          additionalProperties:
            type: string
        state:
          type: string
          enum:
          - active
          - suspended
        expected_version:
          type: integer
      required:
      - name
      - client_id
      - facility_ids
      - acuity_code_map
    FhirBundle:
      type: object
      additionalProperties: true
      required:
      - resourceType
      - type
      - entry
      description: FHIR R4 Bundle (type collection or transaction) with one Encounter, Observation(s) (vital-signs, LOINC/UCUM), optional QuestionnaireResponse and Flag(s); profiles listed in modules/OHN-61/conformance/README.md
      properties:
        resourceType:
          const: Bundle
        type:
          type: string
          enum:
          - collection
          - transaction
        identifier:
          type: object
        entry:
          type: array
          items:
            type: object
    ExternalIntakeResult:
      type: object
      additionalProperties: false
      properties:
        outcome:
          type: string
          enum:
          - created
          - updated
          - duplicate
        ticket_id:
          type: string
          format: uuid
        assessment_id:
          type:
          - string
          - 'null'
          format: uuid
        acuity_mapping:
          type: string
          enum:
          - mapped
          - external_unmapped
          - none
        escalation_id:
          type:
          - string
          - 'null'
          format: uuid
        warnings:
          type: array
          items:
            type: string
      required:
      - outcome
      - ticket_id
    TriageHistoryItem:
      type: object
      additionalProperties: false
      properties:
        ticket_id:
          type: string
          format: uuid
        facility_id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        arrived_at:
          type: string
          format: date-time
        state:
          type: string
        final_level:
          type:
          - string
          - 'null'
        scale_version_id:
          type:
          - string
          - 'null'
          format: uuid
        encounter_id:
          type:
          - string
          - 'null'
          format: uuid
        vital_set_ids:
          type: array
          items:
            type: string
            format: uuid
        preconsult_document_ids:
          type: array
          items:
            type: string
            format: uuid
        source_system:
          type:
          - string
          - 'null'
        synthetic_demo:
          type: boolean
      required:
      - ticket_id
      - facility_id
      - department_id
      - arrived_at
      - state
    PublicPaymentStatus:
      type: object
      additionalProperties: false
      properties:
        ticket_number:
          type: string
        status:
          type: string
          enum:
          - not_applicable
          - payment_required
          - payment_pending
          - verified_paid
          - emergency_care
        invoice_ref:
          type:
          - string
          - 'null'
        amount_due_minor:
          type:
          - integer
          - 'null'
        currency:
          type:
          - string
          - 'null'
          pattern: ^[A-Z]{3}$
        cashier_instruction:
          oneOf:
          - $ref: '#/components/schemas/I18nText'
          - type: 'null'
        receipt_ref:
          type:
          - string
          - 'null'
          description: only once the billing system verified full settlement
        estimated_queue_position_when_eligible:
          type:
          - integer
          - 'null'
        updated_at:
          type: string
          format: date-time
      required:
      - ticket_number
      - status
    TicketServiceProjection:
      type: object
      additionalProperties: false
      x-since: 1.3.1
      description: ids-and-states view of a Ticket returned to triage_service (OHN-62 service token) on GET /tickets/{ticket_id}. No clinical, identity or timing fields.
      required:
      - id
      - ticket_number
      - facility_id
      - department_id
      - patient_id
      - state
      - financial_state
      - version
      properties:
        id:
          type: string
          format: uuid
        ticket_number:
          type: string
          description: <prefix>-<seq>, sequence per department per local day, e.g. E-014
        facility_id:
          type: string
          format: uuid
        department_id:
          type: string
          format: uuid
        patient_id:
          type:
          - string
          - 'null'
          format: uuid
        state:
          type: string
          enum:
          - waiting
          - called
          - in_triage
          - triaged
          - consult_called
          - in_consultation
          - completed
          - no_show
          - left_without_being_seen
          - transferred
          - referred
          - cancelled
          - payment_pending
        financial_state:
          type: string
          enum:
          - not_applicable
          - invoice_not_created
          - payment_required
          - payment_pending
          - payment_processing
          - payment_failed
          - partial_payment
          - refund_under_review
          - coverage_pending
          - insurance_eligible_unpaid
          - insurance_authorized_unpaid
          - invoice_paid_in_full_verified
          - manually_confirmed_by_cashier
          - emergency_bypass_authorized
          - visit_cancelled
          - visit_departed
          description: 'payment gate state. not_applicable when the facility payment_policy is none. Nurse-eligible: not_applicable (policy none: no gate, the 1.2 flow), invoice_paid_in_full_verified or
            manually_confirmed_by_cashier (R_CLEAR; 1.3.6: the second is a cashier''s audited manual confirmation, kept distinct for auditors) or emergency_bypass_authorized (E_BYPASS); every other value
            is R_OUTSTANDING or terminal and is not eligible'
        version:
          type: integer
    PublicDepartment:
      type: object
      additionalProperties: false
      x-since: 1.3.2
      description: 'What a kiosk or patient may see of a department to choose it at self check-in (owner decision 7, contract 1.3.4). Non-sensitive department: name and kind set. Sensitive department: name
        and kind null; only the neutral public_label is shown. No code, ticket_prefix, counts or rooms.'
      required:
      - id
      - public_label
      properties:
        id:
          type: string
          format: uuid
        public_label:
          $ref: '#/components/schemas/I18nText'
          description: 'the label to display: the department name when not sensitive, its neutral public_label when sensitive'
        kind:
          type:
          - string
          - 'null'
          enum:
          - emergency
          - opd_general
          - eye
          - dental
          - maternity
          - paediatrics
          - cardiology
          - diabetes
          - ent
          - dermatology
          - mental_health
          - surgery
          - orthopaedics
          - anc_pnc
          - obgyn
          - neurology
          - nephrology
          - gastroenterology
          - respiratory
          - urology
          - hiv_art
          - oncology
          - immunization
          - laboratory
          - imaging
          - pharmacy
          - family_planning
          - other
          - null
          description: null for sensitive departments, so the list never reveals a private service
        name:
          oneOf:
          - $ref: '#/components/schemas/I18nText'
          - type: 'null'
          description: the department's real name (1.3.4); null or absent for sensitive departments. public_label already carries the name for non-sensitive departments
    TariffEntry:
      type: object
      additionalProperties: false
      properties:
        service_code:
          type: string
          minLength: 1
          maxLength: 64
          description: the billing system's service code, as in PaymentPolicy.service_code
        label:
          $ref: '#/components/schemas/I18nText'
        amount_minor:
          type: integer
          minimum: 1
          description: price in minor units of currency
        currency:
          type: string
          pattern: ^[A-Z]{3}$
          description: ISO 4217
        effective_from:
          type: string
          format: date-time
      required:
      - service_code
      - amount_minor
      - currency
      - effective_from
      x-since: 1.3.4
    TariffSchedule:
      type: object
      additionalProperties: false
      properties:
        facility_id:
          type: string
          format: uuid
        version:
          type: integer
        tariffs:
          type: array
          items:
            $ref: '#/components/schemas/TariffEntry'
          maxItems: 2000
          description: all entries, past and future, ordered by service_code then effective_from
        updated_at:
          type:
          - string
          - 'null'
          format: date-time
        updated_by:
          type:
          - string
          - 'null'
        approval_ref:
          type:
          - string
          - 'null'
      required:
      - facility_id
      - version
      - tariffs
      x-since: 1.3.4
      description: 'The facility''s consultation prices per service code. The price in effect for a service at an instant is its entry with the latest effective_from at or before that instant. A ticket''s
        charge is fixed from the price in effect at billing intent and never changes afterwards. With no price in effect the gate never clears by itself: the cashier confirms payment by hand, as before.'
    TariffScheduleWrite:
      type: object
      additionalProperties: false
      properties:
        expected_version:
          type: integer
          description: 0 for the first write
        tariffs:
          type: array
          items:
            $ref: '#/components/schemas/TariffEntry'
          maxItems: 2000
          description: the full list. Entries whose effective_from is at or before now are history and must be sent back unchanged; only future entries may be added, changed or removed
        approval_ref:
          type: string
          minLength: 3
          maxLength: 128
          description: facility finance approval reference
      required:
      - expected_version
      - tariffs
      - approval_ref
      x-since: 1.3.4
    ManualPaymentConfirmation:
      type: object
      additionalProperties: false
      properties:
        receipt_ref:
          type: string
          minLength: 3
          maxLength: 128
          description: the facility's own receipt number
        amount_minor:
          type: integer
          minimum: 1
          description: must equal the visit's charge; for an unpriced visit it becomes the charge
        currency:
          type: string
          pattern: ^[A-Z]{3}$
        method:
          type: string
          enum:
          - cash
          - mobile_money
          - card
          - other
        note:
          type: string
          minLength: 0
          maxLength: 1000
          description: required (5+ characters, the basis of the amount) when the visit is unpriced
        expected_version:
          type: integer
      required:
      - receipt_ref
      - amount_minor
      - currency
      - method
      - expected_version
      x-since: 1.3.6
    CareTeamAccess:
      type: object
      additionalProperties: false
      properties:
        state:
          type: string
          enum:
          - pending
          - active
          - failed
          - ended
          description: 'pending: OHN-16 registration queued (outbox) or the patient is not yet linked; active: at least one assertion registered; failed: OHN-16 refused or retries ran out (the handover
            itself stands); ended: revoked at close or re-handover'
        department_id:
          type: string
          format: uuid
          description: the receiving department whose clinicians hold the relationship
        clinician_count:
          type: integer
          minimum: 0
          description: clinicians with a registered assertion
        expires_at:
          type:
          - string
          - 'null'
          format: date-time
          description: valid_from + care_team_relationship_hours of the first registration
        ended_reason:
          type:
          - string
          - 'null'
          enum:
          - completed
          - left_without_being_seen
          - transferred
          - referred
          - cancelled
          - re_handover
          - null
      required:
      - state
      - department_id
      - clinician_count
      x-since: 1.3.7
      description: '1.3.7: OHN-16 care_team access of the receiving clinicians. Patient references and assertion ids are not exposed'
