openapi: 3.0.1
info:
  title: Remote Management backend
  version: 0.3.0
servers:
  - url: /
    description: Local server
  - url: >-
      https://ca-rm-infra-backend-dev-euw.gentlesmoke-7f7761b4.westeurope.azurecontainerapps.io
    description: Azure server
tags:
  - name: Locations
    description: Locations is a service that makes it easy to manage your locations
  - name: Device Actions
    description: Device Actions API
  - name: Devices
    description: Devices is a service that makes it easy to manage your devices
  - name: Device Categories
    description: Device Categories API
  - name: Users
    description: Users is a service that makes it easy to manage your users
  - name: Device Templates
    description: Device Templates API
  - name: Organizations
    description: Organizations is a service that makes it easy to manage your organizations
  - name: Rma
    description: Rma API
paths:
  /api/{organizationId}:
    get:
      tags:
        - Organizations
      operationId: getOrganization
      parameters:
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: getOrganization 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationResponse'
      security:
        - bearerAuth: []
  /api/{organizationId}/actions:
    get:
      tags:
        - Device Actions
      summary: Get device Actions
      description: Get device Actions for an organization
      operationId: getDeviceActions
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: page
          in: query
          description: The page number
          schema: {}
          example: '0'
        - name: size
          in: query
          description: The page size
          schema: {}
          example: '10'
        - name: sort
          in: query
          description: The field and sort order
          schema: {}
          example: createdAt,desc
        - name: locationId
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: string
              format: uuid
        - name: id
          in: query
          schema:
            type: string
            format: uuid
            nullable: true
        - name: displayName
          in: query
          schema:
            type: string
            nullable: true
      responses:
        '200':
          description: Device Actions for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_ActionResponse_'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    post:
      tags:
        - Device Actions
      summary: Create device Action
      description: Create a device Action for an organization
      operationId: createDeviceAction
      parameters:
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionRequest'
        required: true
      responses:
        '200':
          description: Action created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/actions/{actionId}:
    get:
      tags:
        - Device Actions
      summary: Get device Action
      description: Get a device Action for an organization
      operationId: getDeviceAction
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: actionId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Device Action for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Action not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/actions/{actionId}/details:
    get:
      tags:
        - Device Actions
      summary: Get device Action details
      description: Get a device Action details for an organization
      operationId: getDeviceActionDetails
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: actionId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Device Action details for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Action not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/deviceCategories:
    get:
      tags:
        - Device Categories
      summary: Get device Categories
      description: Get device Categories for an organization
      operationId: getDeviceCategories
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      responses:
        '200':
          description: Device Categories for the organization
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeviceCategoryResponse'
        '401':
          description: Unauthorized
        '404':
          description: Organization not found
      security:
        - bearerAuth: []
  /api/{organizationId}/deviceCategories/visibility-widget:
    get:
      tags:
        - Device Categories
      summary: Get total and online devices by category
      description: Get total and online devices by category for an organization
      operationId: getTotalAndOnlineDevicesByCategory
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      responses:
        '200':
          description: Total and online devices by category for the organization
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CategoryDeviceCount'
        '401':
          description: Unauthorized
        '404':
          description: Organization not found
      security:
        - bearerAuth: []
  /api/{organizationId}/deviceCategories/{categoryId}:
    get:
      tags:
        - Device Categories
      summary: Get device category
      description: Get a device category for an organization
      operationId: getDevicecategory
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: categoryId
          in: path
          description: The category identifier
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: Device category for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceCategoryResponse'
        '401':
          description: Unauthorized
        '404':
          description: Device category not found
      security:
        - bearerAuth: []
  /api/{organizationId}/deviceTemplates:
    get:
      tags:
        - Device Templates
      summary: Get device Templates
      description: Get device Templates for an organization
      operationId: getDeviceTemplates
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      responses:
        '200':
          description: Device Templates for the organization
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeviceTemplateResponse'
        '401':
          description: Unauthorized
        '404':
          description: Organization not found
      security:
        - bearerAuth: []
  /api/{organizationId}/deviceTemplates/{templateId}:
    get:
      tags:
        - Device Templates
      summary: Get device template
      description: Get a device template for an organization
      operationId: getDeviceTemplate
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: templateId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: Device template for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceTemplateResponse'
        '401':
          description: Unauthorized
        '404':
          description: Device template not found
      security:
        - bearerAuth: []
  /api/{organizationId}/devices:
    get:
      tags:
        - Devices
      summary: Get devices
      description: This API allow you to retrieve all the devices you are allowed to see.
      operationId: getDevices
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: page
          in: query
          description: The page number
          schema: {}
          example: '0'
        - name: size
          in: query
          description: The page size
          schema: {}
          example: '10'
        - name: sort
          in: query
          description: The field and sort order
          schema: {}
          example: createdAt,desc
        - name: id
          in: query
          schema:
            type: string
            nullable: true
        - name: name
          in: query
          schema:
            type: string
            nullable: true
        - name: locationId
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: string
              format: uuid
        - name: deviceType
          in: query
          schema:
            nullable: true
            allOf:
              - $ref: '#/components/schemas/DeviceType'
        - name: deviceCategoryId
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: integer
              format: int64
        - name: connection
          in: query
          schema:
            type: boolean
            nullable: true
        - name: status
          in: query
          schema:
            type: array
            nullable: true
            items:
              $ref: '#/components/schemas/DeviceStatus'
        - name: parentIds
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: string
        - name: parentName
          in: query
          schema:
            type: string
            nullable: true
      responses:
        '200':
          description: The devices have been retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_DeviceResponse_'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the devices.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    put:
      tags:
        - Devices
      summary: Update device
      description: This API can be used to add one device.
      operationId: updateDevice
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceUpdateRequest'
        required: true
      responses:
        '200':
          description: The device has been added successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceResponse'
        '400':
          description: >-
            The user needs to provide a device id. If the device already exists,
            the user needs to provide a valid location id and a valid template
            id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to add the device.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    post:
      tags:
        - Devices
      summary: Add device
      description: This API can be used to update one device.
      operationId: addDevice
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceAddRequest'
        required: true
      responses:
        '200':
          description: The device has been updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceResponse'
        '400':
          description: >-
            The user needs to provide a device id. If the device does not exist,
            the user needs to provide a valid location id and a valid template
            id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to update the device.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    delete:
      tags:
        - Devices
      summary: Delete devices
      description: This API allow you to delete devices if you have the permission.
      operationId: deleteDevices
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DevicesDeleteRequest'
        required: true
      responses:
        '200':
          description: deleteDevices 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevicesDeleteResponse'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}:
    get:
      tags:
        - Devices
      summary: Get device
      description: This API allow you to retrieve a devices you are allowed to see.
      operationId: getDevice
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The device has been retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceResponse'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the device.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The device does not exist in the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    delete:
      tags:
        - Devices
      summary: Delete device
      description: This API allow you to delete one device if you have the permission.
      operationId: deleteDevice
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: deleteDevice 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unit'
        '204':
          description: The device has been deleted successfully.
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to delete the device.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The device does not exist in the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}/children:
    get:
      tags:
        - Devices
      summary: Get device's children
      description: >-
        This API allow you to retrieve all the device's children you are allowed
        to see.
      operationId: getDeviceChildren
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: page
          in: query
          description: The page number
          schema: {}
          example: '0'
        - name: size
          in: query
          description: The page size
          schema: {}
          example: '10'
        - name: sort
          in: query
          description: The field and sort order
          schema: {}
          example: createdAt,desc
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
        - name: id
          in: query
          schema:
            type: string
            nullable: true
        - name: name
          in: query
          schema:
            type: string
            nullable: true
        - name: locationId
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: string
              format: uuid
        - name: deviceType
          in: query
          schema:
            nullable: true
            allOf:
              - $ref: '#/components/schemas/DeviceType'
        - name: deviceCategoryId
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: integer
              format: int64
        - name: connection
          in: query
          schema:
            type: boolean
            nullable: true
        - name: status
          in: query
          schema:
            type: array
            nullable: true
            items:
              $ref: '#/components/schemas/DeviceStatus'
      responses:
        '200':
          description: The devices have been retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_DeviceResponse_'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the devices.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}/commands:
    get:
      tags:
        - Devices
      summary: Get commands
      description: This API allow you to retrieve all the commands you are allowed to see.
      operationId: getCommands
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: page
          in: query
          description: The page number
          schema: {}
          example: '0'
        - name: size
          in: query
          description: The page size
          schema: {}
          example: '10'
        - name: sort
          in: query
          description: The field and sort order
          schema: {}
          example: createdAt,desc
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
        - name: status
          in: query
          schema:
            nullable: true
            allOf:
              - $ref: '#/components/schemas/CommandStatus'
        - name: commandName
          in: query
          schema:
            type: string
            nullable: true
      responses:
        '200':
          description: The commands have been retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_CommandResponse_'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the commands.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}/commands/{commandId}:
    get:
      tags:
        - Devices
      summary: Get command
      description: This API allow you to retrieve one command you are allowed to see.
      operationId: getCommand
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
        - name: commandId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The command has been retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the command.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The command does not exist in the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}/commands/{commandName}:
    post:
      tags:
        - Devices
      summary: Execute command
      description: >-
        This API allow you to execute one command on one device (some fields can
        be null).
      operationId: executeCommands
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
        - name: commandName
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandRequestPayload'
        required: true
      responses:
        '200':
          description: The command has been executed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to execute the command.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}/credentials:
    get:
      tags:
        - Devices
      summary: Credentials
      description: This API allows you to get all the credentials of a device.
      operationId: getDeviceCredentials
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The credentials have been retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceCredentials'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The device does not exist in the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}/properties:
    get:
      tags:
        - Devices
      summary: Properties
      description: This API allows you to get all the properties of a device.
      operationId: getDeviceProperties
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The properties have been retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the properties.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The device does not exist in the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/devices/{deviceId}/telemetries:
    get:
      tags:
        - Devices
      summary: Telemetry names
      description: This API allows you to get all the telemetry names of a device.
      operationId: getDeviceTelemetry
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The telemetry names have been retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to see the telemetry names.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The device does not exist in the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/locations:
    get:
      tags:
        - Locations
      summary: Get all locations
      description: This API can be used to get all locations that you can view.
      operationId: getLocations
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: page
          in: query
          description: The page number
          schema: {}
          example: '0'
        - name: size
          in: query
          description: The page size
          schema: {}
          example: '10'
        - name: sort
          in: query
          description: The field and sort order
          schema: {}
          example: id,desc
      responses:
        '200':
          description: List of locations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_LocationResponse_'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have access to locations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    put:
      tags:
        - Locations
      summary: Save location
      description: This API can be used to update an location.
      operationId: updateLocation
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LocationUpdateRequest'
        required: true
      responses:
        '200':
          description: Location saved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationResponse'
        '400':
          description: >-
            User needs to provide a valid organization id. If the location is
            new the id should be null
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have permission to update location
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    post:
      tags:
        - Locations
      summary: Create location
      description: This API can be used to create a new location.
      operationId: createLocation
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LocationAddRequest'
        required: true
      responses:
        '200':
          description: createLocation 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationResponse'
        '201':
          description: Location created
        '400':
          description: >-
            User needs to provide a valid organization id. If the location is
            new the id should be null
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have permission to create location
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/locations/{locationId}:
    get:
      tags:
        - Locations
      summary: Get location
      description: This API can be used to get an location that you can view.
      operationId: getLocation
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: locationId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Location found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationResponse'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have access to location
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Location not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    delete:
      tags:
        - Locations
      summary: Delete locations
      description: >-
        This API can be used to remove an location and its sub-locations if
        there are no registered devices.
      operationId: delete
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: locationId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: delete 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unit'
        '204':
          description: Location deleted
        '400':
          description: >-
            Location has registered devices or the user is deleting a root
            location
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have access to location
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Location not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/rma:
    get:
      tags:
        - Rma
      summary: Get Rma Schema
      description: Get Rma Schema for an organization
      operationId: getRma
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: page
          in: query
          description: The page number
          schema: {}
          example: '0'
        - name: size
          in: query
          description: The page size
          schema: {}
          example: '10'
        - name: sort
          in: query
          description: The field and sort order
          schema: {}
          example: createdAt,desc
        - name: number
          in: query
          schema:
            type: string
            nullable: true
        - name: creationDate
          in: query
          schema:
            type: string
            nullable: true
        - name: customerName
          in: query
          schema:
            type: string
            nullable: true
        - name: workCenter
          in: query
          schema:
            type: string
            nullable: true
        - name: workCenterCode
          in: query
          schema:
            type: string
            nullable: true
        - name: purchaseOrderNumber
          in: query
          schema:
            type: string
            nullable: true
        - name: receivedDate
          in: query
          schema:
            type: string
            nullable: true
        - name: estimatedRepairDate
          in: query
          schema:
            type: string
            nullable: true
        - name: repairDate
          in: query
          schema:
            type: string
            nullable: true
        - name: store
          in: query
          schema:
            type: string
            nullable: true
        - name: notificationStatus
          in: query
          schema:
            type: string
            nullable: true
        - name: serialNumber
          in: query
          schema:
            type: string
            nullable: true
        - name: problemCode
          in: query
          schema:
            type: string
            nullable: true
      responses:
        '200':
          description: Rma Schema for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_RmaResponse_'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/users:
    get:
      tags:
        - Users
      summary: get all users
      description: This API allows you to get all users
      operationId: getUsers
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: page
          in: query
          description: The page number
          schema: {}
          example: '0'
        - name: size
          in: query
          description: The page size
          schema: {}
          example: '10'
        - name: sort
          in: query
          description: The field and sort order
          schema: {}
          example: id,desc
        - name: username
          in: query
          schema:
            type: string
            nullable: true
        - name: mail
          in: query
          schema:
            type: string
            nullable: true
        - name: locationId
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: string
              format: uuid
        - name: roles
          in: query
          schema:
            type: array
            nullable: true
            items:
              type: string
      responses:
        '200':
          description: Users found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_UserResponse_'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have access to the user list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    put:
      tags:
        - Users
      summary: Update user
      description: >-
        This API allows you to update users. If the mail or the id is already
        present in the system, the user will be updated
      operationId: updateUser
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      requestBody:
        description: The user to  update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdateRequest'
        required: true
      responses:
        '200':
          description: User updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have access update users
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
    post:
      tags:
        - Users
      summary: Create user
      description: This API allows you to create a user
      operationId: createUser
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
      requestBody:
        description: The user to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAddRequest'
        required: true
      responses:
        '200':
          description: User created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have access to create users
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/users/{id}:
    get:
      tags:
        - Users
      summary: Get user by id
      description: >-
        This API allow you to find the users, the API tries to find a match for
        the string passed by checking the name or mailing address on the system.
      operationId: getUser
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: c2b176f7-3bf6-484b-9118-cd6e5c8e0198
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          example: 7fd28f13-7dab-4a1d-9266-cbc82cafa4eb
      responses:
        '200':
          description: The user found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: You don't have access to this user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The user was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
  /api/{organizationId}/users/{userId}:
    delete:
      tags:
        - Users
      summary: Delete user
      description: This API allow you to delete one user if you have the permission.
      operationId: deleteUser
      parameters:
        - name: organizationId
          in: path
          description: The organization id
          required: true
          schema: {}
          example: ee125af1-7446-4cf1-9e3a-d75c16a74ba6
        - name: userId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: deleteUser 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unit'
        '204':
          description: The user has been deleted successfully.
        '400':
          description: The user needs to provide a valid organization id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: The user is not authorized to delete the user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: The user does not exist in the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearerAuth: []
