openapi: 3.0.3

info:
  description: APIs Published by Siemens for SITRANS HUB IQ
  version: "0.0.1"
  title: SITRANS Hub IQ API's
  contact:
    name: Hub IQ API Support Team

servers:
  - description: SITRANS HUB IQ API - Production
    url: https://api.hubiq.siemens.com/
  - description: SITRANS HUB IQ API - Staging
    url: https://{Route_53_DNS}/

tags:
  - name: Company
    description: API's related to CURD operation on company
  - name: Device
    description: API's related to CURD operation on devices
  # - name: Token
  #   description: API's related to token generation
  - name: ProcessValues
    description: API's related to flow mesurement data
  - name: Alarms
    description: API's related to alarm monitoring data
  - name: Parameters
    description: API's related to device parameter data


paths:

# Company APIs

  /company:
    post:
      operationId: CreateCompany
      tags:
        - Company
      security:
        - bearerAuth: []
      summary: Create a new child company
      description: >
        Let's admin create a new child company.
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
      requestBody:
        required: true
        content:
          application/json (Version 1.0.0):
            schema:
              $ref: "#/components/schemas/CreateCompanyRequest"
      responses:
        "200":
          description: Successfully created a company
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/CreateCompanyResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"

  /companies/{company_id}:
    get:
      operationId: GetCompanyDetails
      tags:
        - Company
      security:
        - bearerAuth: []
      summary: Fetch Company and its child companies
      description: >
        Lets admin visualize the metadata of the company and the children companies.
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: The id of the company, maximum length 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
        - name: subchild
          in: query
          required: false
          schema:
            type: string
            default: True
            example: True
            enum:
              - True
              - False
            description: "If False is passed then same level will be returned, and if True is passed or this parameter is not passed then the whole hierarchy will be returned"
      responses:
        "200":
          description: Successfully retrieved the list of companies
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/ListCompaniesResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "403":
          $ref: "#/components/responses/403Error"
        "404":
          $ref: "#/components/responses/404Error"
        "500":
          $ref: "#/components/responses/500Error"

    delete:
      operationId: DeleteCompany
      tags:
        - Company
      security:
        - bearerAuth: []
      summary: Delete a company
      description: >
        Only the company administrator has the authority to remove its subsidiary companies. Self-deletion is restricted, and deleting companies with subsidiaries is also prohibited.
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: The id of attached to the company, maximum size 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
      responses:
        "200":
          description: Successfully deleted the company
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/DeleteCompanyResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "403":
          $ref: "#/components/responses/403Error"
        "405":
          $ref: "#/components/responses/405Error"
        "404":
          $ref: "#/components/responses/404Error"


# Device APIs

  /companies/{company_id}/devices:
    post:
      tags:
        - Device
      security:
        - bearerAuth: []
      summary: Claim a device
      description: Lets user claim their devices under their company.
      operationId: RegisterDevices
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: This specifies the company id to which device will be registered, maximum size is 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
      requestBody:
        required: true
        content:
          application/json (Version 1.0.0):
            schema:
              $ref: "#/components/schemas/DeviceClaimRequest"
      responses:
        "200":
          description: Device is claimed successfully
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/DeviceClaimResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"

  /companies/{company_id}/devices/list:
    post:
      operationId: ListDevices
      tags:
        - Device
      security:
        - bearerAuth: []
      summary: Fetch All Devices
      description: >
        This API will return Devices claimed under given Company.
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: The id of the company attached to the user, maximum size is 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
      requestBody:
        required: true
        content:
          application/json (Version 1.0.0):
            schema:
              $ref: "#/components/schemas/GetDevicesRequest"
      responses:
        "200":
          description: Successfully fetched the Devices list
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/GetDevicesResponse"
        "403":
          $ref: "#/components/responses/403Error"
        "500":
          $ref: "#/components/responses/500Error"
        "401":
          $ref: "#/components/responses/401Error"
        "404":
          $ref: "#/components/responses/404Error"
        "400":
          $ref: "#/components/responses/400Error"

  /companies/{company_id}/devices/{device_id}:
    get:
      operationId: GetDeviceDetails
      tags:
        - Device
      security:
        - bearerAuth: []
      summary: Fetch a Devices
      description: >
        This API will return device detail created under this company
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: The id of the company attached to the user, maximum size is 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
        - name: device_id
          in: path
          required: true
          description: The device_id of the to be fetched, maximum size is 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
      responses:
        "200":
          description: device under company is fetched successfully
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/GetOneDeviceResponse"
        "403":
          $ref: "#/components/responses/403Error"
        "500":
          $ref: "#/components/responses/500Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"

    delete:
      operationId: DeleteDevice
      tags:
        - Device
      security:
        - bearerAuth: []
      summary: Delete a Devices
      description: >
        This API will return device detail created under this company
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: The id of the company attached to the user, maximum size is 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
        - name: device_id
          in: path
          required: true
          description: The device_id of the to be deleted, maximum size is 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
      responses:
        "200":
          description: Device is successfully deleted
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/DeleteDeviceResponse"
        "403":
          $ref: "#/components/responses/403Error"
        "500":
          $ref: "#/components/responses/500Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"


  /companies/{company_id}/devices/kpis:
    get:
      operationId: GetDeviceKPI
      tags:
        - Device
      security:
        - bearerAuth: []
      summary: Fetch Device KPIs
      description: >
        This API will return total, online and offline device count for the selected company
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: The id of the company attached to the user, maximum size is 64 char.
          schema:
            type: string
            minimum: 1
            maximum: 64

      responses:
        "200":
          description: device count under company is fetched successfully
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/DeviceKPIResponse"
        "403":
          $ref: "#/components/responses/403Error"
        "500":
          $ref: "#/components/responses/500Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"

