Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

The Service, Support & Logistics Domain API.

See

Swagger open api macro
displayOperationIdfalse
methodsnone,get,put,post,delete,options,head,patch,trace
validator
url
token
filter
defaultModelRenderingexample
showCommonExtensionsfalse
expandlist
password
filename
operations
maxDisplayedTags
attachfalse
displayRequestDurationfalse
showExtensionsfalse
username
order
openapi: 3.0.0

info:
  title: eHealth SSL Order service
  version: 1.0.0
  description: eHealth SSL Order service
  termsOfService: http://ehealth.sundhed.dk/terms/
  license:
    name: Proprietary
  contact:
    name: Systematic A/S
    url: https://systematic.com/
    email: support.ehealth.servicedesk@systematic.com

externalDocs:
  description: eHealth documentation
  url: http://ehealth-documentation.s3-website-eu-west-1.amazonaws.com/

tags:
  - name: order
    description: Operations with orders
  - name: order line
    description: Operations with order lines
  - name: trace line
    description: Operations with trace lines
  - name: Party
    description: Operations with parties
  - name: Contract
    description: Operations with contracts

security:
  - bearerAuth: []

paths:
  /party:
    post:
      tags:
        - Party
      summary: Create new Party
      description: Create new Party
      operationId: createParty
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Party"
        description: Party which should be created.
        required: true
      responses:
        "201":
          description: The Party was successfully created
          headers:
            location:
              description: The location of the newly created Party.
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    put:
      tags:
        - Party
      summary: Update Party
      description: Update Party
      operationId: updateParty
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Party"
        description: Party with data to update
        required: true
      responses:
        "204":
          description: The Party was successfully updated
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: Party not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    get:
      tags:
        - Party
      summary: Search parties by parameters
      description: Search parties by parameters
      operationId: getParties
      parameters:
        - name: name
          in: query
          description: Multiple name values can be provided
          explode: true
          schema:
            type: array
            items:
              type: string
              pattern: ^(?!\s*$).+
        - name: role
          in: query
          description: Multiple role values can be provided
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - ACCOUNTING
                - BUYER
                - SELLER
      responses:
        "200":
          description: List of Parties was successfully returned
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Party"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  "/party/{id}":
    get:
      tags:
        - Party
      summary: Return Party by id
      description: Return Party by id
      operationId: getPartyById
      parameters:
        - name: id
          in: path
          description: Id of Party
          required: true
          schema:
            type: string
      responses:
        "200":
          description: The Party was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Party"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: Party not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /contract:
    post:
      tags:
        - Contract
      summary: Create new Contract
      description: Create new Contract
      operationId: createContract
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Contract"
        description: Contract which should be created
        required: true
      responses:
        "201":
          description: The Contract was successfully created
          headers:
            location:
              description: The location of the newly created Contract
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    get:
      tags:
        - Contract
      summary: Search for Contracts by parameters
      description: Search for Contracts by parameters
      operationId: getContracts
      parameters:
        - name: seller
          in: query
          description: Single seller reference can be provided
          schema:
            type: string
        - name: account
          in: query
          description: Single account reference can be provided
          schema:
            type: string
        - name: buyer
          in: query
          description: Single buyer reference can be provided
          schema:
            type: string
      responses:
        "200":
          description: List of Contracts was successfully returned
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Contract"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  "/contract/{id}":
    get:
      tags:
        - Contract
      summary: Return Contract by id
      description: Return Contract by id
      operationId: getContractById
      parameters:
        - name: id
          in: path
          description: Id of Contract
          required: true
          schema:
            type: string
      responses:
        "200":
          description: The Contract was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Contract"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        #       TODO: 2022-01-24 OLL This is not working - returns a 500 if used
        #        "403":
        #          description: Forbidden
        #          content:
        #            "*/*":
        #              schema:
        #                $ref: "#/components/schemas/Error"
        "404":
          description: Contract not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

    patch:
      tags:
        - Contract
      summary: Patch selected fields of the given contract
      description: Patch selected fields of the given contract
      operationId: patchContract
      parameters:
        - name: id
          in: path
          description: Id of Contract
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        $ref: "#/components/requestBodies/PatchRequest"
      responses:
        "204":
          description: The contract was successfully updated.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The contract was not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  /order:
    post:
      operationId: createOrder
      summary: Create a new order.
      tags:
        - order
      requestBody:
        $ref: "#/components/requestBodies/Order"
      responses:
        "201":
          description: The order was successfully created.
          headers:
            Location:
              description: The location of the newly created Order.
              schema:
                type: string
                format: uri
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    put:
      summary: Update an order.
      description: id property is required.
      tags:
        - order
      operationId: updateOrder
      requestBody:
        $ref: "#/components/requestBodies/Order"
      responses:
        "204":
          description: The order was successfully updated.
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: User is unauthorized to change field.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/order/{id}":
    get:
      operationId: getOrderById
      summary: Retrieve an order
      tags:
        - order
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the order to retrieve.
          schema:
            type: string
      responses:
        "200":
          description: The order was successfully retrieved.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Order"
        "400":
          description: The request could not be understood
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        #       TODO: 2022-01-24 OLL This is not working
        #        "403":
        #          description: Forbidden
        #          content:
        #            "*/*":
        #              schema:
        #                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

    patch:
      operationId: updatedPartialOrder
      summary: Update an order partially
      tags:
        - order
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the order to update partially.
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OrderBase"
        description: The data of order to update partially.
        required: true
      responses:
        "204":
          description: The order was successfully updated.
        "400":
          description: The request could not be understood
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    delete:
      operationId: deleteOrder
      summary: Delete an order
      tags:
        - order
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the order to delete.
          schema:
            type: string
      responses:
        "204":
          description: The order was successfully deleted.
        "400":
          description: The request could not be understood
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Order is not in state suitable for deletion.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/order/{id}/details":
    get:
      operationId: getOrderDetails
      summary: Retrieve details of an order.
      tags:
        - order
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the order details to retrieve.
          schema:
            type: string
      responses:
        "200":
          description: The order details were successfully retrieved.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderDetails"
        "400":
          description: The request could not be understood
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  "/order/{id}/note":
    post:
      operationId: createOrderNote
      summary: Create new note for the order.
      tags:
        - order
      parameters:
        - name: id
          in: path
          required: true
          description: the id of the order notes to retrieve
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OrderNotes"
        required: true
      responses:
        "204":
          description: The OrderNotes was successfully added to order.
        "400":
          description: The request could not be understood
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /orders:
    get:
      operationId: getOrders
      summary: Search orders by parameters
      tags:
        - order
      parameters:
        - name: seller
          in: query
          description: Multiple references to SellerSupplierParty can be provided.
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: buyer
          in: query
          description: Multiple references to BuyerCustomerParty can be provided.
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: identifier
          in: query
          description: Multiple identifier values like
            http://ehealth.xxx.dk/somesystem|somecode can be provided.
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: patient
          in: query
          description: Multiple patient refernces from clinical domain can be provided.
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Orders were successfully retrieved.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Order"
        "400":
          description: The request could not be understood
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /order-line:
    post:
      operationId: createOrderLine
      summary: Create a new order line.
      tags:
        - order line
      requestBody:
        $ref: "#/components/requestBodies/OrderLine"
      responses:
        "201":
          description: The order line was successfully created.
          headers:
            Location:
              description: The location of the newly created order line.
              schema:
                type: string
                format: uri
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    put:
      summary: Update an order line.
      description: id property is required.
      tags:
        - order line
      operationId: updateOrderLine
      requestBody:
        $ref: "#/components/requestBodies/OrderLine"
      responses:
        "204":
          description: The order line was successfully updated.
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: User is unauthorized to change field.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Ilegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/order-line/{id}":
    get:
      operationId: getOrderLineById
      summary: Retrieve an order line
      tags:
        - order line
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the order line to retrieve.
          schema:
            type: string
      responses:
        "200":
          description: The order line was successfully retrieved.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderLine"
        "400":
          description: The request could not be understood
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        #        TODO: 2022-01-24 OLL This is not working
        #        "403":
        #          description: Forbidden
        #          content:
        #            "*/*":
        #              schema:
        #                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

    patch:
      tags:
        - order line
      summary: Patch the selected fields for a given order line
      description: Patch the selected fields for a given order line
      operationId: patchOrderLine
      parameters:
        - name: id
          in: path
          description: Id of the order line
          required: true
          schema:
            type: string
            format: string
      requestBody:
        $ref: "#/components/requestBodies/PatchRequest"
      responses:
        "204":
          description: The order line was successfully updated.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The order line was not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    delete:
      operationId: deleteOrderLine
      summary: Delete an order line
      tags:
        - order line
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the order line to delete.
          schema:
            type: string
      responses:
        "204":
          description: The order line was successfully deleted.
        "400":
          description: The request could not be understood
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Order line is not in state suitable for deletion.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  /order-lines:
    post:
      operationId: createOrderLines
      summary: Create new order lines
      tags:
        - order line
      requestBody:
        $ref: "#/components/requestBodies/OrderLineArray"
      responses:
        "201":
          description: The order lines were successfully created.
          headers:
            Location:
              description: The location of the newly created order lines.
              schema:
                type: array
                items:
                  type: string
                  format: uri
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    put:
      operationId: updateOrderLines
      summary: Update existing order lines
      tags:
        - order line
      requestBody:
        $ref: "#/components/requestBodies/OrderLineArray"
      responses:
        "204":
          description: Order lines were successfully updated.
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    get:
      operationId: getOrderLines
      summary: Search order lines by parameters
      tags:
        - order line
      parameters:
        - name: order
          in: query
          description: Multiple references to Order can be provided.
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Order lines were successfully retrieved.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/OrderLine"
        "400":
          description: The request could not be understood
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        #        TODO: 2022-01-24 OLL This is not working
        #        "403":
        #          description: Forbidden
        #          content:
        #            "*/*":
        #              schema:
        #                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /system/findOrCreateParty:
    post:
      tags:
        - Party
      summary: Find or create Party for given organizationReference
      description: >-
        This is a infrastructure-only operation that will search for a Party
        having the given organizationReference.

        If no Party is found a Party will be created referencing the given organizationReference and an empty list of allowedRoles.
      operationId: systemFindOrCreatePartyMethod
      requestBody:
        $ref: "#/components/requestBodies/OrganizationReference"
      responses:
        "201":
          description: The Party was successfully found or created
          headers:
            location:
              description: The location of the found or created Party.
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  /system/hasOpenOrder:
    get:
      tags:
        - Order
      summary: Check if an open order exists for the careplan
      description: Check if an open order exists for the careplan
      operationId: hasOpenOrder
      parameters:
        - name: careplan
          description: Single careplan reference can be provided
          in: query
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Boolean {body} = true if an open order exists for the careplan
            exists, and body = {false} if no order or status is not open
          content:
            application/json:
              schema:
                type: boolean
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /custom/hasValidContract:
    get:
      tags:
        - Contract
      summary: Check if a valid contract exists between the two parties
      description: Check if a valid contract exists between the two parties
      operationId: hasValidContract
      parameters:
        - name: seller
          description: Single seller reference can be provided, e.g.
            "http://ssl-order.ehealth.sundhed.dk/v1/party/b83e7b2e-779f-44fc-9c4d-b1f564303a31"
          in: query
          required: true
          schema:
            type: string
        - name: buyer
          description: Single buyer reference can be provided, e.g.
            "https://ssl-order.ehealth.sundhed.dk/v1/party/d36202ed-4751-449b-a371-53a94b6b3ca4"
          in: query
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Boolean {body} = true if valid contract between seller and buyer
            exists, and body = {false} if no contract
          content:
            application/json:
              schema:
                type: boolean
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        #        TODO: 2022-01-24 OLL This is not working
        #        "403":
        #          description: Forbidden
        #          content:
        #            "*/*":
        #              schema:
        #                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /custom/findOrCreateParty:
    post:
      tags:
        - Party
      summary: Find or create Party for given organizationReference
      description: >-
        This operation will search for a Party having the given
        organizationReference.

        If no Party is found a Party will be created referencing the given organizationReference and a list of allowedRoles depending on the user type supplied in the authentication token:

        - UserType PRACITIONER, allowedRoles: BUYER, ACCOUNTING

        - UserType SSL, allowedRoles: SELLER

        The given organizationReference must match the organization context supplied in the authentication token.
      operationId: findOrCreatePartyMethod
      requestBody:
        $ref: "#/components/requestBodies/OrganizationReference"
      responses:
        "201":
          description: The Party was successfully found or created
          headers:
            location:
              description: The location of the found or created Party.
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Forbidden
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

