/api/organization/account:
  get:
    tags: [Organization]
    summary: List accounts
    security:
      - bearerAuth: []
    responses:
      '200':
        description: List of accounts

  post:
    tags: [Organization]
    summary: Create account
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/Account'
    responses:
      '201':
        description: Account created

  delete:
    tags: [Organization]
    summary: Delete account
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - AccountID
            properties:
              AccountID:
                type: integer
    responses:
      '200':
        description: Account deleted

/api/organization/account/{id}:
  get:
    tags: [Organization]
    summary: Get account by ID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    responses:
      '200':
        description: Account details
        content:
          application/json:
            schema:
              $ref: '../components/schemas/organization.yaml#/Account'

  patch:
    tags: [Organization]
    summary: Update account
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              AccountName:
                type: string
              Parent:
                type: integer
    responses:
      '200':
        description: Account updated

/api/organization/site:
  get:
    tags: [Organization]
    summary: List sites
    security:
      - bearerAuth: []
    responses:
      '200':
        description: List of sites

  post:
    tags: [Organization]
    summary: Create site
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/Site'
    responses:
      '201':
        description: Site created


  delete:
    tags: [Organization]
    summary: Delete site
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - id
            properties:
              id:
                type: integer
    responses:
      '200':
        description: Site deleted

/api/organization/site/{id}:
  get:
    tags: [Organization]
    summary: Get site by ID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    responses:
      '200':
        description: Site details

  patch:
    tags: [Organization]
    summary: Update site
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              SiteName:
                type: string
              SiteCode:
                type: string
              AccountID:
                type: integer
    responses:
      '200':
        description: Site updated

/api/organization/discipline:
  get:
    tags: [Organization]
    summary: List disciplines
    security:
      - bearerAuth: []
    responses:
      '200':
        description: List of disciplines

  post:
    tags: [Organization]
    summary: Create discipline
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/Discipline'
    responses:
      '201':
        description: Discipline created


  delete:
    tags: [Organization]
    summary: Delete discipline
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - id
            properties:
              id:
                type: integer
    responses:
      '200':
        description: Discipline deleted

/api/organization/discipline/{id}:
  get:
    tags: [Organization]
    summary: Get discipline by ID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    responses:
      '200':
        description: Discipline details

  patch:
    tags: [Organization]
    summary: Update discipline
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              DisciplineName:
                type: string
              DisciplineCode:
                type: string
              SeqScr:
                type: integer
                description: Display order on screen
              SeqRpt:
                type: integer
                description: Display order in reports
    responses:
      '200':
        description: Discipline updated

/api/organization/department:
  get:
    tags: [Organization]
    summary: List departments
    security:
      - bearerAuth: []
    responses:
      '200':
        description: List of departments

  post:
    tags: [Organization]
    summary: Create department
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/Department'
    responses:
      '201':
        description: Department created


  delete:
    tags: [Organization]
    summary: Delete department
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - id
            properties:
              id:
                type: integer
    responses:
      '200':
        description: Department deleted

/api/organization/department/{id}:
  get:
    tags: [Organization]
    summary: Get department by ID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    responses:
      '200':
        description: Department details

  patch:
    tags: [Organization]
    summary: Update department
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              DeptName:
                type: string
              DeptCode:
                type: string
              SiteID:
                type: integer
    responses:
      '200':
        description: Department updated

/api/organization/workstation:
  get:
    tags: [Organization]
    summary: List workstations
    security:
      - bearerAuth: []
    responses:
      '200':
        description: List of workstations

  post:
    tags: [Organization]
    summary: Create workstation
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/Workstation'
    responses:
      '201':
        description: Workstation created


  delete:
    tags: [Organization]
    summary: Delete workstation
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - id
            properties:
              id:
                type: integer
    responses:
      '200':
        description: Workstation deleted

/api/organization/workstation/{id}:
  get:
    tags: [Organization]
    summary: Get workstation by ID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    responses:
      '200':
        description: Workstation details

  patch:
    tags: [Organization]
    summary: Update workstation
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              WorkstationName:
                type: string
              WorkstationCode:
                type: string
              SiteID:
                type: integer
              DepartmentID:
                type: integer
    responses:
      '200':
        description: Workstation updated