# Telemetry Data API's

  /companies/{company_id}/devices/{device_id}/process-values:
    get:
      operationId: GetFlowMeasurementData
      description: >
        This API will return process values data of a specific device for a given duration.
      tags:
        - ProcessValues
      security:
        - bearerAuth: []
      summary: Get Process Values of a device
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: "This is company id linked to the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
        - name: device_id
          in: path
          required: true
          description: "This is Device ID of the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
        - name: from_date_time
          in: query
          schema:
            type: string
            example: "YYYY-MM-DDThh:mm:ssTZD"
            default: None
            description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
        - name: to_date_time
          in: query
          schema:
            type: string
            example: "YYYY-MM-DDThh:mm:ssTZD"
            default: None
            description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
        - name: page_size
          in: query
          schema:
            type: integer
            example: 15
            default: 15
            enum:
              - 15
              - 30
              - 50
            description: "Optional. The maximum of values to fetch. Will add a 'NextToken' key to fetch the next page. Defaults to 15"
        - name: next_token
          in: query
          schema:
            type: string
            default: None
            example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
            description: "A base64 encoded string to fetch the next page of the paginated result."
      responses:
        "200":
          description: Successfully fetched list of all measurement values.
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/GetMeasurementDataResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "403":
          $ref: "#/components/responses/403Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"


  /companies/{company_id}/devices/{device_id}/process-values/latest:
    get:
      operationId: GetLatestFlowMeasurementData
      description: >
        This API will return only the latest process values of a specific device.
      tags:
        - ProcessValues
      security:
        - bearerAuth: []
      summary: Get Latest Process Values of a device
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: "This is company id linked to the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
        - name: device_id
          in: path
          required: true
          description: "This is Device ID of the device, maximum size is 64 char."
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
      responses:
        "200":
          description: "Successfully fetched the latest process value."
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/GetLatestMeasurementDataResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "403":
          $ref: "#/components/responses/403Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"


# Fetch Device Alarm APIs

  /companies/{company_id}/devices/{device_id}/alarms:
    get:
      operationId: GetDeviceAlarmsData
      tags:
        - Alarms
      security:
        - bearerAuth: []
      summary: Get All the Alarms of a device
      description: >
        This API returns the list of alarms raised for a device.
        <br><br>
        note: next_token and previous_token both must not be present in the same request
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: "The company id which is linked to the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
        - name: device_id
          in: path
          required: true
          description: "The device id to fetch the alarms from, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
        - name: from_date_time
          in: query
          schema:
            type: string
            example: "YYYY-MM-DDThh:mm:ssTZD"
            default: None
            description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
        - name: to_date_time
          in: query
          schema:
            type: string
            example: "YYYY-MM-DDThh:mm:ssTZD"
            default: None
            description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
        - name: page_size
          in: query
          schema:
            type: integer
            example: 15
            default: 15
            enum:
              - 15
              - 30
              - 50
            description: "Optional. The maximum of values to fetch in a request. Will add a 'NextToken' key to fetch the next page. Defaults to 15"
        - name: fetch_last
          in: query
          schema:
            type: string
            example: True
            default: false
            enum:
              - True
              - False
            description: Pass true if need to fetch the last page
        - name: next_token
          in: query
          schema:
            type: string
            default: None
            example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
            description: "A base64 encoded string to fetch the next page of the paginated result."
        - name: previous_token
          in: query
          schema:
            type: string
            default: None
            example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
            description: "A base64 encoded string to fetch the previous page of the paginated result."
      responses:
        "200":
          description: Successfully fetched List of alarms data.
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/GetDeviceAlarmsResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "403":
          $ref: "#/components/responses/403Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"

  /companies/{company_id}/devices/alarms:
    get:
      operationId: GetCompanyAlarmsData
      tags:
        - Alarms
      security:
        - bearerAuth: []
      summary: Get All the Alarms of all the devices under a company
      description: >
        This API returns the list of alarms raised for all the devices under a company.
        <br><br>
        note: next_token and previous_token both must not be present in the same request
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: "The company id which is linked to the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
        - name: from_date_time
          in: query
          schema:
            type: string
            example: "YYYY-MM-DDThh:mm:ssTZD"
            default: None
            description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
        - name: to_date_time
          in: query
          schema:
            type: string
            example: "YYYY-MM-DDThh:mm:ssTZD"
            default: None
            description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
        - name: page_size
          in: query
          schema:
            type: integer
            example: 15
            default: 15
            enum:
              - 15
              - 30
              - 50
            description: "Optional. The maximum of values to fetch. Will add a 'NextToken' key to fetch the next page. Defaults to 15"
        - name: fetch_last
          in: query
          schema:
            type: boolean
            example: True
            default: false
            description: Pass true if need to fetch the last page
        - name: next_token
          in: query
          schema:
            type: string
            default: None
            example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
            description: "A base64 encoded string to fetch the next page of the paginated result."
        - name: previous_token
          in: query
          schema:
            type: string
            default: None
            example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
            description: "A base64 encoded string to fetch the previous page of the paginated result."
      responses:
        "200":
          description: Successfully fetched List of alarms data for company.
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/GetCompanyAlarmsResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "403":
          $ref: "#/components/responses/403Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"