servers:
  - url: https://ssl-order.{environment}.ehealth.sundhed.dk/v1
    variables:
      environment:
        default: unknown

components:
  requestBodies:
    PatchRequest:
      content:
        application/json-patch+json:
          schema:
            $ref: "#/components/schemas/PatchRequest"
      description: The JSON patch object
      required: true

    Order:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Order"
      required: true
    OrderLineArray:
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: "#/components/schemas/OrderLine"
      required: true
    OrderLine:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/OrderLine"
      required: true
    OrganizationReference:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/OrganizationReference"
      description: OrganizationReference of the Party
      required: true

  securitySchemes:
    bearerAuth:
      description: Bearer authorization (JWT) token, e.g. `Bearer <token>`
      type: http
      scheme: bearer
      bearerFormat: JWT  # optional, for documentation purposes only

  schemas:
    Party:
      type: object
      required:
        - allowedRoles
        - name
      properties:
        id:
          type: string
          description: Unique ID of this Party. Assigned by server
          example: 1
        allowedRoles:
          type: array
          items:
            type: string
            enum:
              - ACCOUNTING
              - BUYER
              - SELLER
          description: Allowed roles for this party
          example:
            - BUYER
            - ACCOUNTING
        name:
          type: string
          pattern: ^(?!\s*$).+
          description: Party name
          example: Aarhus University Hospital
        email:
          type: string
          format: email
          description: Party contact person email
          example: auh@rm.dk
        organization:
          type: string
          description: Reference to the corresponding ehealth-organisation in the clinical
            domain. Pattern should be used
            ^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+\/Organization/\d+$
          example: https://ehealth.sundhed.dk/organization/fhir/Organization/1566241

    Contract:
      type: object
      required:
        - validityPeriod
        - seller
        - account
      properties:
        id:
          type: string
          description: Unique ID of this contract. Assigned by server
          example: 2
        name:
          type: string
          #         Længden er 50 på DB tabellen, men den kan se således ud
          #         catalogue-item/68c5d987-b530-48bd-9869-e2f2f0ee5387 altså length på 51
          #          maxLength: 51
          pattern: ^(?!\s*$).+
          description: A human readable short headline describing this contract.
          example: XYZ Supplier 2019-21 for Mainland area
        validityPeriod:
          type: object
          required:
            - start
          properties:
            start:
              type: string
              format: date
              description: Start Date for this time period
              example: 2019-01-01
            end:
              type: string
              format: date
              description: Last day of contract validity period
              example: 2020-01-01
          description: Period where this contract is valid
        seller:
          type: string
          example: http://ehealth.sundhed.dk/ssl-governance/v1/party/456
          description: Reference (by rest url) to the SSL service provider
        account:
          type: string
          example: http://ehealth.sundhed.dk/ssl-governance/v1/party/457
          description: Reference (by rest url) to the healthcare organisation responsible
            for paying for services. Typically this will be a high level
            organisation like a region or municipality
        buyer:
          type: array
          items:
            type: string
          example:
            - http://ehealth.sundhed.dk/ssl-governance/v1/party/458
            - http://ehealth.sundhed.dk/ssl-governance/v1/party/459
          description: References (by rest url) to the healthcare organisations ordering
            services. A contract can support multiple buyers (e.g. different
            hospitals or departments)
        reminderDays:
          type: integer
          format: int32
          description: Default number of days before an appointment with a patient where a
            reminder should be sent
          example: 30

    Order:
      type: object
      description: An order represents a request for items and services to be delivered to
        a recipient. The order is placed by a practioner and executed by a
        provider.
      allOf:
        - required:
            - status
            - buyer
            - receiver
        - $ref: "#/components/schemas/OrderBase"

    OrderBase:
      properties:
        id:
          type: string
          description: Globally unique ID of this order. Assigned by server.
        threadId:
          type: string
          description: Thread id for ehealth-messages for this order.
        identifiers:
          type: array
          description: Identifiers to connect Order to external content available in other
            frameworks or protocols.
          items:
            $ref: "#/components/schemas/Identifier"
        status:
          $ref: "#/components/schemas/OrderStatus"
        priority:
          type: boolean
          description: Shows if this order has high priority.
        notes:
          type: array
          description: Notes attached to the order by buyer or seller. These are intended
            to contain remarks or details about the fulfilment of the order
          example:
            - timestamp: 2020-01-01T00:00:00Z
              authorName: John Doe
              authorOrganization: Some organization
              text: Some note
          items:
            $ref: "#/components/schemas/OrderNotes"
        buyer:
          type: string
          description: Reference to BuyerCustomerParty on behalf of which this order is
            placed.
          example: https://ehealth.sundhed.dk/ssl-governance/v1/party/313
        seller:
          type: string
          description: Reference to SellerSupplierParty which is responsible for supplying
            the items required to fulfil this order.
          example: https://ehealth.sundhed.dk/ssl-governance/v1/party/312
        sellerDeliveryContactEmail:
          type: string
          description: Email or a label
          example: viggo@somemail.com
          maxLength: 256
        carePlanRef:
          type: string
          maxLength: 100
          description: Reference to careplan.
          example: https://ehealth.sundhed.dk/careplan/fhir/CarePlan/15241
        carePlanTitle:
          type: string
          description: The title of the careplan. Automatically filled by the system based
            on carePlanRef.
          example: KOL
        earliestDeliveryDate:
          type: string
          format: date
          description: Earliest delivery date of order. Automatically filled by the system
            based on the agreed time of unfulfilled order lines.
          example: 2020-01-01
        latestDeliveryDate:
          type: string
          format: date
          description: Latest delivery date of order. Automatically filled by the system
            based on the agreed time of unfulfilled order lines.
          example: 2020-02-02
        receiver:
          $ref: "#/components/schemas/OrderReceiver"

    OrderReceiver:
      type: object
      description: Contact information of the recipient to whom the items and services in
        this order are to be delivered or picked-up.
      properties:
        name:
          type: string
          maxLength: 100
        addressLine1:
          type: string
          maxLength: 100
        addressLine2:
          type: string
          maxLength: 100
        postalCode:
          type: string
          maxLength: 100
        postalDistrict:
          type: string
          maxLength: 100
        email:
          type: string
          maxLength: 100
        phone:
          type: string
          maxLength: 100
        patient:
          type: string
          maxLength: 100
          description: Reference to the corresponding ehealth-patient in the clinical
            domain. Pattern should be used -
            ^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+\/Patient/\d+$
          example: https://ehealth.sundhed.dk/patient/fhir/Patient/1566241

    OrderDetails:
      type: object
      description: An order details represent all information about order, order lines and
        trace lines related to this order.
      required:
        - order
      properties:
        order:
          $ref: "#/components/schemas/Order"
        orderLines:
          type: array
          description: Order lines information related to this order.
          items:
            $ref: "#/components/schemas/OrderLine"
        traceLines:
          type: array
          description: Trace lines information related to this order.
          items:
            $ref: "#/components/schemas/TraceLine"

    OrderLine:
      type: object
      description: An order represents a request for items and services to be delivered to
        a recipient. The order is placed by a practioner and executed by a
        provider.
      required:
        - order
        - status
        - agreedFrom
        - agreedTo
      properties:
        id:
          type: string
          description: Globally unique ID of this order item. Assigned by server
        order:
          type: string
          description: Reference to order to which this order line belongs
          example: https://ssl-order.ehealth.sundhed.dk/v1/order/21
        status:
          $ref: "#/components/schemas/OrderLineStatus"
        item:
          type: string
          description: Reference to ordered catalog item
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue-item/14
        agreedFrom:
          type: string
          format: date-time
          description: The agreed from is a time agreed between the seller and the receiver
            as the earliest date for next delivery or pickup attempt or shipment
            to be made.
          example: 2020-01-01T00:00:00Z
        agreedTo:
          type: string
          format: date-time
          description: The agreed to is a time agreedbetween the seller and the receiver as
            the latest date for the next delivery or pickup attempt or shipment
            to be made.
          example: 2020-01-01T00:00:00Z
        device:
          type: object
          description: The actual device to be delivered or picked up. Only relevant when
            the fulfilment involves an actual device (opposed to delivery of a
            service).
          properties:
            externalId:
              type: string
              description: External id of the device
            identifiers:
              type: array
              description: Identifiers to connect Device instance to external content
                available in other frameworks or protocols.
              items:
                $ref: "#/components/schemas/Identifier"
            clinicalRef:
              type: string
              description: A reference to the corresponding Device resource in the
                FHIR-based clinical backend.
              example: https://ehealth.sundhed.dk/device/fhir/Device/1566241

    TraceLine:
      type: object
      description: A trace line documents a single atomic business event related to an
        order and optionally a number of order lines.
      required:
        - createdByOrganization
        - text
        - order
      properties:
        id:
          type: string
          description: Globally unique ID of this order item. Assigned by server
        timestamp:
          type: string
          format: date-time
          description: Date and time at which this trace line was created.
          example: 2020-01-01T00:00:00Z
        createdByOrganization:
          type: string
          description: The name of the organization which created or directly caused this
            trace line.
        createdByUser:
          type: string
          description: The name of the user which created or directly caused this trace
            line.
        text:
          type: string
          description: A Danish-language human-readable text lines carrying the a
            description of what triggered this trace line.
        supplementaryText:
          type: string
          description: A supplementary Danish-language human-readable text lines carrying
            the a description of what triggered this trace line.
        order:
          type: string
          description: Reference to Order to which this trace line is related.
          example: https://ssl-order.ehealth.sundhed.dk/v1/order/21
        orderLine:
          type: string
          description: Reference to order line to which this trace line is related.
          example: https://ssl-order.ehealth.sundhed.dk/v1/order-line/21
        statusChange:
          $ref: "#/components/schemas/StatusChange"

    StatusChange:
      type: object
      description: StatusChange represents changes of status for order or order line.
      required:
        - oldStatus
        - newStatus
      properties:
        oldStatus:
          type: string
          maxLength: 32
          description: Status of the resource immediately prior to the event which
            triggered this TraceLine.
        newStatus:
          type: string
          maxLength: 32
          description: Status of the resource immediately after to the event which
            triggered this TraceLine.

    OrganizationReference:
      type: object
      description: OrganizationReference contains a reference to an organization.
      required:
        - organizationReference
      properties:
        organizationReference:
          type: string
          description: Reference to Organization.
          example: https://ehealth.sundhed.dk/organization/fhir/Organization/123

    Coding:
      type: object
      description: Coding system from clinical domain.
      required:
        - system
        - code
      properties:
        system:
          type: string
          maxLength: 100
          format: uri
          description: A URI string referring the Identity of the terminology system
          example: http://ehealth.sundhed.dk/vs/device-measuring-quality
        code:
          type: string
          maxLength: 100
          pattern: "[^\\s]+([\\s]?[^\\s]+)*"
          description: Code value taken from a set of controlled strings defined in the
            system
          example: MEDIUM
        display:
          type: string
          maxLength: 100
          readOnly: true
          description: Human-readable value taken from a set of controlled strings defined
            in the system
          example: Precision < 0.5kg

    Identifier:
      type: object
      description: A numeric or alphanumeric string that is associated with a single object
        or entity within a given system. Typically, identifiers are used to
        connect content in resources to external content available in other
        frameworks or protocols. Identifiers are associated with objects and may
        be changed or retired due to human or system process and errors.
      properties:
        system:
          type: string
          maxLength: 100
          description: The namespace for the identifier value
          example: urn:ietf:rfc:3986
        value:
          type: string
          maxLength: 100
          description: The value that is unique
          pattern: ^(?!\s*$).+
          example: NUC8766
        assigner:
          type: string
          maxLength: 100
          description: Organization that issued id (may be just text)
          example: Danish Health Authorities

    OrderNotes:
      type: object
      description: Notes attached to the order by buyer or seller. These are intended to
        contain remarks or details about the fulfilment of the order
      required:
        - text
      properties:
        timestamp:
          type: string
          format: date-time
        authorName:
          type: string
          maxLength: 100
        authorOrganization:
          type: string
          maxLength: 100
        text:
          type: string
          maxLength: 100

    Error:
      type: object
      description: An business process error reported by the server.
      required:
        - id
        - time
        - message
      properties:
        id:
          type: string
          format: uuid
          description: Unique ID of this error
          example: e1f6678e-512c-11e9-8647-d663bd873d93
        time:
          type: string
          format: date-time
          description: Date and time this error occurred
          example: 2020-01-01T01:00:00Z
        code:
          type: string
          format: string
          description: A protocol defined code allowing the client to understand the error
            and act appropriately
          example: ORD00125
        message:
          type: string
          format: string
          description: An English text describing the error in end-user terms
          example: Some server or client error
        technicalDetails:
          type: string
          format: string
          description: An detailed technical description of an internal, non-business error
          example:

    OrderStatus:
      type: string
      description: Status of the order (DRAFT, SUBMITTED, ASSIGNED, VALIDATED, CONDITIONALLY_ACCEPTED, CONDITIONS_ACCEPTED, DECLINED, ACCEPTED, TIME_OF_FULFILLMENT_AGREED, FULFILLED, REVOKED)
      enum:
        - DRAFT
        - SUBMITTED
        - ASSIGNED
        - VALIDATED
        - CONDITIONALLY_ACCEPTED
        - CONDITIONS_ACCEPTED
        - DECLINED
        - ACCEPTED
        - TIME_OF_FULFILLMENT_AGREED
        - FULFILLED
        - REVOKED

    OrderLineStatus:
      type: string
      description: Status of the orderline (UNFULFILLED, FULFILLED)
      enum:
        - UNFULFILLED
        - FULFILLED

    PatchRequest:
      description: A JSONPatch request
      type: array
      items:
        $ref: "#/components/schemas/PatchDocument"

    PatchDocument:
      description: A JSONPatch document as defined by RFC 6902
      required:
        - op
        - path
      properties:
        op:
          type: string
          description: The operation to be performed
          enum:
            - add
            - remove
            - replace
            - move
            - copy
            - test
        path:
          type: string
          description: A JSON-Pointer
        value:
          type: object
          description: The value to be used within the operations.
        from:
          type: string
          description: A string containing a JSON Pointer value.