# HostApp
/api/organization/hostapp:
  get:
    tags: [Organization]
    summary: List host applications
    security:
      - bearerAuth: []
    parameters:
      - name: HostAppID
        in: query
        schema:
          type: string
      - name: HostAppName
        in: query
        schema:
          type: string
    responses:
      '200':
        description: List of host applications
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                message:
                  type: string
                data:
                  type: array
                  items:
                    $ref: '../components/schemas/organization.yaml#/HostApp'

  post:
    tags: [Organization]
    summary: Create host application
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/HostApp'
    responses:
      '201':
        description: Host application created


  delete:
    tags: [Organization]
    summary: Delete host application (soft delete)
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - HostAppID
            properties:
              HostAppID:
                type: string
    responses:
      '200':
        description: Host application deleted

/api/organization/hostapp/{id}:
  get:
    tags: [Organization]
    summary: Get host application by ID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    responses:
      '200':
        description: Host application details
        content:
          application/json:
            schema:
              $ref: '../components/schemas/organization.yaml#/HostApp'

  patch:
    tags: [Organization]
    summary: Update host application
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              HostAppName:
                type: string
              SiteID:
                type: integer
    responses:
      '200':
        description: Host application updated

# HostComPara
/api/organization/hostcompara:
  get:
    tags: [Organization]
    summary: List host communication parameters
    security:
      - bearerAuth: []
    parameters:
      - name: HostAppID
        in: query
        schema:
          type: string
      - name: HostIP
        in: query
        schema:
          type: string
    responses:
      '200':
        description: List of host communication parameters
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                message:
                  type: string
                data:
                  type: array
                  items:
                    $ref: '../components/schemas/organization.yaml#/HostComPara'

  post:
    tags: [Organization]
    summary: Create host communication parameters
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/HostComPara'
    responses:
      '201':
        description: Host communication parameters created


  delete:
    tags: [Organization]
    summary: Delete host communication parameters (soft delete)
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - HostAppID
            properties:
              HostAppID:
                type: string
    responses:
      '200':
        description: Host communication parameters deleted

/api/organization/hostcompara/{id}:
  get:
    tags: [Organization]
    summary: Get host communication parameters by HostAppID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    responses:
      '200':
        description: Host communication parameters details
        content:
          application/json:
            schema:
              $ref: '../components/schemas/organization.yaml#/HostComPara'

  patch:
    tags: [Organization]
    summary: Update host communication parameters
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              HostIP:
                type: string
              HostPort:
                type: string
              HostPwd:
                type: string
    responses:
      '200':
        description: Host communication parameters updated

# CodingSys
/api/organization/codingsys:
  get:
    tags: [Organization]
    summary: List coding systems
    security:
      - bearerAuth: []
    parameters:
      - name: CodingSysAbb
        in: query
        schema:
          type: string
      - name: FullText
        in: query
        schema:
          type: string
    responses:
      '200':
        description: List of coding systems
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                message:
                  type: string
                data:
                  type: array
                  items:
                    $ref: '../components/schemas/organization.yaml#/CodingSys'

  post:
    tags: [Organization]
    summary: Create coding system
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '../components/schemas/organization.yaml#/CodingSys'
    responses:
      '201':
        description: Coding system created


  delete:
    tags: [Organization]
    summary: Delete coding system (soft delete)
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - CodingSysID
            properties:
              CodingSysID:
                type: integer
    responses:
      '200':
        description: Coding system deleted

/api/organization/codingsys/{id}:
  get:
    tags: [Organization]
    summary: Get coding system by ID
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    responses:
      '200':
        description: Coding system details
        content:
          application/json:
            schema:
              $ref: '../components/schemas/organization.yaml#/CodingSys'

  patch:
    tags: [Organization]
    summary: Update coding system
    security:
      - bearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              CodingSysAbb:
                type: string
              FullText:
                type: string
              Description:
                type: string
    responses:
      '200':
        description: Coding system updated