# Device Paramater Read Write APIs

  /companies/{company_id}/devices/{device_id}/parameters/write:
    post:
      operationId: RequestDeviceParameterDataWrite
      tags:
        - Parameters
      security:
        - bearerAuth: []
      summary: Write One or Many Parameters to Device
      description: >
        This API requests to Write One or Many Parameters to Device. Minimum 1 & Maximum 5 are Allowed.
        <br><br>
        Note:- Parameter details like parameter ID could be fetched using fetch all paramter API.
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: "The company id which is linked to the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
        - name: device_id
          in: path
          required: true
          description: "The device id to fetch the parameters for, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
      requestBody:
        required: true
        content:
          application/json (Version 1.0.0):
            schema:
              $ref: "#/components/schemas/DeviceParameterWriteRequest"
      responses:
        "202":
          description: Request for writing parameters data is successfully Accepted.
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/DeviceParameterWriteResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "403":
          $ref: "#/components/responses/403Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"


  /companies/{company_id}/devices/{device_id}/parameters/read:
    post:
      operationId: RequestParameterDataRead
      tags:
        - Parameters
      security:
        - bearerAuth: []
      summary: Read One or Many Parameters from Device
      description: >
        This API requests to Read One or Many Parameters from Device. Minimum 1 & Maximum 5 are Allowed.
        <br><br>
        Note:- Parameter details like parameter ID could be fetched using fetch all paramter API.
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: "The company id which is linked to the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
        - name: device_id
          in: path
          required: true
          description: "The device id to fetch the parameters for, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
      requestBody:
        required: true
        content:
          application/json (Version 1.0.0):
            schema:
              $ref: "#/components/schemas/DeviceParameterReadRequest"
      responses:
        "202":
          description: Request for reading parameters data is successfully Accepted.
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/DeviceParameterReadResponse"
        "400":
          $ref: "#/components/responses/400Error"
        "500":
          $ref: "#/components/responses/500Error"
        "403":
          $ref: "#/components/responses/403Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"


  /companies/{company_id}/devices/{device_id}/parameters:
    get:
      operationId: getAllParametersDataOfDevice
      tags:
        - Parameters
      security:
        - bearerAuth: []
      summary: Get All Parameters Data of a Device
      description: |
        This API will return All Parameters Data of a Device from HubIQ database.
        <br><br>
        Note:- As parameter are read from device on request basis thus this API will return value for the parameter which is read or written a value successfully, meaning this api may not return valu for all the parameter but a subset of it.
        <br><br>
        Note:- If Device parameter is locally updated then there could be discrepancy in result returned from this API, As Device is not proactively send parameter change event to HubIQ. 
      parameters:
        - in: header
          name: api-version
          required: true
          schema:
            type: string
            enum: ["1.0.0"]
            example: "1.0.0"
        - in: header
          name: auth-header
          required: true
          schema:
            type: string
            description: JWT Token
        - name: company_id
          in: path
          required: true
          description: "The company id which is linked to the device, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
        - name: device_id
          in: path
          required: true
          description: "The device id to fetch the register data from, maximum size is 64 char"
          schema:
            type: string
            minimum: 1
            maximum: 64
            example: "1234"
      responses:
        "200":
          description: All Device parameters are successfully fetched.
          content:
            application/json (Version 1.0.0):
              schema:
                $ref: "#/components/schemas/GetAllDeviceParametersResponse"
              examples:
                List of all parameters data of a device:
                  value:
                    data:
                      deviceId: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
                      parameters:
                      - parameterId: <string>
                        values:
                        - key: ParameterName
                          value: <string>
                        - key: ParameterValue
                          value: <string>
                        - key: DataType
                          value: <string>
                        - key: MinValue
                          value: <string>
                        - key: MaxValue
                          value: <string>
                        - key: DefaultValue
                          value: <string>
                        - key: Permission
                          value: <string>
                        - key: Description
                          value: <string>
                        - key: WriteStatus
                          value: <string>
                          description:  Possible values "PENDING", "ERROR" or NULL 
                        - key: ReadStatus
                          value: <string>
                          description:  Possible values "PENDING", "ERROR" or NULL 
                      - parameterId: <string>
                        values:
                        - key: ParameterName
                          value: <string>
                        - key: ParameterValue
                          value: <string>
                        - key: DataType
                          value: <string>
                        - key: MinValue
                          value: <string>
                        - key: MaxValue
                          value: <string>
                        - key: DefaultValue
                          value: <string>
                        - key: Permission
                          value: <string>
                        - key: Description
                          value: <string>
                        - key: ParameterNumber
                          value: <string> 
                        - key: WriteStatus
                          value: <string>
                          description:  Possible values "PENDING", "ERROR" or NULL 
                        - key: ReadStatus
                          value: <string>
                          description:  Possible values "PENDING", "ERROR" or NULL                                                  
        "400":
          $ref: "#/components/responses/400Error"
        "403":
          $ref: "#/components/responses/403Error"
        "401":
          $ref: "#/components/responses/401Error"
        "405":
          $ref: "#/components/responses/405Error"
        "500":
          $ref: "#/components/responses/500Error"


#Models

components:
  schemas:

