Location:
  type: object
  properties:
    LocationID:
      type: integer
      description: Primary key
    SiteID:
      type: integer
      description: Reference to site
    LocCode:
      type: string
      maxLength: 6
      description: Location code (short identifier)
    Parent:
      type: integer
      nullable: true
      description: Parent location ID for hierarchical locations
    LocFull:
      type: string
      maxLength: 255
      description: Full location name
    Description:
      type: string
      maxLength: 255
      description: Location description
    LocType:
      type: string
      description: Location type code (e.g., ROOM, WARD, BUILDING)
    CreateDate:
      type: string
      format: date-time
    EndDate:
      type: string
      format: date-time
      nullable: true

Contact:
  type: object
  properties:
    ContactID:
      type: integer
      description: Primary key
    NameFirst:
      type: string
      description: First name (required)
    NameLast:
      type: string
      description: Last name
    Title:
      type: string
      description: Title (e.g., Dr, Mr, Mrs)
    Initial:
      type: string
      description: Middle initial
    Birthdate:
      type: string
      format: date-time
      description: Date of birth
    EmailAddress1:
      type: string
      format: email
      description: Primary email address
    EmailAddress2:
      type: string
      format: email
      description: Secondary email address
    Phone:
      type: string
      description: Primary phone number
    MobilePhone1:
      type: string
      description: Primary mobile number
    MobilePhone2:
      type: string
      description: Secondary mobile number
    Specialty:
      type: string
      description: Medical specialty code
    SubSpecialty:
      type: string
      description: Sub-specialty code
    CreateDate:
      type: string
      format: date-time
    EndDate:
      type: string
      format: date-time
      description: Occupation display text

ContactDetail:
  type: object
  properties:
    ContactDetID:
      type: integer
      description: Primary key
    ContactID:
      type: integer
      description: Parent contact ID
    SiteID:
      type: integer
      nullable: true
      description: Site identifier
    ContactCode:
      type: string
      nullable: true
      description: Contact code at site
    ContactEmail:
      type: string
      nullable: true
      description: Contact email address
    OccupationID:
      type: integer
      nullable: true
      description: Occupation reference
    JobTitle:
      type: string
      nullable: true
      description: Job title
    Department:
      type: string
      nullable: true
      description: Department name
    ContactStartDate:
      type: string
      format: date-time
    ContactEndDate:
      type: string
      format: date-time
      nullable: true

ContactDetailOperations:
  type: object
  properties:
    created:
      type: array
      description: New contact details to create
      items:
        $ref: '#/ContactDetail'
    edited:
      type: array
      description: Existing contact details to update
      items:
        allOf:
          - $ref: '#/ContactDetail'
          - type: object
            required:
              - ContactDetID
    deleted:
      type: array
      description: Contact detail IDs to soft delete
      items:
        type: integer

Occupation:
  type: object
  properties:
    OccupationID:
      type: integer
      description: Primary key
    OccCode:
      type: string
      description: Occupation code
    OccText:
      type: string
      description: Occupation name/text
    Description:
      type: string
      description: Additional description
    CreateDate:
      type: string
      format: date-time

MedicalSpecialty:
  type: object
  properties:
    SpecialtyID:
      type: integer
      description: Primary key
    SpecialtyText:
      type: string
      description: Specialty name/text
    Parent:
      type: integer
      description: Parent specialty ID for hierarchical structure
    Title:
      type: string
      description: Title/abbreviation
    CreateDate:
      type: string
      format: date-time
    EndDate:
      type: string
      format: date-time

Counter:
  type: object
  properties:
    CounterID:
      type: integer
      description: Primary key
    CounterDesc:
      type: string
      description: Counter description/name
    CounterValue:
      type: integer
      description: Current counter value
    CounterStart:
      type: integer
      description: Starting value for the counter
    CounterEnd:
      type: integer
      description: Ending value (for auto-reset)
    CounterReset:
      type: string
      description: Reset pattern (e.g., D=Daily, M=Monthly, Y=Yearly)
    CreateDate:
      type: string
      format: date-time
    EndDate:
      type: string
      format: date-time