Swagger open api macro
displayOperationIdfalse
methodsnone,get,put,post,delete,options,head,patch,trace
validator
url
token
filter
defaultModelRenderingexample
showCommonExtensionsfalse
expandlist
password
filename
operations
maxDisplayedTags
attachfalse
displayRequestDurationfalse
showExtensionsfalse
username
order
openapi: 3.0.0

info:
  title: eHealth SSL Catalogue service
  version: 1.0.0
  description: eHealth SSL Catalogue service
  termsOfService: http://ehealth.sundhed.dk/terms/
  license:
    name: Proprietary
  contact:
    name: Systematic A/S
    url: https://systematic.com/
    email: support.ehealth.servicedesk@systematic.com

externalDocs:
  description: eHealth documentation
  url: http://ehealth-documentation.s3-website-eu-west-1.amazonaws.com/

tags:
  - name: Catalogue
    description: Operations with catalogs
  - name: CatalogueItem
    description: Operations with catalogue items
  - name: Annotation
    description: Operations with annotations
  - name: WhiteList
    description: Operations with white-lists
  - name: BlackList
    description: Operations with black-lists
  - name: Problem
    description: Operations with problems
  - name: Package
    description: Operation with packages
  - name: CatalogueTemplate
    description: Operations with catalogue template
  - name: ExportCatalogue
    description: Operation for downloading a SSL catalogue in an excel template
  - name: ImportCatalogue
    description: Operation for uploading data to the SSL catalogue