# Create Company Request & Response

    CreateCompanyRequest:
      type: object
      required:
        - name
        - parentCompanyID
      properties:
        name:
          type: string
          example: "new_company_pvt_ltd#1"
          minimum: 3
          maximum: 64
          description: "Company name can consist of [a-z] [0-9] [#,_,&], and the first letter must be an alphabet. The length must be at least 2"
        parentCompanyID:
          type: string
          example: "1234-f44j-44f4-44f"
          minimum: 1
          maximum: 64
          description: "Must be requested using suitable company API. This parameter specifies the parent company of the new company."

    CreateCompanyResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            companyId:
              type: string
              description: The id of the company.
            companyName:
              type: string
              example: "new_company_pvt_ltd#1"
              description:  "Comnapny Name"
            parentCompanyID:
              type: string
              example: "1234-f44j-44f4-44f"
              description: "Parent company ID"

# Get Company or its child Company Response

    ListCompaniesResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            CompanyId:
              type: string
              description: The id of the company.
            CompanyName:
              type: string
              description: The name of the company.
            Children:
              type: array
              items:
                type: object
                properties:
                  CompanyId:
                    type: string
                    description: The id of the child company.
                  CompanyName:
                    type: string
                    description: The name of the child company.
                  Children:
                    type: array
                    items:
                      type: object
                      properties:
                        CompanyId:
                          type: string
                          description: The id of the child company.
                        CompanyName:
                          type: string
                          description: The name of the child company.

# Delete Company Response

    DeleteCompanyResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            message:
              type: string

# Claim Device Request & Response

    DeviceClaimRequest:
      type: object
      properties:
        devices:
          type: array
          minimum: 1
          maximum: 10
          items:
            type: object
            required:
              - deviceType
            properties:
              deviceType:
                type: string
                enum:
                  - "Mag8000-4G"
                  - "Mag8000-LoRa"
                  - "CC220"
                  - "MS200"
                  - "IoTRadar"
                  - "Mag8000-Flex"
                  - "Mag8000-LoRaGateway"
                example: "Mag8000-4G"
                description: "The type of the device"
              serialNumber:
                type: string
                description: "Serial number of device"
                example: "4CE0460D0G"
                maximum: 32
              iccid:
                type: string
                description: "The id for MAG 4G devices"
                example: "4CE0460D0G"
                maximum: 32
              deveui:
                type: string
                description: "The id for MAG LORA devices"
                example: "4CE0460D0G"
                maximum: 32
              macAddress:
                type: string
                description: "MAC Address of the device"
                example: "00-B0-D0-63-C2-26"
                maximum: 32

    DeviceClaimResponse:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              companyId:
                type: string
                description: The current company or the requested company's id.
              deviceId:
                type: string
                description: "The device's unique id"
                example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
              deviceType:
                type: string
                enum:
                  - "Mag8000-4G"
                  - "Mag8000-LoRa"
                  - "CC220"
                  - "MS200"
                  - "IoTRadar"
                  - "Mag8000-Flex"
                  - "Mag8000-LoRaGateway"
                example: "Mag8000-4G"
                description: "The type of the device"
              serialNumber:
                type: string
                description: "Serial number of device"
                example: "4CE0460D0G"
              iccid:
                type: string
                description: "The id for MAG 4G devices"
                example: "4CE0460D0G"
              deveui:
                type: string
                description: "The id for MAG LORA devices"
                example: "4CE0460D0G"
              macAddress:
                type: string
                description: "MAC Address of the device"
                example: "00-B0-D0-63-C2-26"
              imei:
                type: string
                description: The device's IMEI number
                example: "355882069673699"
              mlfb:
                type: string
                description: The device's MLFB number
                example: "3VA6225-6HN31-0DK0"
              claimedStatus:
                type: string
                description: "The device's claimed status"
                enum:
                  - "CLAIMED"
                  - "UNCLAIMED"
                example: "CLAIMED"
              connectivityStatus:
                type: string
                description: The device's status.
                enum:
                  - "CONNECTED"
                  - "DISCONNECTED"
                  - "NEVERSEEN"
                example: "CONNECTED"
              lastConnectedOn:
                type: string
                example: 
                description: Timestamp of last communication with the device.
              claimedOn:
                type: string
                example: 
                description: Timestamp of when the device was claimed.
              provisionedOn:
                type: string
                example: 
                description: Timestamp of when the device was provisioned/registered.
              currentFirmwareVersion:
                type: string
                example: "01.00.00"
                description: Device Current Firmware Version.
        errors:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: "unique error id - uuid"
                example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
              code:
                type: string
                description: "unique error code"
                example: "FWENQ-0x00000001"
              title:
                type: string
                description: "Error title"
                example: "Bad Request"
              status:
                type: number
                description: "HTTP Status code"
                example: "400"
              details:
                type: string
                description: "error message"
                example: "Invalid Serial number"
              meta:
                type: object
                properties:
                  deviceType:
                    type: string
                    enum:
                      - "Mag8000-4G"
                      - "Mag8000-LoRa"
                      - "CC220"
                      - "MS200"
                      - "IoTRadar"
                      - "Mag8000-Flex"
                      - "Mag8000-LoRaGateway"
                    example: "Mag8000-4G"
                    description: "The type of the device"
                  serialNumber:
                    type: string
                    description: "Serial number of device"
                    example: "4CE0460D0G"
                  iccid:
                    type: string
                    description: "The id for MAG 4G devices"
                    example: "4CE0460D0G"
                  deveui:
                    type: string
                    description: "The id for MAG LORA devices"
                    example: "4CE0460D0G"
                  macAddress:
                    type: string
                    description: "MAC Address of the device"
                    example: "00-B0-D0-63-C2-26"
              correlationId:
                type: string
                description: "transaction unique id"
                example: "1-66f3a9dc-4924ac09759b99e51766d14d"


