openapi: 3.1.1
info:
  title: QUBS Integrations API
  description: >-
    Partner-facing API providing read-only access to selected QUBS configuration
    and scheduling data for integration purposes.


    Authentication is via a bearer JWT in the `Authorization` header.
    Authorization is domain-scoped; all requests include a `{domain}` path
    parameter.


    Errors are returned as RFC7807 Problem Details (`application/problem+json`).
  version: v1
servers:
  - url: /
    description: Relative to the current host
paths:
  /integrations/v1/{domain}/sites:
    get:
      tags:
        - Site Settings
      summary: List sites in the specified partner domain
      description: >-
        Returns the active sites a partner is allowed to access within a domain
        after authorization succeeds.
      operationId: Integrations_ListSites
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
      responses:
        '200':
          description: List of active sites for the requested domain.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SiteInfoResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/sites/{siteName}:
    get:
      tags:
        - Site Settings
      summary: Get site settings summary by domain and site name
      description: >-
        Returns the site settings summary view for a specific site when the
        caller is authorized for the requested domain and site.
      operationId: Integrations_GetSiteSettings_Summary
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: siteName
          in: path
          description: Site name within the specified domain.
          required: true
          schema:
            type: string
            example: Example Site
      responses:
        '200':
          description: Site settings summary view for the requested domain and site.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteSettingsSummaryResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/sites/{siteName}/operational:
    get:
      tags:
        - Site Settings
      summary: Get operational site settings by domain and site name
      description: >-
        Returns the operational site settings view for a specific site when the
        caller is authorized for the requested domain and site.
      operationId: Integrations_GetSiteSettings_Operational
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: siteName
          in: path
          description: Site name within the specified domain.
          required: true
          schema:
            type: string
            example: Example Site
      responses:
        '200':
          description: Operational site settings view for the requested domain and site.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteSettingsResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/sites/{siteName}/exam-codes:
    get:
      tags:
        - Exam Codes
      summary: List exam codes for a site
      description: >-
        Returns exam codes for the specified domain and site when the caller is
        authorized.
      operationId: Integrations_ListExamCodes
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: siteName
          in: path
          description: Site name within the specified domain.
          required: true
          schema:
            type: string
            example: Example Site
      responses:
        '200':
          description: List of exam codes for the requested domain and site.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ExamCodeResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/sites/{siteName}/staff-skills:
    get:
      tags:
        - Staff Skills
      summary: Get staff skill grid for a site
      description: >-
        Returns the staff skills grid, exam mappings, and comments for the
        specified domain and site when authorized.
      operationId: Integrations_GetStaffSkills
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: siteName
          in: path
          description: Site name within the specified domain.
          required: true
          schema:
            type: string
            example: Example Site
      responses:
        '200':
          description: >-
            Staff skills grid and related metadata for the requested domain and
            site.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StaffSkillsGridResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/operational/by-status/{status}:
    get:
      tags:
        - Appointments
      summary: List operational appointments by status
      description: >-
        Returns the operational appointment view filtered by status when the
        caller is authorized. Supports cursor-based pagination via `pageSize`
        and `nextToken`.
      operationId: Integrations_ListAppointmentsByStatus_Operational
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: status
          in: path
          description: >-
            Appointment status filter value. Must match one of the known QUBS
            appointment status strings.
          required: true
          schema:
            enum:
              - NOT ARRIVED
              - ARRIVED
              - DID NOT ATTEND
              - APPPOINTMENT CANCELLED
              - CANCELLATION LIST
              - DICTATION INPROGRESS
              - DICTATED
              - TYPED
              - AUTHORISING
              - AUTHORISED
              - TYPING INPROGRESS
              - PENDING REPORTING
              - STUDY INPROGRESS
              - SECOND REVIEW
              - FINALISED
              - REVIEW TYPED
              - PEER REVIEW
              - SECOND OPINION
            type: string
            example: NOT ARRIVED
        - name: pageSize
          in: query
          description: >-
            Maximum number of items to return in a page. Defaults to 100 when
            omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 100
        - name: nextToken
          in: query
          description: >-
            Opaque, URL-safe continuation token returned as `NextToken` in a
            previous paged response. Omit for the first page.
          schema:
            type: string
            example: DDB_NEXT_TOKEN
      responses:
        '200':
          description: >-
            Page of operational appointments matching the requested status for
            the requested domain.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppointmentsOperationalPageResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/operational/{appointmentId}:
    get:
      tags:
        - Appointments
      summary: Get operational appointment by domain and appointment id
      description: >-
        Returns the operational appointment view for the specified domain and
        appointment id when the caller is authorized.
      operationId: Integrations_GetAppointment_Operational
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
      responses:
        '200':
          description: >-
            Operational appointment view for the requested domain and
            appointment id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppointmentOperationalResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/operational:
    get:
      tags:
        - Appointments
      summary: List operational appointments for a domain
      description: >-
        Returns the operational appointment view for the specified domain when
        the caller is authorized. Supports optional filters via query string and
        offset paging via `skip` and `take`.
      operationId: Integrations_ListAppointments_Operational
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentDate
          in: query
          description: >-
            Optional appointment date filter. Format is integration-specific and
            typically matches the QUBS date string for the domain.
          schema:
            type: string
            example: 01-01-2025
        - name: scheduledSite
          in: query
          description: Optional scheduled site filter.
          schema:
            type: string
            example: Example Site
        - name: skip
          in: query
          description: Optional number of items to skip. Defaults to 0 when omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 0
        - name: take
          in: query
          description: >-
            Optional maximum number of items to return. Defaults to 100 when
            omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 100
      responses:
        '200':
          description: List of operational appointments for the requested domain.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AppointmentOperationalResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/by-status/{status}:
    get:
      tags:
        - Appointments
      summary: List appointment summaries by status
      description: >-
        Returns the appointment summary view filtered by status when the caller
        is authorized. Supports cursor-based pagination via `pageSize` and
        `nextToken`.
      operationId: Integrations_ListAppointmentsByStatus_Summary
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: status
          in: path
          description: >-
            Appointment status filter value. Must match one of the known QUBS
            appointment status strings.
          required: true
          schema:
            enum:
              - NOT ARRIVED
              - ARRIVED
              - DID NOT ATTEND
              - APPPOINTMENT CANCELLED
              - CANCELLATION LIST
              - DICTATION INPROGRESS
              - DICTATED
              - TYPED
              - AUTHORISING
              - AUTHORISED
              - TYPING INPROGRESS
              - PENDING REPORTING
              - STUDY INPROGRESS
              - SECOND REVIEW
              - FINALISED
              - REVIEW TYPED
              - PEER REVIEW
              - SECOND OPINION
            type: string
            example: NOT ARRIVED
        - name: pageSize
          in: query
          description: >-
            Maximum number of items to return in a page. Defaults to 100 when
            omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 100
        - name: nextToken
          in: query
          description: >-
            Opaque, URL-safe continuation token returned as `NextToken` in a
            previous paged response. Omit for the first page.
          schema:
            type: string
            example: DDB_NEXT_TOKEN
      responses:
        '200':
          description: >-
            Page of appointment summaries matching the requested status for the
            requested domain.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppointmentsSummaryPageResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/{appointmentId}:
    get:
      tags:
        - Appointments
      summary: Get appointment summary by domain and appointment id
      description: >-
        Returns the appointment summary view for the specified domain and
        appointment id when the caller is authorized.
      operationId: Integrations_GetAppointment_Summary
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
      responses:
        '200':
          description: >-
            Appointment summary view for the requested domain and appointment
            id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppointmentSummaryResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments:
    get:
      tags:
        - Appointments
      summary: List appointment summaries for a domain
      description: >-
        Returns the appointment summary view for the specified domain when the
        caller is authorized. Supports optional filters via query string and
        offset paging via `skip` and `take`.
      operationId: Integrations_ListAppointments_Summary
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentDate
          in: query
          description: >-
            Optional appointment date filter. Format is integration-specific and
            typically matches the QUBS date string for the domain.
          schema:
            type: string
            example: 01-01-2025
        - name: scheduledSite
          in: query
          description: Optional scheduled site filter.
          schema:
            type: string
            example: Example Site
        - name: skip
          in: query
          description: Optional number of items to skip. Defaults to 0 when omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 0
        - name: take
          in: query
          description: >-
            Optional maximum number of items to return. Defaults to 100 when
            omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 100
      responses:
        '200':
          description: List of appointment summaries for the requested domain.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AppointmentSummaryResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/{appointmentId}/attachments:
    get:
      tags:
        - Attachments
      summary: List attachments for an appointment
      description: >-
        Returns appointment attachments (e.g. referrals, worksheets) and a
        short-lived presigned URL for each attachment when available.
      operationId: Integrations_ListAppointmentAttachments
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
        - name: urlTtlSeconds
          in: query
          description: >-
            Optional presigned URL lifetime (in seconds). Values outside
            supported bounds are clamped.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 900
        - name: disposition
          in: query
          description: >-
            Optional content disposition for the presigned URL (`inline` for
            display, `attachment` for download). Defaults to `inline`.
          schema:
            enum:
              - inline
              - attachment
            type: string
            example: inline
      responses:
        '200':
          description: >-
            List of attachments for the requested appointment, including
            short-lived presigned URLs when available.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AppointmentAttachmentResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/{appointmentId}/attachments/{attachmentGuid}:
    get:
      tags:
        - Attachments
      summary: Get a single attachment for an appointment
      description: >-
        Returns a single appointment attachment and a short-lived presigned URL
        when available.
      operationId: Integrations_GetAppointmentAttachment
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
        - name: attachmentGuid
          in: path
          description: Attachment GUID for the requested appointment.
          required: true
          schema:
            type: string
            example: 989dd0c7-13bb-4bba-b7a0-53a28bdf5155
        - name: urlTtlSeconds
          in: query
          description: >-
            Optional presigned URL lifetime (in seconds). Values outside
            supported bounds are clamped.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 900
        - name: disposition
          in: query
          description: >-
            Optional content disposition for the presigned URL (`inline` for
            display, `attachment` for download). Defaults to `inline`.
          schema:
            enum:
              - inline
              - attachment
            type: string
            example: inline
      responses:
        '200':
          description: >-
            Attachment metadata for the requested appointment attachment,
            including a short-lived presigned URL when available.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppointmentAttachmentResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/{appointmentId}/comments:
    get:
      tags:
        - Comments
      summary: List comments for an appointment
      description: >-
        Returns all appointment comments/alerts plus patient comments/alerts for
        the appointment's patient when the caller is authorized.
      operationId: Integrations_ListAppointmentComments
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
      responses:
        '200':
          description: >-
            List of appointment and patient comments/alerts for the requested
            appointment.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AppointmentCommentResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/appointments/{appointmentId}/comments/{commentGuid}:
    get:
      tags:
        - Comments
      summary: Get a single comment for an appointment
      description: >-
        Returns a single appointment comment/alert or patient comment/alert (for
        the appointment's patient) when the caller is authorized.
      operationId: Integrations_GetAppointmentComment
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
        - name: commentGuid
          in: path
          description: Comment GUID for the requested appointment/patient comment.
          required: true
          schema:
            type: string
            example: ed6ef45a-4e3d-41b2-8049-7aec53bb9ab1
      responses:
        '200':
          description: >-
            Comment metadata for the requested comment (appointment or patient)
            for the requested appointment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppointmentCommentResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/patients/{patientId}:
    get:
      tags:
        - Patients
      summary: Get patient summary by domain and patient id
      description: >-
        Returns the patient summary view for the specified domain and patient id
        when the caller is authorized.
      operationId: Integrations_GetPatient_Summary
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: patientId
          in: path
          description: Patient identifier within the specified domain.
          required: true
          schema:
            type: string
            example: '220000'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientSummaryResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/patients:
    get:
      tags:
        - Patients
      summary: List patient summaries for a domain
      description: >-
        Returns the patient summary view for the specified domain when the
        caller is authorized. Supports optional filters via query string and
        offset paging via `skip` and `take`.
      operationId: Integrations_ListPatients_Summary
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: firstName
          in: query
          description: Optional patient first name filter.
          schema:
            type: string
            example: Amandeep
        - name: lastName
          in: query
          description: Optional patient last name filter.
          schema:
            type: string
            example: KAUR
        - name: dateOfBirth
          in: query
          description: >-
            Optional patient date of birth filter. Format is
            integration-specific and typically matches the QUBS date string for
            the domain.
          schema:
            type: string
            example: 03-03-1988
        - name: email
          in: query
          description: Optional patient email filter.
          schema:
            type: string
            example: user@example.com
        - name: mobilePhone
          in: query
          description: Optional patient mobile phone filter.
          schema:
            type: string
            example: '0435531162'
        - name: skip
          in: query
          description: Optional number of items to skip. Defaults to 0 when omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 0
        - name: take
          in: query
          description: >-
            Optional maximum number of items to return. Defaults to 100 when
            omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 100
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PatientSummaryResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/reporting/appointments/pending:
    get:
      tags:
        - Reporting
      summary: List pending reporting appointments
      description: >-
        Returns the tele reporting appointment view for appointments in the
        PENDING REPORTING status. Supports cursor-based pagination via
        `pageSize` and `nextToken`.
      operationId: Integrations_ListPendingReportingAppointments
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: pageSize
          in: query
          description: >-
            Maximum number of items to return in a page. Defaults to 100 when
            omitted.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 100
        - name: nextToken
          in: query
          description: >-
            Opaque, URL-safe continuation token returned as `NextToken` in a
            previous paged response. Omit for the first page.
          schema:
            type: string
            example: DDB_NEXT_TOKEN
      responses:
        '200':
          description: >-
            Page of appointments that are pending reporting for the requested
            domain.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PendingReportingAppointmentsPageResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/reporting/appointments/{appointmentId}/attachments:
    get:
      tags:
        - Reporting
      summary: List attachments for a pending reporting appointment
      description: >-
        Returns appointment attachments (e.g. referrals, worksheets) for the
        specified appointment when it is in the PENDING REPORTING status.
      operationId: Integrations_ListPendingReportingAppointmentAttachments
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
        - name: urlTtlSeconds
          in: query
          description: >-
            Optional presigned URL lifetime (in seconds). Values outside
            supported bounds are clamped.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 900
        - name: disposition
          in: query
          description: >-
            Optional content disposition for the presigned URL (`inline` for
            display, `attachment` for download). Defaults to `inline`.
          schema:
            enum:
              - inline
              - attachment
            type: string
            example: inline
      responses:
        '200':
          description: List of attachments for the requested pending reporting appointment.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/PendingReportingAppointmentAttachmentResponse
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/reporting/appointments/{appointmentId}/attachments/{attachmentGuid}:
    get:
      tags:
        - Reporting
      summary: Get a single attachment for a pending reporting appointment
      description: >-
        Returns a single appointment attachment for the specified appointment
        when it is in the PENDING REPORTING status.
      operationId: Integrations_GetPendingReportingAppointmentAttachment
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
        - name: attachmentGuid
          in: path
          description: Attachment GUID for the requested appointment.
          required: true
          schema:
            type: string
            example: 989dd0c7-13bb-4bba-b7a0-53a28bdf5155
        - name: urlTtlSeconds
          in: query
          description: >-
            Optional presigned URL lifetime (in seconds). Values outside
            supported bounds are clamped.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
            example: 900
        - name: disposition
          in: query
          description: >-
            Optional content disposition for the presigned URL (`inline` for
            display, `attachment` for download). Defaults to `inline`.
          schema:
            enum:
              - inline
              - attachment
            type: string
            example: inline
      responses:
        '200':
          description: >-
            Attachment metadata for the requested pending reporting appointment
            attachment.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PendingReportingAppointmentAttachmentResponse
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/reporting/appointments/{appointmentId}/comments:
    get:
      tags:
        - Reporting
      summary: List comments for a pending reporting appointment
      description: >-
        Returns appointment comments/alerts plus patient comments/alerts for the
        specified appointment when it is in the PENDING REPORTING status.
      operationId: Integrations_ListPendingReportingAppointmentComments
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
      responses:
        '200':
          description: >-
            List of appointment and patient comments/alerts for the requested
            pending reporting appointment.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/PendingReportingAppointmentCommentResponse
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /integrations/v1/{domain}/reporting/appointments/{appointmentId}/comments/{commentGuid}:
    get:
      tags:
        - Reporting
      summary: Get a single comment for a pending reporting appointment
      description: >-
        Returns a single appointment comment/alert or patient comment/alert (for
        the appointment's patient) when the appointment is in the PENDING
        REPORTING status.
      operationId: Integrations_GetPendingReportingAppointmentComment
      parameters:
        - name: domain
          in: path
          description: >-
            Partner domain identifier. Your bearer token is scoped to one or
            more domains and requests outside that scope are rejected.
          required: true
          schema:
            type: string
            example: acme
        - name: appointmentId
          in: path
          description: Appointment identifier within the specified domain.
          required: true
          schema:
            type: string
            example: A123456
        - name: commentGuid
          in: path
          description: Comment GUID for the requested appointment/patient comment.
          required: true
          schema:
            type: string
            example: ed6ef45a-4e3d-41b2-8049-7aec53bb9ab1
      responses:
        '200':
          description: >-
            Comment metadata for the requested pending reporting appointment
            comment (appointment or patient).
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PendingReportingAppointmentCommentResponse
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    AppointmentAttachmentResponse:
      required:
        - guid
      type: object
      properties:
        guid:
          type: string
          description: Attachment GUID.
          example: '123'
        category:
          type: string
          description: Attachment category (e.g. Referral, Worksheet).
          example: Example category
        fileName:
          type: string
          description: Suggested filename for display/download.
          example: Example Name
        addedDateTime:
          type:
            - 'null'
            - string
          description: When the attachment was added.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        addedBy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UserSummaryResponse'
          description: Who added the attachment when available.
        lastModifiedDateTime:
          type:
            - 'null'
            - string
          description: When the attachment was last modified.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        lastModifiedBy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UserSummaryResponse'
          description: Who last modified the attachment when available.
        url:
          type:
            - 'null'
            - string
          description: >-
            Short-lived presigned URL for retrieving the attachment content when
            available.
          example: https://example.com
        urlExpiresAtUtc:
          type:
            - 'null'
            - string
          description: UTC expiry timestamp for the presigned URL when available.
          format: date-time
          example: '2020-01-01T00:00:00Z'
      description: >-
        Attachment metadata for an appointment, including an optional presigned
        URL for retrieving the underlying file.
    AppointmentCommentResponse:
      required:
        - guid
        - commentType
      type: object
      properties:
        guid:
          type: string
          description: Comment GUID.
          example: '123'
        commentType:
          type: string
          description: >-
            Comment type. One of: AC (Appointment Comment), AA (Appointment
            Alert), PC (Patient Comment), PA (Patient Alert).
          example: Example commentType
        appointmentId:
          type: string
          description: >-
            Appointment identifier for appointment comments; empty for
            patient-level comments.
          example: '123'
        patientId:
          type: string
          description: Patient identifier associated with the comment when available.
          example: '123'
        commentText:
          type: string
          description: Comment text.
          example: Example commentText
        commentDateTime:
          type:
            - 'null'
            - string
          description: When the comment was created when available.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        isAlert:
          type: boolean
          description: Whether this comment should be treated as an alert.
          example: true
        commentBy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UserSummaryResponse'
          description: Who created the comment when available.
        lastModifiedDateTime:
          type:
            - 'null'
            - string
          description: When the comment was last modified.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        lastModifiedBy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UserSummaryResponse'
          description: Who last modified the comment when available.
      description: >-
        Comment metadata for an appointment, including both appointment-level
        and patient-level comments/alerts.
    AppointmentExamCodeResponse:
      required:
        - examCodeId
        - key
        - site
        - description
      type: object
      properties:
        examCodeId:
          type: string
          description: Unique exam code identifier.
          example: '123'
        key:
          type: string
          description: QUBS internal key for the exam code record.
          example: Example key
        site:
          type: string
          description: Site this exam code belongs to.
          example: Example site
        description:
          type: string
          description: Human-readable exam description.
          example: Example description
        domain:
          type: string
          example: Example domain
        category:
          type: string
          example: Example category
        colour:
          type: string
          example: Example colour
        modality:
          type: string
          example: Example modality
        totalDuration:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: Configured duration in minutes.
          format: int32
          example: 1
        showOnline:
          type: boolean
          description: Whether this exam is visible/available online.
          example: true
        lastModifiedDateTime:
          type:
            - 'null'
            - string
          format: date-time
          example: '2020-01-01T00:00:00Z'
        extraInfo:
          type:
            - 'null'
            - string
          example: Example extraInfo
        onlineInfo:
          type:
            - 'null'
            - string
          example: Example onlineInfo
        preparations1:
          type:
            - 'null'
            - string
          example: Example preparations1
        order:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          format: int32
          example: 1
        worksheetId:
          type:
            - 'null'
            - string
          example: '123'
      description: Exam code details attached to an appointment.
    AppointmentOperationalResponse:
      required:
        - domain
        - appointmentId
        - scheduledSite
        - status
      type: object
      properties:
        domain:
          type: string
          description: Domain this appointment belongs to.
          example: Example domain
        appointmentId:
          type: string
          description: Appointment identifier.
          example: '123'
        scheduledSite:
          type: string
          description: Scheduled site name.
          example: Example scheduledSite
        status:
          enum:
            - NOT ARRIVED
            - ARRIVED
            - DID NOT ATTEND
            - APPPOINTMENT CANCELLED
            - CANCELLATION LIST
            - DICTATION INPROGRESS
            - DICTATED
            - TYPED
            - AUTHORISING
            - AUTHORISED
            - TYPING INPROGRESS
            - PENDING REPORTING
            - STUDY INPROGRESS
            - SECOND REVIEW
            - FINALISED
            - REVIEW TYPED
            - PEER REVIEW
            - SECOND OPINION
          type: string
          description: Appointment status.
          example: NOT ARRIVED
        appointmentDate:
          type: string
          description: Appointment date string as stored in QUBS.
          example: Example appointmentDate
        startTime:
          type: string
          description: Scheduled start time string as stored in QUBS.
          example: Example startTime
        endTime:
          type: string
          description: Scheduled end time string as stored in QUBS.
          example: Example endTime
        modality:
          type: string
          example: Example modality
        studyDescription:
          type: string
          example: Example description
        room:
          type: string
          example: Example room
        priority:
          type: string
          example: Example priority
        billingStatus:
          type: string
          example: active
        billingType:
          type: string
          example: Example billingType
        arrivalDateTime:
          type:
            - 'null'
            - string
          format: date-time
          example: '2020-01-01T00:00:00Z'
        scanStartDateTime:
          type:
            - 'null'
            - string
          format: date-time
          example: '2020-01-01T00:00:00Z'
        scanEndDateTime:
          type:
            - 'null'
            - string
          format: date-time
          example: '2020-01-01T00:00:00Z'
        scanTotalTime:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          format: double
          example: 1.23
        waitingTotalTime:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          format: double
          example: 1.23
        examCodes:
          type: array
          items:
            $ref: '#/components/schemas/AppointmentExamCodeResponse'
          description: Exam codes attached to the appointment.
      description: Operational appointment view within a domain.
    AppointmentsOperationalPageResponse:
      required:
        - items
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AppointmentOperationalResponse'
          description: Operational appointments in the current page.
        nextToken:
          type:
            - 'null'
            - string
          description: >-
            Opaque continuation token to fetch the next page, when more results
            are available.
          example: Example nextToken
      description: >-
        A single page of operational appointments plus an optional continuation
        token.
    AppointmentsSummaryPageResponse:
      required:
        - items
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AppointmentSummaryResponse'
          description: Appointment summaries in the current page.
        nextToken:
          type:
            - 'null'
            - string
          description: >-
            Opaque continuation token to fetch the next page, when more results
            are available.
          example: Example nextToken
      description: >-
        A single page of appointment summaries plus an optional continuation
        token.
    AppointmentSummaryResponse:
      required:
        - domain
        - appointmentId
        - scheduledSite
        - status
      type: object
      properties:
        domain:
          type: string
          description: Domain this appointment belongs to.
          example: Example domain
        appointmentId:
          type: string
          description: Appointment identifier.
          example: '123'
        scheduledSite:
          type: string
          description: Scheduled site name.
          example: Example scheduledSite
        status:
          enum:
            - NOT ARRIVED
            - ARRIVED
            - DID NOT ATTEND
            - APPPOINTMENT CANCELLED
            - CANCELLATION LIST
            - DICTATION INPROGRESS
            - DICTATED
            - TYPED
            - AUTHORISING
            - AUTHORISED
            - TYPING INPROGRESS
            - PENDING REPORTING
            - STUDY INPROGRESS
            - SECOND REVIEW
            - FINALISED
            - REVIEW TYPED
            - PEER REVIEW
            - SECOND OPINION
          type: string
          description: Appointment status.
          example: NOT ARRIVED
        appointmentDate:
          type: string
          description: Appointment date string as stored in QUBS.
          example: Example appointmentDate
        startTime:
          type: string
          description: Scheduled start time string as stored in QUBS.
          example: Example startTime
        endTime:
          type: string
          description: Scheduled end time string as stored in QUBS.
          example: Example endTime
        modality:
          type: string
          example: Example modality
        studyDescription:
          type: string
          example: Example description
      description: Summary appointment view within a domain.
    EmployeeSkillResponse:
      required:
        - name
        - username
      type: object
      properties:
        name:
          type: string
          description: Display name of the staff member.
          example: Example Name
        username:
          type: string
          description: Unique username for the staff member.
          example: Example Name
        scans:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ScanSkillResponse'
          description: Map of exam key to scan skill details.
      description: Staff member information and their scan skills keyed by exam key.
    ExamCodeResponse:
      required:
        - examCodeId
        - key
        - site
        - description
      type: object
      properties:
        examCodeId:
          type: string
          description: Unique exam code identifier.
          example: '123'
        key:
          type: string
          description: QUBS internal key for the exam code record.
          example: Example key
        site:
          type: string
          description: Site this exam code belongs to.
          example: Example site
        description:
          type: string
          description: Human-readable exam description.
          example: Example description
        category:
          type: string
          description: Optional exam category.
          example: Example category
        modality:
          type: string
          description: Optional imaging modality.
          example: Example modality
        totalDuration:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: Configured duration in minutes.
          format: int32
          example: 1
        showOnline:
          type: boolean
          description: Whether this exam code is visible/available online.
          example: true
        lastModifiedDateTime:
          type: string
          description: When the exam code was last updated.
          format: date-time
          example: '2020-01-01T00:00:00Z'
      description: Exam code configuration for a site within a domain.
    HeaderCommentResponse:
      type: object
      properties:
        hasComment:
          type: boolean
          description: Whether a comment is present for the header.
          example: true
        comment:
          type:
            - 'null'
            - string
          description: Optional comment text.
          example: Example comment
        selectedMarker:
          type:
            - 'null'
            - string
          description: Optional marker identifier.
          example: Example selectedMarker
        markerColor:
          type:
            - 'null'
            - string
          description: Optional marker color value.
          example: Example markerColor
      description: >-
        Optional comment and marker metadata displayed in the staff skills grid
        header.
    PatientSummaryResponse:
      required:
        - domain
        - patientId
        - patientName
      type: object
      properties:
        domain:
          type: string
          description: Domain this patient belongs to.
          example: Example domain
        patientId:
          type: string
          description: Patient identifier.
          example: '123'
        patientName:
          type: string
          description: Patient display name.
          example: Example Name
        firstName:
          type: string
          description: Patient first name.
          example: Example Name
        lastName:
          type: string
          description: Patient last name.
          example: Example Name
        gender:
          type: string
          description: Patient gender/sex string as stored in QUBS.
          example: Example gender
        dateOfBirth:
          type: string
          description: Patient date of birth string as stored in QUBS.
          example: Example dateOfBirth
      description: Summary patient view within a domain.
    PendingReportingAppointmentAttachmentResponse:
      required:
        - guid
      type: object
      properties:
        guid:
          type: string
          description: Attachment GUID.
          example: '123'
        category:
          type: string
          description: Attachment category (e.g. Referral, Worksheet).
          example: Example category
        fileName:
          type: string
          description: Suggested filename for display/download.
          example: Example Name
        addedDateTime:
          type:
            - 'null'
            - string
          description: When the attachment was added.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        addedBy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UserSummaryResponse'
          description: Who added the attachment when available.
        lastModifiedDateTime:
          type:
            - 'null'
            - string
          description: When the attachment was last modified.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        url:
          type:
            - 'null'
            - string
          description: >-
            Short-lived presigned URL for retrieving the attachment content when
            available.
          example: https://example.com
        urlExpiresAtUtc:
          type:
            - 'null'
            - string
          description: UTC expiry timestamp for the presigned URL when available.
          format: date-time
          example: '2020-01-01T00:00:00Z'
      description: Attachment metadata for a pending reporting appointment.
    PendingReportingAppointmentCommentResponse:
      required:
        - guid
        - commentType
      type: object
      properties:
        guid:
          type: string
          description: Comment GUID.
          example: '123'
        commentType:
          type: string
          description: >-
            Comment type. One of: AC (Appointment Comment), AA (Appointment
            Alert), PC (Patient Comment), PA (Patient Alert).
          example: Example commentType
        appointmentId:
          type: string
          description: >-
            Appointment identifier for appointment comments; empty for
            patient-level comments.
          example: '123'
        patientId:
          type: string
          description: Patient identifier associated with the comment when available.
          example: '123'
        commentText:
          type: string
          description: Comment text.
          example: Example commentText
        commentDateTime:
          type:
            - 'null'
            - string
          description: When the comment was created when available.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        isAlert:
          type: boolean
          description: Whether this comment should be treated as an alert.
          example: true
        commentBy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UserSummaryResponse'
          description: Who created the comment when available.
        lastModifiedDateTime:
          type:
            - 'null'
            - string
          description: When the comment was last modified.
          format: date-time
          example: '2020-01-01T00:00:00Z'
      description: >-
        Comment metadata for a pending reporting appointment, including both
        appointment-level and patient-level comments/alerts.
    PendingReportingAppointmentResponse:
      required:
        - domain
        - appointmentId
        - status
        - scheduledSite
      type: object
      properties:
        domain:
          type: string
          description: Domain this appointment belongs to.
          example: Example domain
        appointmentId:
          type: string
          description: Appointment identifier.
          example: '123'
        status:
          enum:
            - NOT ARRIVED
            - ARRIVED
            - DID NOT ATTEND
            - APPPOINTMENT CANCELLED
            - CANCELLATION LIST
            - DICTATION INPROGRESS
            - DICTATED
            - TYPED
            - AUTHORISING
            - AUTHORISED
            - TYPING INPROGRESS
            - PENDING REPORTING
            - STUDY INPROGRESS
            - SECOND REVIEW
            - FINALISED
            - REVIEW TYPED
            - PEER REVIEW
            - SECOND OPINION
          type: string
          description: Appointment status.
          example: NOT ARRIVED
        scheduledSite:
          type: string
          description: Scheduled site name.
          example: Example scheduledSite
        appointmentDate:
          type: string
          description: Appointment date string as stored in QUBS.
          example: Example appointmentDate
        startTime:
          type: string
          description: Scheduled start time string as stored in QUBS.
          example: Example startTime
        endTime:
          type: string
          description: Scheduled end time string as stored in QUBS.
          example: Example endTime
        patientId:
          type: string
          description: Patient identifier when available.
          example: '123'
        patientName:
          type: string
          description: Patient display name.
          example: Example Name
        firstName:
          type: string
          description: Patient first name.
          example: Example Name
        lastName:
          type: string
          description: Patient last name.
          example: Example Name
        dateOfBirth:
          type: string
          description: Patient date of birth string as stored in QUBS.
          example: Example dateOfBirth
        gender:
          type: string
          description: Patient gender/sex string as stored in QUBS.
          example: Example gender
        modality:
          type: string
          description: Exam modality string as stored in QUBS.
          example: Example modality
        studyDescription:
          type: string
          description: Study description as stored in QUBS.
          example: Example description
        clinicalInfo:
          type: string
          description: Clinical information text as stored in QUBS.
          example: Example clinicalInfo
        doctorName:
          type: string
          description: Referring doctor display name.
          example: Example Name
        clinicName:
          type: string
          description: Referring clinic name when available.
          example: Example Name
        priority:
          type: string
          description: Appointment/reporting priority string as stored in QUBS.
          example: Example priority
        reportNeededBy:
          type:
            - 'null'
            - string
          description: Optional deadline timestamp for reporting when available.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        studyInstanceUid:
          type: string
          description: PACS study instance UID when available.
          example: '123'
        radiologistUser:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UserSummaryResponse'
          description: Radiologist user assigned to the appointment when available.
        serviceItems:
          type: array
          items:
            $ref: '#/components/schemas/PendingReportingServiceItemResponse'
          description: Service items attached to the appointment.
      description: Tele reporting appointment view within a domain.
    PendingReportingAppointmentsPageResponse:
      required:
        - items
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/PendingReportingAppointmentResponse'
          description: Tele reporting appointments in the current page.
        nextToken:
          type:
            - 'null'
            - string
          description: >-
            Opaque continuation token to fetch the next page, when more results
            are available.
          example: Example nextToken
      description: >-
        A single page of tele reporting appointments plus an optional
        continuation token.
    PendingReportingServiceItemResponse:
      required:
        - itemNo
      type: object
      properties:
        itemNo:
          type: string
          description: Service item number.
          example: Example itemNo
        shortDescription:
          type: string
          description: Human-readable service item description.
          example: Example description
      description: Service item details required for tele reporting.
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
          example: Example type
        title:
          type:
            - 'null'
            - string
          example: Example title
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
          example: 1
        detail:
          type:
            - 'null'
            - string
          example: Example detail
        instance:
          type:
            - 'null'
            - string
          example: Example instance
    ScanSkillResponse:
      type: object
      properties:
        duration:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: >-
            Configured duration (in minutes) for the staff member for this exam
            key when available.
          format: int32
          example: 1
        hasComment:
          type: boolean
          description: Whether a comment is present for this exam key.
          example: true
        comment:
          type:
            - 'null'
            - string
          description: Optional comment text.
          example: Example comment
      description: Scan skill details for a specific exam key.
    SiteInfoResponse:
      required:
        - domain
        - siteName
      type: object
      properties:
        domain:
          type: string
          description: Domain this site belongs to.
          example: Example domain
        siteName:
          type: string
          description: Site name.
          example: Example Site
      description: A site that belongs to a domain and is available to the partner.
    SiteSettingsResponse:
      required:
        - domain
        - siteName
        - companyName
      type: object
      properties:
        domain:
          type: string
          description: Domain this site belongs to.
          example: Example domain
        siteName:
          type: string
          description: Site name.
          example: Example Site
        companyName:
          type: string
          description: Company name associated with the site.
          example: Example Name
        timeZone:
          type: string
          description: IANA or platform timezone identifier used by the site.
          example: Example timeZone
        defaultBilling:
          type: string
          description: Default billing type used when booking or invoicing.
          example: Example defaultBilling
        defaultPriority:
          type: string
          description: Default appointment priority.
          example: Example defaultPriority
        appendStudyDescription:
          type: boolean
          description: >-
            Whether to append the study description in downstream outputs where
            applicable.
          example: true
        patientDobRequired:
          type: boolean
          description: Whether date of birth is required for patients at this site.
          example: true
        patientSexRequired:
          type: boolean
          description: Whether patient sex is required for patients at this site.
          example: true
        lastModifiedDateTime:
          type: string
          description: When the site settings were last updated.
          format: date-time
          example: '2020-01-01T00:00:00Z'
        lastModifiedBy:
          type: string
          description: Who last updated the site settings.
          example: Example lastModifiedBy
      description: Operational configuration settings for a specific site within a domain.
    SiteSettingsSummaryResponse:
      required:
        - domain
        - siteName
        - companyName
      type: object
      properties:
        domain:
          type: string
          description: Domain this site belongs to.
          example: Example domain
        siteName:
          type: string
          description: Site name.
          example: Example Site
        companyName:
          type: string
          description: Company name associated with the site.
          example: Example Name
        timeZone:
          type: string
          description: IANA or platform timezone identifier used by the site.
          example: Example timeZone
      description: Summary configuration settings for a specific site within a domain.
    StaffSkillsGridResponse:
      type: object
      properties:
        examKeys:
          type: array
          items:
            type: string
            example: Example examKeys
          description: Ordered list of exam keys used as columns in the grid.
        examDisplay:
          type: object
          additionalProperties:
            type: string
            example: Example examDisplay
          description: Map of exam key to display label.
        headerComments:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/HeaderCommentResponse'
          description: Map of exam key to optional header comment/marker metadata.
        employees:
          type: array
          items:
            $ref: '#/components/schemas/EmployeeSkillResponse'
          description: List of staff rows in the grid.
        examSites:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
              example: Example examSites
          description: Map of exam key to list of sites where the exam is available.
        skToExamCodeId:
          type: object
          additionalProperties:
            type: string
            example: '123'
          description: Map of internal exam key to examCodeId.
        examCodeSiteKeys:
          type: object
          additionalProperties:
            type: object
            additionalProperties:
              type: string
              example: ABC123
          description: Nested map of examCodeId to site name to internal key.
      description: >-
        Staff skill grid data for a site, including exam metadata, staff rows,
        and optional comments.
    UserSummaryResponse:
      required:
        - username
      type: object
      properties:
        username:
          type: string
          description: User's unique username.
          example: Example Name
        firstName:
          type: string
          description: User's first name.
          example: Example Name
        initials:
          type: string
          description: User's initials when available.
          example: Example initials
        lastName:
          type: string
          description: User's last name.
          example: Example Name
        role:
          type: string
          description: User role when available.
          example: Example role
      description: A lightweight user identity summary.
  securitySchemes:
    Bearer:
      type: http
      description: JWT bearer token
      scheme: bearer
      bearerFormat: JWT
security:
  - Bearer: []
tags:
  - name: Site Settings
    description: >-
      Partner-facing endpoints for listing sites and retrieving site
      configuration within a domain.
  - name: Exam Codes
    description: >-
      Partner-facing endpoints for retrieving exam code configuration for a site
      within a domain.
  - name: Staff Skills
    description: >-
      Partner-facing endpoints for retrieving the staff skill grid and related
      metadata for a site within a domain.
  - name: Appointments
    description: Partner-facing endpoints for retrieving appointments within a domain.
  - name: Attachments
    description: >-
      Partner-facing endpoints for retrieving appointment attachments and
      generating short-lived presigned URLs.
  - name: Comments
    description: >-
      Partner-facing endpoints for retrieving appointment and patient
      comments/alerts associated with an appointment.
  - name: Patients
    description: Partner-facing endpoints for retrieving patients within a domain.
  - name: Reporting
    description: >-
      Partner-facing endpoints for retrieving appointments that are pending
      reporting.