components:
  schemas:
    Action.ActionStatus:
      type: string
      enum:
        - PENDING
        - IN_PROGRESS
        - COMPLETED
        - FAILED
    ActionDataCommand:
      required:
        - command
      type: object
      properties:
        command:
          type: string
        payload:
          type: string
          nullable: true
    ActionDetails:
      required:
        - actionId
        - commands
        - data
        - description
        - displayName
        - location
        - owner
        - progress
        - status
      type: object
      properties:
        actionId:
          type: string
          format: uuid
        displayName:
          type: string
        description:
          type: string
        commands:
          type: array
          items:
            $ref: '#/components/schemas/CommandDetails'
        data:
          $ref: '#/components/schemas/ActionDataCommand'
        owner:
          $ref: '#/components/schemas/OwnerDetails'
        startTime:
          type: string
          format: date-time
          nullable: true
        endTime:
          type: string
          format: date-time
          nullable: true
        status:
          $ref: '#/components/schemas/Action.ActionStatus'
        progress:
          $ref: '#/components/schemas/ActionResponse.ActionProgress'
        location:
          $ref: '#/components/schemas/LocationResponse'
    ActionRequest:
      required:
        - data
        - description
        - deviceIds
        - displayName
        - locationId
      type: object
      properties:
        displayName:
          type: string
        description:
          type: string
        deviceIds:
          type: array
          items:
            type: string
        locationId:
          type: string
          format: uuid
        data:
          $ref: '#/components/schemas/ActionRequest.ActionDataCommandRequest'
    ActionRequest.ActionDataCommandRequest:
      required:
        - command
      type: object
      properties:
        command:
          type: integer
          format: int64
        payload:
          type: string
          nullable: true
    ActionResponse:
      required:
        - actionId
        - commandIds
        - data
        - description
        - deviceIds
        - displayName
        - locationId
        - owner
        - progress
        - status
      type: object
      properties:
        actionId:
          type: string
          format: uuid
        displayName:
          type: string
        description:
          type: string
        deviceIds:
          type: array
          items:
            type: string
        commandIds:
          type: array
          items:
            type: string
            format: uuid
        data:
          $ref: '#/components/schemas/ActionDataCommand'
        startTime:
          type: string
          format: date-time
          nullable: true
        endTime:
          type: string
          format: date-time
          nullable: true
        status:
          $ref: '#/components/schemas/Action.ActionStatus'
        progress:
          $ref: '#/components/schemas/ActionResponse.ActionProgress'
        owner:
          $ref: '#/components/schemas/OwnerDetails'
        locationId:
          type: string
          format: uuid
    ActionResponse.ActionProgress:
      required:
        - completed
        - failed
        - pending
        - total
      type: object
      properties:
        total:
          type: integer
          format: int32
        completed:
          type: integer
          format: int32
        failed:
          type: integer
          format: int32
        pending:
          type: integer
          format: int32
    CategoryDeviceCount:
      required:
        - connectedDevices
        - id
        - name
        - totalDevices
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        parentId:
          type: integer
          format: int64
          nullable: true
        templateId:
          type: integer
          format: int64
          nullable: true
        totalDevices:
          type: integer
          format: int32
        connectedDevices:
          type: integer
          format: int32
        image:
          type: string
          nullable: true
    CommandDetails:
      required:
        - command
        - device
        - id
        - status
        - statusMessage
      type: object
      properties:
        id:
          type: string
          format: uuid
        command:
          type: string
        request:
          type: object
          additionalProperties: true
          nullable: true
        response:
          type: object
          additionalProperties: true
          nullable: true
        status:
          $ref: '#/components/schemas/CommandStatus'
        statusMessage:
          type: string
        device:
          $ref: '#/components/schemas/DeviceResponse'
        startTime:
          type: string
          format: date-time
          nullable: true
        endTime:
          type: string
          format: date-time
          nullable: true
    CommandRequestPayload:
      type: object
      properties:
        payload:
          nullable: true
    CommandResponse:
      required:
        - command
        - deviceId
        - id
        - status
        - statusMessage
      type: object
      properties:
        id:
          type: string
          format: uuid
        command:
          type: string
        request:
          type: object
          additionalProperties: true
          nullable: true
        response:
          type: object
          additionalProperties: true
          nullable: true
        status:
          $ref: '#/components/schemas/CommandStatus'
        statusMessage:
          type: string
        deviceId:
          type: string
        startTime:
          type: string
          format: date-time
          nullable: true
        endTime:
          type: string
          format: date-time
          nullable: true
        owner:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/OwnerDetails'
        actionId:
          type: string
          format: uuid
          nullable: true
    CommandStatus:
      type: string
      enum:
        - PENDING
        - STARTED
        - IN_PROGRESS
        - COMPLETED
        - FAILED
    Device.StatusMessage:
      required:
        - connected
        - timestamp
      type: object
      properties:
        connected:
          type: boolean
        timestamp:
          type: string
          format: date-time
    DeviceAddRequest:
      required:
        - deviceCategoryId
        - deviceType
        - enabled
        - id
        - locationId
        - name
      type: object
      properties:
        id:
          maxLength: 50
          minLength: 1
          type: string
        name:
          maxLength: 50
          minLength: 1
          type: string
        locationId:
          type: string
          format: uuid
        deviceType:
          $ref: '#/components/schemas/DeviceType'
        deviceCategoryId:
          type: integer
          format: int64
        enabled:
          type: boolean
        parentId:
          type: string
          nullable: true
    DeviceCategoryResponse:
      required:
        - id
        - name
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        deviceTemplateId:
          type: integer
          format: int64
          nullable: true
        parentId:
          type: integer
          format: int64
          nullable: true
        image:
          type: string
          nullable: true
    DeviceCredentials:
      required:
        - primaryKey
        - scope
        - secondaryKey
      type: object
      properties:
        scope:
          type: string
        primaryKey:
          type: string
        secondaryKey:
          type: string
    DeviceParent:
      required:
        - id
        - name
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    DeviceResponse:
      required:
        - connection
        - deviceCategoryId
        - deviceType
        - enabled
        - id
        - locationId
        - name
        - properties
        - provisioned
        - status
        - telemetries
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        enabled:
          type: boolean
        provisioned:
          type: boolean
        locationId:
          type: string
          format: uuid
        deviceType:
          $ref: '#/components/schemas/DeviceType'
        deviceCategoryId:
          type: integer
          format: int64
        properties:
          type: object
          additionalProperties: true
        telemetries:
          type: object
          additionalProperties: true
        status:
          $ref: '#/components/schemas/DeviceStatus'
        connection:
          $ref: '#/components/schemas/Device.StatusMessage'
        parent:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/DeviceParent'
    DeviceStatus:
      type: string
      enum:
        - WAITING_FOR_APPROVAL
        - REGISTERED
        - BLOCKED
        - PROVISIONED
    DeviceTemplateResponse:
      required:
        - deviceCommands
        - id
        - name
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        deviceCommands:
          type: array
          items:
            $ref: '#/components/schemas/TemplateCommand'
    DeviceType:
      type: string
      enum:
        - iotEdge
        - iotDevice
        - host
    DeviceUpdateRequest:
      required:
        - id
      type: object
      properties:
        id:
          maxLength: 50
          type: string
        name:
          maxLength: 50
          type: string
          nullable: true
        locationId:
          type: string
          format: uuid
          nullable: true
        deviceCategoryId:
          type: integer
          format: int64
          nullable: true
        enabled:
          type: boolean
          nullable: true
        parentId:
          type: string
          nullable: true
    DevicesDeleteRequest:
      required:
        - ids
      type: object
      properties:
        ids:
          type: array
          items:
            type: string
    DevicesDeleteResponse:
      required:
        - failedDevices
      type: object
      properties:
        failedDevices:
          type: object
          additionalProperties:
            type: string
    ErrorMessage:
      required:
        - errors
        - time
      type: object
      properties:
        name:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        requestId:
          type: string
          nullable: true
        time:
          type: string
          format: date-time
        errors:
          type: array
          items:
            type: object
    LocationAddRequest:
      required:
        - name
        - parentId
      type: object
      properties:
        name:
          maxLength: 50
          minLength: 1
          type: string
        parentId:
          type: string
          format: uuid
    LocationResponse:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          nullable: true
        parentId:
          type: string
          format: uuid
          nullable: true
    LocationUpdateRequest:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          maxLength: 40
          minLength: 4
          type: string
          nullable: true
        parentId:
          type: string
          format: uuid
          nullable: true
    OrganizationResponse:
      required:
        - enrollment
        - id
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          nullable: true
        enrollment:
          type: object
          additionalProperties: true
    OrganizationWithRolesResponse:
      required:
        - id
        - roles
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          nullable: true
        roles:
          type: array
          items:
            $ref: '#/components/schemas/RoleResponse'
    OwnerDetails:
      required:
        - id
        - mail
      type: object
      properties:
        id:
          type: string
          format: uuid
        mail:
          type: string
    Page_ActionResponse_:
      required:
        - content
        - empty
        - numberOfElements
        - offset
        - pageNumber
        - pageable
        - size
        - totalPages
        - totalSize
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/ActionResponse'
        pageable:
          allOf:
            - $ref: '#/components/schemas/Pageable'
            - required:
                - mode
                - number
        pageNumber:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        size:
          type: integer
          format: int32
        empty:
          type: boolean
        numberOfElements:
          type: integer
          format: int32
        totalSize:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
    Page_CommandResponse_:
      required:
        - content
        - empty
        - numberOfElements
        - offset
        - pageNumber
        - pageable
        - size
        - totalPages
        - totalSize
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/CommandResponse'
        pageable:
          allOf:
            - $ref: '#/components/schemas/Pageable'
            - required:
                - mode
                - number
        pageNumber:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        size:
          type: integer
          format: int32
        empty:
          type: boolean
        numberOfElements:
          type: integer
          format: int32
        totalSize:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
    Page_DeviceResponse_:
      required:
        - content
        - empty
        - numberOfElements
        - offset
        - pageNumber
        - pageable
        - size
        - totalPages
        - totalSize
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/DeviceResponse'
        pageable:
          allOf:
            - $ref: '#/components/schemas/Pageable'
            - required:
                - mode
                - number
        pageNumber:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        size:
          type: integer
          format: int32
        empty:
          type: boolean
        numberOfElements:
          type: integer
          format: int32
        totalSize:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
    Page_LocationResponse_:
      required:
        - content
        - empty
        - numberOfElements
        - offset
        - pageNumber
        - pageable
        - size
        - totalPages
        - totalSize
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/LocationResponse'
        pageable:
          allOf:
            - $ref: '#/components/schemas/Pageable'
            - required:
                - mode
                - number
        pageNumber:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        size:
          type: integer
          format: int32
        empty:
          type: boolean
        numberOfElements:
          type: integer
          format: int32
        totalSize:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
    Page_RmaResponse_:
      required:
        - content
        - empty
        - numberOfElements
        - offset
        - pageNumber
        - pageable
        - size
        - totalPages
        - totalSize
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/RmaResponse'
        pageable:
          allOf:
            - $ref: '#/components/schemas/Pageable'
            - required:
                - mode
                - number
        pageNumber:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        size:
          type: integer
          format: int32
        empty:
          type: boolean
        numberOfElements:
          type: integer
          format: int32
        totalSize:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
    Page_UserResponse_:
      required:
        - content
        - empty
        - numberOfElements
        - offset
        - pageNumber
        - pageable
        - size
        - totalPages
        - totalSize
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/UserResponse'
        pageable:
          allOf:
            - $ref: '#/components/schemas/Pageable'
            - required:
                - mode
                - number
        pageNumber:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        size:
          type: integer
          format: int32
        empty:
          type: boolean
        numberOfElements:
          type: integer
          format: int32
        totalSize:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
    Pageable:
      required:
        - mode
        - number
        - size
        - sort
      type: object
      properties:
        number:
          type: integer
          format: int32
        size:
          type: integer
          format: int32
        mode:
          $ref: '#/components/schemas/Pageable.Mode'
        sort:
          $ref: '#/components/schemas/Sort'
      allOf:
        - $ref: '#/components/schemas/Sort'
    Pageable.Mode:
      type: string
      enum:
        - CURSOR_NEXT
        - CURSOR_PREVIOUS
        - OFFSET
    RmaItem:
      required:
        - customerMaterialDescription
        - materialDescription
        - materialNumber
        - problemCode
        - problemCode2
        - problemCodeDescription
        - serialNumber
      type: object
      properties:
        serialNumber:
          type: string
        problemCode:
          type: string
        problemCode2:
          type: string
        problemCodeDescription:
          type: string
        materialNumber:
          type: string
        materialDescription:
          type: string
        customerMaterialDescription:
          type: string
    RmaResponse:
      required:
        - additionalNote
        - creationDate
        - customerName
        - estimatedRepairDate
        - items
        - notificationNumber
        - notificationStatus
        - number
        - problemDescription
        - purchaseOrderNumber
        - receivedDate
        - repairDate
        - shipment
        - store
        - workCenter
        - workCenterCode
      type: object
      properties:
        number:
          type: string
        creationDate:
          type: string
        customerName:
          type: string
        workCenter:
          type: string
        workCenterCode:
          type: string
        purchaseOrderNumber:
          type: string
        receivedDate:
          type: string
        estimatedRepairDate:
          type: string
        repairDate:
          type: string
        notificationNumber:
          type: string
        problemDescription:
          type: string
        additionalNote:
          type: string
        store:
          type: string
        notificationStatus:
          type: string
        shipment:
          $ref: '#/components/schemas/Shipment'
        items:
          type: array
          items:
            $ref: '#/components/schemas/RmaItem'
    RoleEnum:
      type: string
      enum:
        - admin
        - operator
        - viewer
    RoleRequest:
      required:
        - locationId
        - role
      type: object
      properties:
        role:
          $ref: '#/components/schemas/RoleEnum'
        locationId:
          type: string
          format: uuid
    RoleResponse:
      required:
        - location
        - role
      type: object
      properties:
        role:
          $ref: '#/components/schemas/RoleEnum'
        location:
          $ref: '#/components/schemas/LocationResponse'
    Shipment:
      required:
        - addressOfShipToParty
        - shipToParty
        - shippingDate
        - shippingType
      type: object
      properties:
        shippingDate:
          type: string
        addressOfShipToParty:
          type: string
        shippingType:
          type: string
        shipToParty:
          type: string
    Sort:
      required:
        - orderBy
      type: object
      properties:
        orderBy:
          type: array
          items:
            $ref: '#/components/schemas/Sort.Order'
    Sort.Order:
      required:
        - direction
        - ignoreCase
        - property
      type: object
      properties:
        ignoreCase:
          type: boolean
        direction:
          $ref: '#/components/schemas/Sort.Order.Direction'
        property:
          type: string
        ascending:
          type: boolean
    Sort.Order.Direction:
      type: string
      enum:
        - ASC
        - DESC
    TemplateCommand:
      required:
        - id
        - name
      type: object
      properties:
        id:
          type: integer
          format: int64
          nullable: true
        name:
          type: string
    Unit:
      type: object
    UserAddRequest:
      required:
        - mail
        - preferences
        - profile
        - role
        - username
      type: object
      properties:
        username:
          maxLength: 40
          minLength: 4
          type: string
        mail:
          type: string
          format: email
        role:
          $ref: '#/components/schemas/RoleRequest'
        profile:
          type: object
          additionalProperties: true
        preferences:
          type: object
          additionalProperties: true
    UserResponse:
      required:
        - id
        - mail
        - preferences
        - profile
        - roles
        - username
      type: object
      properties:
        id:
          type: string
          format: uuid
        username:
          type: string
        mail:
          type: string
        profile:
          type: object
          additionalProperties: true
        preferences:
          type: object
          additionalProperties: true
        roles:
          type: array
          items:
            $ref: '#/components/schemas/RoleResponse'
        createdAt:
          type: string
          format: date-time
          nullable: true
        updatedAt:
          type: string
          format: date-time
          nullable: true
    UserUpdateRequest:
      type: object
      properties:
        id:
          type: string
          format: uuid
          nullable: true
        username:
          maxLength: 40
          minLength: 4
          type: string
          nullable: true
        mail:
          type: string
          format: email
          nullable: true
        profile:
          type: object
          additionalProperties: true
          nullable: true
        preferences:
          type: object
          additionalProperties: true
          nullable: true
        role:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/RoleRequest'
    UserWithOrgsResponse:
      required:
        - id
        - mail
        - organizations
        - preferences
        - profile
        - username
      type: object
      properties:
        id:
          type: string
          format: uuid
        username:
          type: string
        mail:
          type: string
        profile:
          type: object
          additionalProperties: true
        preferences:
          type: object
          additionalProperties: true
        organizations:
          type: array
          items:
            $ref: '#/components/schemas/OrganizationWithRolesResponse'
  securitySchemes:
    bearerAuth:
      type: http
      description: JWT authentication
      scheme: bearer
      bearerFormat: JWT