# Get Device Request

    GetDevicesRequest:
      type: object
      description: next_token and previous_token both must not be present in the same request
      properties:
        page_size:
          type: integer
          example: 15
          default: 15
          enum:
            - 15
            - 30
            - 50
          description: "Optional. The maximum of values to fetch. Will add a 'NextToken' key to fetch the next page. Defaults to 15"
        fetch_last:
          type: string
          example: True
          enum:
            - True
            - False
          description: Pass true if need to fetch the last page
        next_token:
          type: string
          default: None
          example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
          description: "A base64 encoded string to fetch the next page of the paginated result."
        previous_token:
          type: string
          default: None
          example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
          description: "A base64 encoded string to fetch the previous page of the paginated result."
        subchild:
          type: string
          default: True
          example: True
          enum:
            - True
            - False
          description: "If False is passed then same level will be returned, and if True is passed or this parameter is not passed then the whole hierarchy will be returned"
        sorting:
          type: string
          default: ProvisionedOn
          example: ProvisionedOn
          enum:
            - SerialNumber
            - ProvisionedOn
            - DeviceType
          description: "Default sorting would be based on ProvisionedOn"
        filters:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
                enum:
                  - DeviceType
                  - SerialNumber
              condition:
                type: string
                enum:
                  - Equals
                  - Contains
              value:
                type: string
                maximum: 32

# Get Device Response

    GetDevicesResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            devices:
              type: array
              description: The list of devices belonging directly to the company.
              items:
                type: object
                properties:
                  companyId:
                    type: string
                    description: The current company or the requested company's id.
                  companyName:
                    type: string
                    description: The current company or the requested company's id.
                  deviceId:
                    type: string
                    description: "The device's unique id"
                    example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
                  deviceType:
                    type: string
                    enum:
                      - "Mag8000-4G"
                      - "Mag8000-LoRa"
                      - "CC220"
                      - "MS200"
                      - "IoTRadar"
                      - "Mag8000-Flex"
                      - "Mag8000-LoRaGateway"
                    example: "Mag8000-4G"
                    description: "The type of the device"
                  serialNumber:
                    type: string
                    description: "Serial number of device"
                    example: "4CE0460D0G"
                  iccid:
                    type: string
                    description: "The id for MAG 4G devices"
                    example: "4CE0460D0G"
                  deveui:
                    type: string
                    description: "The id for MAG LORA devices"
                    example: "4CE0460D0G"
                  macAddress:
                    type: string
                    description: "MAC Address of the device"
                    example: "00-B0-D0-63-C2-26"
                  imei:
                    type: string
                    description: The device's IMEI number
                    example: "355882069673699"
                  mlfb:
                    type: string
                    description: The device's MLFB number
                    example: "3VA6225-6HN31-0DK0"
                  claimedStatus:
                    type: string
                    description: "The device's claimed status"
                    enum:
                      - "CLAIMED"
                      - "UNCLAIMED"
                    example: "CLAIMED"
                  connectivityStatus:
                    type: string
                    description: The device's status.
                    enum:
                      - "CONNECTED"
                      - "DISCONNECTED"
                      - "NEVERSEEN"
                    example: "CONNECTED"
                  claimedOn:
                    type: string
                    example: 
                    description: Timestamp of when the device was claimed.
                  provisionedOn:
                    type: string
                    example: 
                    description: Timestamp of when the device was provisioned/registered.
                  lastConnectedOn:
                    type: string
                    description: Timestamp of last communication with the device.
                  currentFirmwareVersion:
                    type: string
                    example: "01.00.00"
                    description: Device Current Firmware Version.
                  rolledoutFirmwareStatus:
                    type: string
                    enum:
                    - rolled_out
                    - queued
                    - download_started
                    - download_successful
                    - download_failed
                    - installation_started
                    - installation_failed
                    - installation_complete
                    example: "rolled_out"
                    description: Device Rolledout Firmware Status.
                  rolledoutFirmwareVersion:
                    type: string
                    example: "02.00.00"
                    description: Device RolledOut Firmware Version.
            totalDeviceCount:
              type: integer
              description: The total number of devices.
              example: 550
            page_size:
              type: integer
              example: 15
              default: 15
              enum:
                - 15
                - 30
                - 50
              description: "Optional. The maximum of values to fetch. Will add a 'NextToken' key to fetch the next page. Defaults to 15"
            fetch_last:
              type: string
              example: True
              enum:
                - True
                - False
              description: Pass true if need to fetch the last page
            next_token:
              type: string
              default: None
              example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
              description: "A base64 encoded string to fetch the next page of the paginated result."
            previous_token:
              type: string
              default: None
              example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
              description: "A base64 encoded string to fetch the previous page of the paginated result."
            subchild:
              type: string
              default: True
              example: True
              enum:
                - True
                - False
              description: "If False is passed then same level will be returned, and if True is passed or this parameter is not passed then the whole hierarchy will be returned"
            sorting:
              type: string
              default: SerialNumber
              example: SerialNumber
              enum:
                - SerialNumber
                - DeviceType
              description: "Default sorting would be based on SerialNumber"
            filters:
              type: array
              items:
                type: object
                properties:
                  key:
                    type: string
                    enum:
                      - DeviceType
                      - SerialNumber
                  condition:
                    type: string
                    enum:
                      - Equals
                      - Contains
                  value:
                    type: string

