OrderTestList:
  type: object
  properties:
    InternalOID:
      type: integer
      description: Internal order ID
    OrderID:
      type: string
      description: Order ID (e.g., 0025030300001)
    PlacerID:
      type: string
      nullable: true
    InternalPID:
      type: integer
      description: Patient internal ID
    SiteID:
      type: integer
    PVADTID:
      type: integer
      description: Visit ADT ID
    ReqApp:
      type: string
      nullable: true
    Priority:
      type: string
      enum: [R, S, U]
      description: |
        R: Routine
        S: Stat
        U: Urgent
    PriorityLabel:
      type: string
      description: Priority display text
    TrnDate:
      type: string
      format: date-time
      description: Transaction/Order date
    EffDate:
      type: string
      format: date-time
      description: Effective date
    CreateDate:
      type: string
      format: date-time
    OrderStatus:
      type: string
      enum: [ORD, SCH, ANA, VER, REV, REP]
      description: |
        ORD: Ordered
        SCH: Scheduled
        ANA: Analysis
        VER: Verified
        REV: Reviewed
        REP: Reported
    OrderStatusLabel:
      type: string
      description: Order status display text

OrderTest:
  type: object
  properties:
    InternalOID:
      type: integer
      description: Internal order ID
    OrderID:
      type: string
      description: Order ID (e.g., 0025030300001)
    PlacerID:
      type: string
      nullable: true
    InternalPID:
      type: integer
      description: Patient internal ID
    SiteID:
      type: integer
    PVADTID:
      type: integer
      description: Visit ADT ID
    ReqApp:
      type: string
      nullable: true
    Priority:
      type: string
      enum: [R, S, U]
      description: |
        R: Routine
        S: Stat
        U: Urgent
    PriorityLabel:
      type: string
      description: Priority display text
    TrnDate:
      type: string
      format: date-time
      description: Transaction/Order date
    EffDate:
      type: string
      format: date-time
      description: Effective date
    CreateDate:
      type: string
      format: date-time
    OrderStatus:
      type: string
      enum: [ORD, SCH, ANA, VER, REV, REP]
      description: |
        ORD: Ordered
        SCH: Scheduled
        ANA: Analysis
        VER: Verified
        REV: Reviewed
        REP: Reported
    OrderStatusLabel:
      type: string
      description: Order status display text
    Specimens:
      type: array
      items:
        $ref: '#/OrderSpecimen'
      description: Associated specimens for this order
    Tests:
      type: array
      items:
        $ref: '#/OrderTestItem'
      description: Test results (patres) for this order

OrderSpecimen:
  type: object
  properties:
    InternalSID:
      type: integer
      description: Internal specimen ID
    SID:
      type: string
      description: Specimen ID (e.g., 0025030300001-S01)
    SiteID:
      type: integer
    OrderID:
      type: integer
      description: Reference to internal order ID
    ConDefID:
      type: integer
      description: Container Definition ID
      nullable: true
    ConCode:
      type: string
      description: Container code
      nullable: true
    ConName:
      type: string
      description: Container name
      nullable: true
    Qty:
      type: integer
      description: Quantity
    Unit:
      type: string
      description: Unit of measurement
    Status:
      type: string
      enum: [PENDING, COLLECTED, RECEIVED, PREPARED, REJECTED]
      description: Current specimen status
    GenerateBy:
      type: string
      description: Source that generated this specimen
    CreateDate:
      type: string
      format: date-time

OrderTestItem:
  type: object
  properties:
    ResultID:
      type: integer
      description: Unique result ID
    OrderID:
      type: integer
      description: Reference to internal order ID
    InternalSID:
      type: integer
      description: Reference to specimen
      nullable: true
    TestSiteID:
      type: integer
      description: Test definition site ID
    TestSiteCode:
      type: string
      description: Test code
    TestSiteName:
      type: string
      description: Test name
      nullable: true
    TestType:
      type: string
      description: Test type code identifying the test category
      enum: [TEST, PARAM, CALC, GROUP, TITLE]
    SID:
      type: string
      description: Order ID reference
    SampleID:
      type: string
      description: Sample ID (same as OrderID)
    SeqScr:
      type: integer
      nullable: true
      description: Sequence number for this test on the screen
    SeqRpt:
      type: integer
      nullable: true
      description: Sequence number for this test in reports
    Result:
      type: string
      description: Test result value
      nullable: true
    Discipline:
      type: object
      description: Discipline metadata used for ordering tests
      properties:
        DisciplineID:
          type: integer
          nullable: true
        DisciplineCode:
          type: string
          nullable: true
        DisciplineName:
          type: string
          nullable: true
        SeqScr:
          type: integer
          nullable: true
          description: Discipline sequence on the screen
        SeqRpt:
          type: integer
          nullable: true
          description: Discipline sequence in reports
    ResultDateTime:
      type: string
      format: date-time
      description: Result timestamp
    CreateDate:
      type: string
      format: date-time

OrderItem:
  type: object
  properties:
    id:
      type: integer
    OrderID:
      type: string
    TestID:
      type: integer
    SpecimenID:
      type: string
    Status:
      type: string