security:
  - bearerAuth: []

paths:
  /catalogue:
    post:
      operationId: createCatalogue
      summary: Create a new Catalogue.
      tags:
        - Catalogue
      requestBody:
        $ref: "#/components/requestBodies/Catalogue"
      responses:
        "201":
          description: The Catalogue was successfully created.
          headers:
            Location:
              description: The location of the newly created Catalogue.
              schema:
                type: string
                format: uri
        "400":
          description: The request could not be understood
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    put:
      summary: Update a Catalogue.
      description: id property is required.
      tags:
        - Catalogue
      operationId: updateCatalogue
      requestBody:
        $ref: "#/components/requestBodies/Catalogue"
      responses:
        "204":
          description: The Catalogue was successfully updated.
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/catalogue/{id}":
    get:
      summary: Get a Catalogue
      tags:
        - Catalogue
      operationId: getCatalogue
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the Catalogue to get.
          schema:
            type: string
      responses:
        "200":
          description: The requested Catalogue was found.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Catalogue"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "404":
          description: Catalogue not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  "/catalogue/{id}/details":
    get:
      summary: Get details of catalogue with specific id
      tags:
        - Catalogue
      operationId: getDetails
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the Catalogue details to get.
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: The requested Catalogue details were found.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CatalogueDetails"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "404":
          description: Catalogue not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /catalogues:
    get:
      operationId: listCatalogues
      summary: List all catalogues.
      tags:
        - Catalogue
      parameters:
        - name: seller
          in: query
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Successfully listed all matching Catalogues.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Catalogue"
        "400":
          description: The request could not be understood.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /catalogue-item:
    post:
      operationId: createCatalogueItem
      summary: Create a new CatalogueItem.
      tags:
        - CatalogueItem
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CatalogueItem"
        description: Must be either a 'Service' or 'DeviceModel' object. The value of the
          discriminator 'catalogueItemType' is used to distinguish between
          object types.
        required: true
      responses:
        "201":
          description: The CatalogueItem was successfully created.
          headers:
            Location:
              description: The location of the newly created CatalogueItem.
              schema:
                type: string
                format: uri
        "400":
          description: The request could not be understood
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    put:
      summary: Update a CatalogueItem.
      description: id property is required.
      tags:
        - CatalogueItem
      operationId: updateCatalogueItem
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CatalogueItem"
        required: true
      responses:
        "204":
          description: The CatalogueItem was successfully updated.
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The CatalogueItem not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/catalogue-item/{id}":
    get:
      summary: Get a CatalogueItem
      tags:
        - CatalogueItem
      operationId: getCatalogueItem
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the CatalogueItem to get.
          schema:
            type: string
      responses:
        "200":
          description: The requested CatalogueItem was found.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CatalogueItem"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "404":
          description: CatalogueItem not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /catalogue-items:
    get:
      operationId: listCatalogueItems
      summary: List CatalogueItems.
      description:
        This operation can be used to search for CatalogueItems available to a
        buyer given different criteria.

        At least one of the `catalogue`, `annotation` or `package` parameters must supplied.

        It is not possible to combine the `package` parameter with the `catalogue` or `annotation` parameters
      tags:
        - CatalogueItem
      parameters:
        - name: buyer
          in: query
          required: true
          description: Filter out CatalogueItems not available to this buyer. E.g.
            https://ssl-order.ehealth.sundhed.dk/v1/party/fd884111-ad48-4c62-83f0-5f447ec43a64
          schema:
            type: string
        - name: catalogue
          in: query
          description: Filter out CatalogueItems not part of the given Catalogue. E.g.
            https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue/94a67a8d-447e-4f11-a002-81779e326450
          schema:
            type: string
        - in: query
          name: package
          required: false
          description: Filter out CatalogueItems not part of the given Package. E.g.
            https://ssl-catalogue.ehealth.sundhed.dk/v1/package/2311ef62-8b91-4e7a-b936-7456c54e1af7
          schema:
            type: string
        - in: query
          name: annotation
          required: false
          description: Filter out CatalogueItems not having all of the given Annotations.
            E.g.
            eHealth/device-metric-measuring-quality-initial\:http\://ehealth.sundhed.dk/cs/device-measuring-quality/low-precision
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: patient
          in: query
          description: Filter out CatalogueItems that is black-listed for the given
            Patient. E.g.
            https://patient.ehealth.sundhed.dk/fhir/Patient/1566241
          schema:
            type: string
      responses:
        "200":
          description: Successfully listed all matching CatalogueItems.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CatalogueItem"
        "400":
          description: The request could not be understood.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /annotation:
    post:
      operationId: createAnnotation
      summary: Create a new Annotation.
      tags:
        - Annotation
      requestBody:
        $ref: "#/components/requestBodies/Annotation"
      responses:
        "201":
          description: The Annotation was successfully created.
          headers:
            Location:
              description: The location of the newly created Annotation.
              schema:
                type: string
                format: uri
        "400":
          description: The request could not be understood
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    put:
      operationId: updateAnnotation
      summary: Update an Annotation.
      description: id property is required.
      tags:
        - Annotation
      requestBody:
        $ref: "#/components/requestBodies/Annotation"
      responses:
        "204":
          description: The Annotation was successfully updated.
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/annotation/{id}":
    delete:
      operationId: deleteAnnotation
      summary: Delete an Annotation
      description: Only draft Annotations can be deleted.
      tags:
        - Annotation
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the Annotation to delete
          schema:
            type: string
      responses:
        "204":
          description: The Annotation was successfully deleted.
        "400":
          description: The request could not be understood.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  /annotations:
    get:
      operationId: listAnnotations
      summary: List Annotations.
      tags:
        - Annotation
      parameters:
        - name: buyer
          required: true
          in: query
          description: List Annotations related to this buyer
          schema:
            type: string
        - name: catalogue
          in: query
          required: false
          description: List Annotations related to this Catalogue
          schema:
            type: string
        - name: catalogueItem
          in: query
          required: false
          description: List Annotations related to this CatalogueItem
          schema:
            type: string
      responses:
        "200":
          description: Successfully listed all matching Annotations.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Annotation"
        "400":
          description: The request could not be understood.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /white-list:
    post:
      tags:
        - WhiteList
      summary: Create new white-list
      description: Create new white-list
      operationId: createWhiteList
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WhiteList"
        description: The white-list which should be created.
        required: true
      responses:
        "201":
          description: The white-list was successfully created
          headers:
            location:
              description: The location of the newly created white-list.
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    get:
      tags:
        - WhiteList
      summary: Search white-lists by parameters
      description: Search white-list by parameters
      operationId: getWhiteLists
      parameters:
        - name: buyer
          in: query
          description: Multiple buyer refernce values can be provided
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: List of white-lists was successfully returned
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/WhiteList"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  "/white-list/{id}":
    get:
      tags:
        - WhiteList
      summary: Return white-list by id
      description: Return white-list by id
      operationId: getWhiteListById
      parameters:
        - name: id
          in: path
          description: Id of white-list
          required: true
          schema:
            type: string
      responses:
        "200":
          description: The white-list was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WhiteList"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "404":
          description: The black-list not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

    delete:
      operationId: deleteWhiteList
      summary: Delete white-list
      tags:
        - WhiteList
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the white-list to delete
          schema:
            type: string
      responses:
        "204":
          description: The white-list was successfully deleted.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  /black-list:
    post:
      tags:
        - BlackList
      summary: Create new black-list
      description: Create new black-list
      operationId: createBlackList
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BlackList"
        description: black-list which should be created.
        required: true
      responses:
        "201":
          description: The black-list was successfully created
          headers:
            location:
              description: The location of the newly created black-list.
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    get:
      tags:
        - BlackList
      summary: Search black-lists by parameters
      description: Search black-list by parameters
      operationId: getBlackLists
      parameters:
        - name: patient
          in: query
          description: Multiple patient in clinical domain reference values can be provided
          explode: true
          schema:
            type: array
            items:
              type: string
              pattern: ^(?!\s*$).+
      responses:
        "200":
          description: List of black-lists was successfully returned
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/BlackList"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  "/black-list/{id}":
    get:
      tags:
        - BlackList
      summary: Return black-list by id
      description: Return black-list by id
      operationId: getBlackListById
      parameters:
        - name: id
          in: path
          description: Id of black-list
          required: true
          schema:
            type: string
      responses:
        "200":
          description: The black-list was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BlackList"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "404":
          description: The black-list not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

    delete:
      operationId: deleteBlackList
      summary: Delete black-list
      tags:
        - BlackList
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the black-list to delete
          schema:
            type: string
      responses:
        "204":
          description: The black-list was successfully deleted.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  /problem:
    post:
      tags:
        - Problem
      summary: Create new problem
      description: Create new problem
      operationId: createProblem
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Problem"
        description: The problem which should be created.
        required: true
      responses:
        "201":
          description: The problem was successfully created
          headers:
            location:
              description: The location of the newly created problem.
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/problem/{id}":
    parameters:
      - name: id
        in: path
        description: The problem id
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - Problem
      summary: Get problem by id
      description: Get problem by id
      operationId: findProblemById
      responses:
        "200":
          description: The problem was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The problem was not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

    patch:
      tags:
        - Problem
      summary: Patch selected fields of the given problem
      description: Patch selected fields of the given problem
      operationId: patchProblem
      requestBody:
        $ref: "#/components/requestBodies/PatchRequest"
      responses:
        "204":
          description: The problem was successfully updated.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The problem was not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    delete:
      tags:
        - Problem
      summary: Delete problem by id
      description: Delete problem by id
      operationId: deleteProblemById
      responses:
        "204":
          description: The problem was successfully deleted.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/problem/{id}/details":
    parameters:
      - name: id
        in: path
        description: The problem id
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - Problem
      summary: Get problem details by id
      description: Get problem details by id
      operationId: findProblemDetailsById
      responses:
        "200":
          description: The problem was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The problem was not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /problems:
    get:
      tags:
        - Problem
      summary: Get all problems accessible for the current user context
      description: Get all problems accessible for the current user context
      operationId: getProblems
      responses:
        "200":
          description: List of problems was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Problems"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /package:
    post:
      tags:
        - Package
      summary: Create new package
      description: Create new package
      operationId: createPackage
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Package"
        description: The package which should be created.
        required: true
      responses:
        "201":
          description: The package was successfully created
          headers:
            location:
              description: The location of the newly created package.
              schema:
                type: string
                format: uri
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/package/{id}":
    parameters:
      - name: id
        in: path
        description: The package id
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - Package
      summary: Get package by id
      description: Get package by id
      operationId: getPackageById
      responses:
        "200":
          description: The package was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Package"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "404":
          description: The package was not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

    patch:
      tags:
        - Package
      summary: Patch selected fields of the given package
      description: Patch selected fields of the given package
      operationId: patchPackage
      requestBody:
        $ref: "#/components/requestBodies/PatchRequest"
      responses:
        "204":
          description: The package was successfully updated.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The package was not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

    delete:
      tags:
        - Package
      summary: Delete package by id
      description: Delete package by id
      operationId: deletePackageById
      responses:
        "204":
          description: The package was successfully deleted.
        "400":
          description: Invalid input
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/package/{id}/details":
    parameters:
      - name: id
        in: path
        description: The package id
        required: true
        schema:
          type: string
          format: uuid

    get:
      tags:
        - Package
      summary: Get package details by id
      description: Get package details by id
      operationId: getPackageDetailsById
      responses:
        "200":
          description: The package was successfully returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PackageDetails"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