# Get a device response

    GetOneDeviceResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            companyId:
              type: string
              description: The current company or the requested company's id.
            companyName:
              type: string
              description: The current company or the requested company's id.
            deviceId:
              type: string
              description: "The device's unique id"
              example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
            deviceType:
              type: string
              enum:
                - "Mag8000-4G"
                - "Mag8000-LoRa"
                - "CC220"
                - "MS200"
                - "IoTRadar"
                - "Mag8000-Flex"
                - "Mag8000-LoRaGateway"
              example: "Mag8000-4G"
              description: "The type of the device"
            serialNumber:
              type: string
              description: "Serial number of device"
              example: "4CE0460D0G"
            iccid:
              type: string
              description: "The id for MAG 4G devices"
              example: "4CE0460D0G"
            deveui:
              type: string
              description: "The id for MAG LORA devices"
              example: "4CE0460D0G"
            macAddress:
              type: string
              description: "MAC Address of the device"
              example: "00-B0-D0-63-C2-26"
            imei:
              type: string
              description: The device's IMEI number
              example: "355882069673699"
            mlfb:
              type: string
              description: The device's MLFB number
              example: "3VA6225-6HN31-0DK0"
            claimedStatus:
              type: string
              description: "The device's claimed status"
              enum:
                - "CLAIMED"
                - "UNCLAIMED"
              example: "CLAIMED"
            connectivityStatus:
              type: string
              description: The device's status.
              enum:
                - "CONNECTED"
                - "DISCONNECTED"
                - "NEVERSEEN"
              example: "CONNECTED"
            claimedOn:
              type: string
              example: 
              description: Timestamp of when the device was claimed.
            provisionedOn:
              type: string
              example: 
              description: Timestamp of when the device was provisioned/registered.
            lastConnectedOn:
              type: string
              description: Timestamp of last communication with the device.
            currentFirmwareVersion:
              type: string
              example: "01.00.00"
              description: Device Current Firmware Version.

# Delete Device Response

    DeleteDeviceResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            message:
              type: string

#Telemetry Data Response

    GetMeasurementDataResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            deviceId:
              type: string
              description: "The device's unique id"
              example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
            nextToken:
              type: string
              example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
              description: A base64 encoded token to fetch the next page of the paginated result, until the last results have been fetched.
            values:
              type: array
              items:
                type: object
                properties:
                  messageNumber:
                    type: integer
                    description: The order of the message in the payload.
                  collectedTimestamp:
                    type: string
                    description: Timestamp when the message was collected in the module.
                  attributes:
                    type: array
                    items:
                      type: object
                      properties:
                        attributeName:
                          type: string
                          description: "name of attribute"
                          example: "BatteryCapacity"
                        attributeValue:
                          type: string
                          description: "Value of attribute"
                          example: "20"
 

    GetLatestMeasurementDataResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            deviceId:
              type: string
              description: "The device's unique id"
              example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
            collectedTimestamp:
              type: string
              description: Timestamp when the message was collected in the module.
            attributes:
              type: array
              items:
                type: object
                properties:
                  attributeName:
                    type: string
                    description: "name of attribute"
                    example: "BatteryCapacity"
                  attributeValue:
                    type: string
                    description: "Value of attribute"
                    example: "20"

# Get Alarms Response

    GetCompanyAlarmsResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            companyId:
              type: string
              description: The company_id requested for alarms devices.
            devices:
              type: array
              description: Default sorting will be based on collectedTimestamp
              items:
                type: object
                properties:
                  deviceId:
                    type: string
                    description: "The device's unique id"
                    example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
                  alarms:
                    type: array
                    items:
                      type: object
                      properties:
                        collectedTimestamp:
                          type: string
                          description: Timestamp when the alarm was raised in the module.
                        alarmID:
                          type: string
                          description: Alarm ID.
                        alarmType:
                          type: string
                          description: Alarm Category.
                          enum:
                            - ModuleAlarms
                            - HostDeviceAlarms
                            - OtherAlarmType
                        alarmStatus:
                          type: string
                          description: Alarm Status.
                          enum:
                            - Active
                            - Reset
                          example: Active
                        alarmDescription:
                          type: string
                          description: Alarm description.
            page_size:
              type: integer
              example: 15
              default: 15
              enum:
                - 15
                - 30
                - 50
              description: "Optional. The maximum of values to fetch. Will add a 'NextToken' key to fetch the next page. Defaults to 15"
            next_token:
              type: string
              default: None
              example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
              description: "A base64 encoded string to fetch the next page of the paginated result."
            previous_token:
              type: string
              default: None
              example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
              description: "A base64 encoded string to fetch the previous page of the paginated result."
            from_date_time:
              type: string
              example: "YYYY-MM-DDThh:mm:ssTZD"
              default: None
              description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
            to_date_time:
              type: string
              example: "YYYY-MM-DDThh:mm:ssTZD"
              default: None
              description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"

    GetDeviceAlarmsResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            deviceId:
              type: string
              description: "The device's unique id"
              example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
            alarms:
              type: array
              description: Default sorting will be based on collectedTimestamp
              items:
                type: object
                properties:
                  collectedTimestamp:
                    type: string
                    description: Timestamp when the alarm was raised in the module.
                  alarmID:
                    type: string
                    description: Alarm ID.
                  alarmType:
                    type: string
                    description: Alarm Category.
                    enum:
                      - ModuleAlarms
                      - HostDeviceAlarms
                      - OtherAlarmType
                  alarmStatus:
                    type: string
                    description: Alarm Status.
                    enum:
                      - Active
                      - Reset
                    example: Active
                  alarmDescription:
                    type: string
                    description: Alarm description.
            page_size:
              type: integer
              example: 15
              default: 15
              enum:
                - 15
                - 30
                - 50
              description: "Optional. The maximum of values to fetch. Will add a 'NextToken' key to fetch the next page. Defaults to 15"
            next_token:
              type: string
              default: None
              example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
              description: "A base64 encoded string to fetch the next page of the paginated result."
            previous_token:
              type: string
              default: None
              example: "eyabcdefgegOIjlwPIJmqmlqjzIOPJkLQjfd"
              description: "A base64 encoded string to fetch the previous page of the paginated result."
            from_date_time:
              type: string
              example: "YYYY-MM-DDThh:mm:ssTZD"
              default: None
              description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"
            to_date_time:
              type: string
              example: "YYYY-MM-DDThh:mm:ssTZD"
              default: None
              description: "The date-time in the UTC format, user may pass just YYYY or YYYY-MM or YYYY-MM-DD or YYYY-MM-DDThh:mm:ssTZD"


