swagger: '2.0'

info:
  title: eHealth SSL Catalogue Excel service
  version: 1.0.0
  termsOfService: http://ehealth.sundhed.dk/terms/
  license:
    name: Proprietary

host: ssl-catalogue-excel.ehealth.sundhed.dk
basePath: /v1

tags:
  - name: CatalogueTemplate
    description: Operations with catalogue template
  - name: ExcelUpload
    description: Operation for uploading data to the SSL catalogue

schemes:
  - http
  - https

paths:
  /catalogue:
    get:
      operationId: getCatalogue
      summary: Create and allow to download new Catalogue excel template.
      tags:
        - Catalogue
      produces:
        - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
      responses:
        200:
          description: OK
          schema:
            type: file
            format: binary
        400:
          description: The request could not be understood
          schema:
            $ref: '#/definitions/Error'
        500:
          description: The server encountered an unexpected condition which prevented it from fulfilling the request.
          schema:
            $ref: '#/definitions/Error'
        default:
          description: 'Unexpected error'
          schema:
            $ref: '#/definitions/Error'
    post:
      operationId: postCatalogue
      summary: Upload an excel with determided catalogue items, annotations etc.
      tags:
        - Catalogue
      consumes:
        - multipart/form-data  # and/or application/x-www-form-urlencoded
      parameters:
        - name: file
          in: formData
          description: An Excel spreadsheet with all the catalogue and annotation items to upload in a catalogue. A catalogue will be created, and all catalogue and annotations will be added. To see the format of the excel, please download a template and se the description of it here.
          required: true
          type: file
      responses:
        201:
          description: Excel file was successfully uploaded and entities were successfully created.
          headers:
            Location:
              type: string
              format: uri
              description: The location of the newly created Annotation.
        400:
          description: The request could not be understood
          schema:
            $ref: '#/definitions/Error'
        500:
          description: The server encountered an unexpected condition which prevented it from fulfilling the request.
          schema:
            $ref: '#/definitions/Error'
        default:
          description: 'Unexpected error'
          schema:
            $ref: '#/definitions/Error'

definitions:
  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
      technicalDetails:
        type: string
        format: string
        description: An detailed technical description of an internal, non-business error
        example: <A stack trace>

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