#        TODO: OLL 2022-01-27 Kode fejler med denne
#        "403":
#          description: Illegal state changes are attempted.
#          content:
#            "*/*":
#              schema:
#                $ref: "#/components/schemas/Error"
        "404":
          description: The package was not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /packages:
    get:
      tags:
        - Package
      summary: Get all packages accessible for the current user context
      description: Get all packages accessible for the current user context
      operationId: getPackages
      parameters:
        - name: status
          in: query
          description: List only packages with this Status
          required: false
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - DRAFT
                - ACTIVE
                - INVALID
      responses:
        "200":
          description: List of packages was successfully returned
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Package"
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  /catalogue/template:
    get:
      operationId: getTemplate
      summary: Download Catalogue excel workbook template.
      tags:
        - CatalogueTemplate
      responses:
        "200":
          description: OK
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        "400":
          description: The request could not be understood
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: "#/components/schemas/Error"

  "/catalogue/{id}/export":
    get:
      operationId: exportCatalogue
      summary: Download existing Catalogue in an excel workbook.
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the Catalogue to export.
          schema:
            type: string
      tags:
        - ExportCatalogue
      responses:
        "200":
          description: OK
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        "400":
          description: The request could not be understood
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: Catalogue not found
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: "#/components/schemas/Error"

  /catalogue/import:
    post:
      operationId: importCatalogue
      summary: Upload an excel workbook with catalogue items, annotations etc.
      tags:
        - ImportCatalogue
      parameters:
        - name: asynchronous
          in: query
          required: false
          schema:
            type: boolean
            default: false
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  description: An excel workbook with all the catalogue and annotation
                    items to upload in a catalogue. If no catalogue exists with
                    a matching identifier, a new catalogue will be created, and
                    all catalogue items and annotations will be added. If a
                    catalogue exists with a matching identifier, the catalogue
                    and details will be updated. To see the format of the excel,
                    please download a template and se the description of it
                    here.
                  type: string
                  format: binary
              required:
                - file
      responses:
        "201":
          description: Excel workbook file was successfully uploaded and entities were
            successfully imported.
          headers:
            Location:
              description: The location of the newly created or updated catalogue.
              schema:
                type: string
                format: uri
        "202":
          description: Excel workbook file was successfully uploaded and import entities
            was accepted.
          headers:
            Location:
              description: The location of the import.
              schema:
                type: string
                format: uri
        "400":
          description: The request could not be understood
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: The server encountered an unexpected condition which prevented it
            from fulfilling the request.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"

  "/catalogue-import/{id}":
    get:
      operationId: getCatalogueImport
      summary: Get status of catalogue import
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the Catalogue import to get.
          schema:
            type: string
      tags:
        - ImportCatalogue
      responses:
        "200":
          description: The requested Catalogue import was found.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CatalogueImport"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: Illegal state changes are attempted.
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: Catalogue import not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