# Device Parameter read write models
    
    DeviceParameterReadRequest:
      type: object
      required:
        - parameters
      properties:
        parameters:
          type: array
          minimum: 1
          maximum: 5
          items:
            type: string  
            minimum: 1
            maximum: 32
            example: "parameter_id"   
            description: "parameter unique id , Note:- Parameter details like parameter ID could be fetched using fetch all paramter API."
          example: ["parameter1_id","parameter2_id"] 

    DeviceParameterReadResponse:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              deviceId:
                type: string
                description: "The device's unique id"
                example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
              deviceType:
                type: string
                enum:
                  - "Mag8000-4G"
                  - "Mag8000-LoRa"
                  - "CC220"
                  - "MS200"
                  - "IoTRadar"
                  - "Mag8000-Flex"
                  - "Mag8000-LoRaGateway"
                example: "Mag8000-4G"
                description: "The type of the device"
              parameterId:
                type: string
                example: "phys_software_rev"
                description: "parameter unique id"
              status:
                type: string
                enum:
                  - Accepted
                  - InProgress
                example: "Accepted"
                description: On First hit status will be "Accepted" but if read is requested for a parameter for which previous read request is still pending then value of Status will be "InProgress"
        errors:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: "unique error id - uuid"
                example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
              code:
                type: string
                description: "unique error code"
                example: "FWENQ-0x00000001"
              title:
                type: string
                description: "Error title"
                example: "Bad Request"
              status:
                type: number
                description: "HTTP Status code"
                example: "400"
              details:
                type: string
                description: "error message"
                example: "Invalid Serial number"
              meta:
                type: object
                properties:
                  deviceId:
                    type: string
                    description: "The device's unique id"
                    example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
                  deviceType:
                    type: string
                    enum:
                      - "Mag8000-4G"
                      - "Mag8000-LoRa"
                      - "CC220"
                      - "MS200"
                      - "IoTRadar"
                      - "Mag8000-Flex"
                      - "Mag8000-LoRaGateway"
                    example: "Mag8000-4G"
                    description: "The type of the device"
                  parameterId:
                    type: string
                    example: "phys_software_rev"
                    description: "parameter unique id"
              correlationId:
                type: string
                description: "transaction unique id"
                example: "1-66f3a9dc-4924ac09759b99e51766d14d"


    DeviceParameterWriteRequest:
      type: object
      required:
        - parameters
      properties:
        parameters:
          type: array
          minimum: 1
          maximum: 5
          items:
            type: object  
            required:
              - parameterId
              - parameterValue
            properties:
              parameterId:
                type: string
                minimum: 1
                maximum: 32
                example: "phys_software_rev"
                description: "parameter unique id, Note:- Parameter details like parameter ID could be fetched using fetch all paramter API."
              parameterValue:
                type: string
                minimum: 1
                maximum: 32
                example: "01.00.02-52"
                description: "parameter value"


    DeviceParameterWriteResponse:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              deviceId:
                type: string
                description: "The device's unique id"
                example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
              deviceType:
                type: string
                enum:
                  - "Mag8000-4G"
                  - "Mag8000-LoRa"
                  - "CC220"
                  - "MS200"
                  - "IoTRadar"
                  - "Mag8000-Flex"
                  - "Mag8000-LoRaGateway"
                example: "Mag8000-4G"
                description: "The type of the device"
              parameterId:
                type: string
                example: "phys_software_rev"
                description: "parameter unique id"
              parameterValue:
                type: string
                example: "01.00.02-52"
                description: "parameter value"
              status:
                type: string
                enum:
                  - Accepted
                  - InProgress
                example: "Accepted"
                description: On First hit status will be "Accepted" but if read is requested for a parameter for which previous read request is still pending then value of Status will be "InProgress"
        errors:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: "unique error id - uuid"
                example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
              code:
                type: string
                description: "unique error code"
                example: "FWENQ-0x00000001"
              title:
                type: string
                description: "Error title"
                example: "Bad Request"
              status:
                type: number
                description: "HTTP Status code"
                example: "400"
              details:
                type: string
                description: "error message"
                example: "Invalid Serial number"
              meta:
                type: object
                properties:
                  deviceId:
                    type: string
                    description: "The device's unique id"
                    example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
                  deviceType:
                    type: string
                    enum:
                      - "Mag8000-4G"
                      - "Mag8000-LoRa"
                      - "CC220"
                      - "MS200"
                      - "IoTRadar"
                      - "Mag8000-Flex"
                      - "Mag8000-LoRaGateway"
                    example: "Mag8000-4G"
                    description: "The type of the device"
                  parameterId:
                    type: string
                    example: "phys_software_rev"
                    description: "parameter unique id"
                  parameterValue:
                    type: string
                    example: "01.00.02-52"
                    description: "parameter value"
              correlationId:
                type: string
                description: "transaction unique id"
                example: "1-66f3a9dc-4924ac09759b99e51766d14d"


    GetAllDeviceParametersResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            deviceId:
              type: string
              description: "The device's unique id"
              example: "3c987a69-d7cc-49ad-ae91-c94003b78f16"
            parameters:
              type: array
              items:
                type: object
                properties:
                  parameterId:
                    type: string
                    example: "phys_software_rev"
                    description: "parameter unique id"
                  values:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          example: "ParameterName"
                        value:
                          type: string
                          example: "param_name"

# Device KPI Response

    DeviceKPIResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            totalDeviceCount:
              type: integer
              description: The total number of devices.
              example: 550
            onlineDeviceCount:
              type: integer
              description: The number of devices that are online.
              example: 400
            offlineDeviceCount:
              type: integer
              description: The number of devices that are offline.
              example: 150


# Error Responses 

  responses:
    400Error:
      description: Invalid request
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: "unique error id - uuid"
                      example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
                    code:
                      type: string
                      description: "unique error code"
                      example: "FWENQ-0x00000001"
                    title:
                      type: string
                      description: "Error title"
                      example: "Bad Request"
                    status:
                      type: number
                      description: "HTTP Status code"
                      example: "400"
                    details:
                      type: string
                      description: "error message"
                      example: "Invalid Serial number"
                    meta:
                      type: object
                    correlationId:
                      type: string
                      description: "transaction unique id"
                      example: "1-66f3a9dc-4924ac09759b99e51766d14d"


    500Error:
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: "unique error id - uuid"
                      example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
                    code:
                      type: string
                      description: "unique error code"
                      example: "FWENQ-0x00000001"
                    title:
                      type: string
                      description: "Error title"
                      example: "Internal Server Error"
                    status:
                      type: number
                      description: "HTTP Status code"
                      example: "500"
                    details:
                      type: string
                      description: "error message"
                      example: "Internal Server Error"
                    meta:
                      type: object
                    correlationId:
                      type: string
                      description: "transaction unique id"
                      example: "1-66f3a9dc-4924ac09759b99e51766d14d"

    405Error:
      description: Invalid Method
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: "unique error id - uuid"
                      example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
                    code:
                      type: string
                      description: "unique error code"
                      example: "FWENQ-0x00000001"
                    title:
                      type: string
                      description: "Error title"
                      example: "Invalid Method"
                    status:
                      type: number
                      description: "HTTP Status code"
                      example: "405"
                    details:
                      type: string
                      description: "error message"
                      example: "POST id Invalid Method"
                    meta:
                      type: object
                    correlationId:
                      type: string
                      description: "transaction unique id"
                      example: "1-66f3a9dc-4924ac09759b99e51766d14d"

    401Error:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: "unique error id - uuid"
                      example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
                    code:
                      type: string
                      description: "unique error code"
                      example: "FWENQ-0x00000001"
                    title:
                      type: string
                      description: "Error title"
                      example: "Unauthorized"
                    status:
                      type: number
                      description: "HTTP Status code"
                      example: "401"
                    details:
                      type: string
                      description: "error message"
                      example: "Unauthorized user credentials"
                    meta:
                      type: object
                    correlationId:
                      type: string
                      description: "transaction unique id"
                      example: "1-66f3a9dc-4924ac09759b99e51766d14d"

    403Error:
      description: Forbidden
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: "unique error id - uuid"
                      example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
                    code:
                      type: string
                      description: "unique error code"
                      example: "FWENQ-0x00000001"
                    title:
                      type: string
                      description: "Error title"
                      example: "Forbidden"
                    status:
                      type: number
                      description: "HTTP Status code"
                      example: "403"
                    details:
                      type: string
                      description: "error message"
                      example: "Access is Forbidden"
                    meta:
                      type: object
                    correlationId:
                      type: string
                      description: "transaction unique id"
                      example: "1-66f3a9dc-4924ac09759b99e51766d14d"

    404Error:
      description: Not Found
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: "unique error id - uuid"
                      example: "f8b7f2e1-098c-4541-8473-4a0a6d7dac91"
                    code:
                      type: string
                      description: "unique error code"
                      example: "FWENQ-0x00000001"
                    title:
                      type: string
                      description: "Error title"
                      example: "Not Found"
                    status:
                      type: number
                      description: "HTTP Status code"
                      example: "404"
                    details:
                      type: string
                      description: "error message"
                      example: "Requested resource is not found"
                    meta:
                      type: object
                    correlationId:
                      type: string
                      description: "transaction unique id"
                      example: "1-66f3a9dc-4924ac09759b99e51766d14d"