servers:
  - url: http://ssl-catalogue.{environment}.ehealth.sundhed.dk/v1
    variables:
      environment:
        default: unknown
  - url: https://ssl-catalogue.{environment}.ehealth.sundhed.dk/v1
    variables:
      environment:
        default: unknown

components:
  requestBodies:
    Catalogue:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Catalogue"
      required: true

    PatchRequest:
      content:
        application/json-patch+json:
          schema:
            $ref: "#/components/schemas/PatchRequest"
      description: The JSON patch object
      required: true

    Annotation:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Annotation"
      required: true

  securitySchemes:
    bearerAuth:
      description: Bearer authorization (JWT) token, e.g. `Bearer <token>`
      type: http
      scheme: bearer
      bearerFormat: JWT  # optional, for documentation purposes only

  schemas:
    Catalogue:
      type: object
      properties:
        id:
          type: string
          description: Unique ID of this catalogue.
          readOnly: true
          example: 432542
        identifiers:
          type: array
          items:
            $ref: "#/components/schemas/Identifier"
          description: Identifiers to connect Catalogue to external content available in
            other frameworks or protocols. It is mandatory to include an
            identifier with system='http://ehealth.sundhed.dk/ssl/catalogue/catalogue-identifier'
            that will define the sellers id.
        seller:
          type: string
          maxLength: 100
          description: Reference to SellerSupplierParty who offers the items in this catalogue.
          example: https://ssl-order.ehealth.sundhed.dk/v1/party/312
        name:
          type: string
          maxLength: 100
          pattern: ^(?!\s*$).+
          description: A human readable short headline describing this catalogue.
          example: Year 2020 catalogue
        status:
          $ref: "#/components/schemas/CatalogueStatus"
      required:
        - name
        - status

    CatalogueDetails:
      type: object
      properties:
        catalogue:
          $ref: "#/components/schemas/Catalogue"
        catalogueItems:
          type: array
          items:
            $ref: "#/components/schemas/CatalogueItem"

    CatalogueItem:
      type: object
      discriminator:
        propertyName: catalogueItemType
      properties:
        id:
          type: string
          description: Unique ID of this catalogue item.
          readOnly: true
          example: 423341
        catalogueItemType:
          type: string
          maxLength: 20
          description: Type discriminator. Legal values are 'DeviceModel' and 'Service'.
          example: DeviceModel
        identifiers:
          type: array
          items:
            $ref: "#/components/schemas/Identifier"
          description: Identifiers to connect CatalogueItem to external content available
            in other frameworks or protocols. It is mandatory to include an
            identifier with system='http://ehealth.sundhed.dk/ssl/catalogue/catalogue-item-identifier'
            that will define the sellers id.
        relatedTo:
          type: string
          description: Reference to related catalog item.
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue-item/11
        catalogue:
          type: string
          description: Reference to catalog, this item belongs to.
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue/213
        name:
          type: string
          maxLength: 100
          pattern: ^(?!\s*$).+
          description: A human readable short headline describing this catalogue item.
          example: StarTron SuperSpiro VI
        description:
          type: string
          maxLength: 255
          description: A human readable detailed of this catalogue item (markdown format supported).
          example: Multipurpose spirometer for wheel chair mounting. Battery supply only. No powerbrick.
        status:
          $ref: "#/components/schemas/CatalogueItemStatus"
        supersededBy:
          type: string
          description: Reference to another catalogue item which supersedes this one.
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue-item/99822
      required:
        - catalogue
        - catalogueItemType
        - name
        - status

    DeviceModel:
      allOf:
        - $ref: "#/components/schemas/CatalogueItem"
        - type: object
          properties:
            manufacturer:
              type: string
              maxLength: 255
              description: Name of the device manufacturer.
              example: Startron
            model:
              type: string
              maxLength: 255
              description: The 'model' is an identifier assigned by the manufacturer to identify the product by its type.
              example: SuperSpiro VI
            version:
              type: string
              maxLength: 255
              description: The version of the device, if the device has multiple releases under the same model.
              example: 2019.02

    Service:
      allOf:
        - $ref: "#/components/schemas/CatalogueItem"
        - type: object
          properties:
            serviceType:
              $ref: "#/components/schemas/Coding"

    Annotation:
      type: object
      properties:
        id:
          type: string
          description: Unique ID of this annotation.
          readOnly: true
          example: "42352"
        catalogueItem:
          type: string
          description: Reference to Catalogue item which is annotated by this resource.
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue-item/4342
        buyer:
          type: string
          description: Reference to BuyerCustomerParty for whom this annotation is relevant.
          example: https://ssl-order.ehealth.sundhed.dk/v1/party/313
        name:
          type: string
          maxLength: 100
          description: Descriptive name of the annotation, must apply to the format of '[A-Za-z0-9\\-\\_/]+'
          example: eHealth/device-type
        status:
          $ref: "#/components/schemas/AnnotationStatus"
        value:
          $ref: "#/components/schemas/Coding"
      required:
        - catalogueItem
        - coding
        - name

    WhiteList:
      type: object
      required:
        - buyer
      properties:
        id:
          type: string
          description: Unique ID of this white-list. Assigned by server
          example: 2
        buyer:
          type: string
          example: http://ssl-order.ehealth.sundhed.dk/v1/party/456
          description: A reference to the party/organization for which this white-list is
            relevant. Pattern should be used
            ^((http[s]?):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$
        item:
          type: string
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue-item/94a67a8d-447e-4f11-a002-81779e326450
          description: Reference to catalogue item which are available to buyer for
            ordering.

    BlackList:
      type: object
      required:
        - patient
      properties:
        id:
          type: string
          description: Unique ID of this black-list. Assigned by server
          example: 3
        patient:
          type: string
          description: Reference to the corresponding ehealth-patient in the clinical
            domain. Pattern should be used
            ^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+\/Patient/\d+$
          example: https://ehealth.sundhed.dk/patient/fhir/Patient/1566241
        item:
          type: string
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue-item/94a67a8d-447e-4f11-a002-81779e326450
          description: Reference to catalog item which were put in black-list by patient

    Problem:
      type: object
      description: A problem is defined by the description, has a known resolution and
        references to the affected catalogue items
      required:
        - description
        - resolution
        - catalogueItemRefs
      properties:
        id:
          type: string
          format: uuid
          description: Unique ID of this problem. Assigned by server
          example: 94a67a8d-447e-4f11-a002-81779e326450
          readOnly: true
        timestamp:
          type: string
          format: date-time
          description: Date and time when the problem was created. Assigned by server
          example: 2020-01-01T01:00:00Z
        description:
          type: string
          description: Description of the problem
          example: Device resets when pressing 'Start' button
        resolution:
          type: string
          description: Resolution of the problem
          example: Turn the device off and on again
        catalogueItemRefs:
          type: array
          description: References to the affected catalogue items
          minItems: 1
          items:
            type: string
            example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue-item/94a67a8d-447e-4f11-a002-81779e326450

    ProblemDetails:
      type: object
      description: Problem and the related catalogue items
      properties:
        problem:
          $ref: "#/components/schemas/Problem"
        catalogueItems:
          type: array
          items:
            $ref: "#/components/schemas/CatalogueItem"

    Problems:
      type: object
      description: Lists of problems and their related catalogue items
      properties:
        problems:
          type: array
          items:
            $ref: "#/components/schemas/Problem"
        catalogueItems:
          type: array
          items:
            $ref: "#/components/schemas/CatalogueItem"

    Package:
      type: object
      description: A package is defined by the name, has a status and references to the
        selected white-lists
      required:
        - name
        - status
        - buyerRef
      properties:
        id:
          type: string
          format: uuid
          description: Unique ID of this package. Assigned by server
          example: 94a67a8d-447e-4f11-a002-81779e326450
          readOnly: true
        name:
          type: string
          description: Name of the package
          example: Set of COPD monitoring equipment
          maxLength: 100
        status:
          $ref: "#/components/schemas/PackageStatus"
        buyerRef:
          type: string
          description: Reference to the buyer party owning the package
          example: https://ssl-order.ehealth.sundhed.dk/v1/party/313
        packageWhiteListRefs:
          type: array
          description: References to the selected white-lists
          items:
            $ref: "#/components/schemas/PackageWhiteListRef"

    PackageWhiteListRef:
      type: object
      description: A reference to a white-list
      required:
        - whiteListRef
        - defaultIncluded
      properties:
        whiteListRef:
          type: string
          description: A reference to a white-list
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/white-list/94a67a8d-447e-4f11-a002-81779e326450
        defaultIncluded:
          type: boolean
          description: A flag indicating if the item should be included by default upon
            creation of a new order
          example: true

    PackageDetails:
      type: object
      description: Package and the related white-list and catalogue items
      properties:
        package:
          $ref: "#/components/schemas/Package"
        whiteLists:
          type: array
          items:
            $ref: "#/components/schemas/WhiteList"
        catalogueItems:
          type: array
          items:
            $ref: "#/components/schemas/CatalogueItem"

    PackageStatus:
      type: string
      description: Status of the package (DRAFT, ACTIVE, INVALID)
      enum:
        - DRAFT
        - ACTIVE
        - INVALID

    CatalogueStatus:
      type: string
      description: Status of the catalogue (DRAFT, ACTIVE, RETIRED)
      enum:
        - DRAFT
        - ACTIVE
        - RETIRED

    CatalogueItemStatus:
      type: string
      description: Status of the catalogue item (AVAILABLE, UNAVAILABLE, RETIRED)
      enum:
        - AVAILABLE
        - UNAVAILABLE
        - RETIRED

    AnnotationStatus:
      type: string
      description: Status of the annotation (DRAFT, ACTIVE, RETIRED)
      enum:
        - DRAFT
        - ACTIVE
        - RETIRED

    Coding:
      type: object
      description: Coding system from clinical domain.
      required:
        - system
        - code
      properties:
        system:
          type: string
          maxLength: 100
          format: uri
          description: A URI string referring the Identity of the terminology system
          example: http://ehealth.sundhed.dk/vs/device-measuring-quality
        code:
          type: string
          maxLength: 100
          pattern: "[^\\s]+([\\s]?[^\\s]+)*"
          description: Code value taken from a set of controlled strings defined in the
            system
          example: MEDIUM
        display:
          type: string
          maxLength: 100
          readOnly: true
          description: Human-readable value taken from a set of controlled strings defined
            in the system
          example: Precision < 0.5kg

    Identifier:
      type: object
      description: A numeric or alphanumeric string that is associated with a single object
        or entity within a given system. Typically, identifiers are used to
        connect content in resources to external content available in other
        frameworks or protocols. Identifiers are associated with objects and may
        be changed or retired due to human or system process and errors.
      properties:
        system:
          type: string
          maxLength: 100
          description: The namespace for the identifier value
          example: urn:ietf:rfc:3986
        value:
          type: string
          maxLength: 100
          description: The value that is unique
          pattern: ^(?!\s*$).+
          example: NUC8766
        assigner:
          type: string
          maxLength: 100
          description: Organization that issued id (may be just text)
          example: Danish Health Authorities

    Error:
      type: object
      description: An business process error reported by the server.
      required:
        - id
        - time
        - message
      properties:
        id:
          type: string
          format: uuid
          description: Unique ID of this error.
          example: 4cf5bf7f-bf42-48dd-81bf-02b05aaf0858
        time:
          type: string
          format: date-time
          description: Date and time this error occurred.
          example: 2020-01-01T01:00:00Z
        code:
          type: string
          format: string
          description: A protocol defined code allowing the client to understand the error
            and act appropriately
          example: ORD00125
        message:
          type: string
          format: string
          description: An English text describing the error in end-user terms.
          example: Some server or client error
        parameters:
          type: array
          items:
            type: string
          description: Error parameters for substituting placeholders in error message.
          example:
            - abc 123
            - DeviceModel, Service
        technicalDetails:
          type: string
          format: string
          description: An detailed technical description of an internal, non-business error
          example:

    PatchRequest:
      description: A JSONPatch request
      type: array
      items:
        $ref: "#/components/schemas/PatchDocument"

    PatchDocument:
      description: A JSONPatch document as defined by RFC 6902
      required:
        - op
        - path
      properties:
        op:
          type: string
          description: The operation to be performed
          enum:
            - add
            - remove
            - replace
            - move
            - copy
            - test
        path:
          type: string
          description: A JSON-Pointer
        value:
          type: object
          description: The value to be used within the operations.
        from:
          type: string
          description: A string containing a JSON Pointer value.

    Excelfile:
      type: object
      description: excel file with defined values for catalogue items, annotations, etc.
      properties:
        fileName:
          type: string
          format: binary

    CatalogueImportStatus:
      type: string
      description: Status of the catalogue import (STARTED, SUCCEEDED, FAILED)
      enum:
        - STARTED
        - SUCCEEDED
        - FAILED

    CatalogueImport:
      type: object
      properties:
        id:
          type: string
          description: Unique ID of this import.
          readOnly: true
          example: 4cf5bf7f-bf42-48dd-81bf-02b05aaf0858
        starttime:
          type: string
          format: date-time
          description: Creation date and time
          example: 2021-01-30T08:30:00Z
        status:
          $ref: "#/components/schemas/CatalogueImportStatus"
        catalogue:
          type: string
          maxLength: 255
          description: Reference to Catalogue resulting from import.
          example: https://ssl-catalogue.ehealth.sundhed.dk/v1/catalogue/313
        message:
          $ref: "#/components/schemas/Error"
      required:
        - status