# This code is auto generated, at src/scripts/generate-docs with the version 2.0.0 do NOT alter it directly

swagger: '2.0'
info:
  title: Service Manager API
  version: 0.1.0
basePath: /api
schemes:
  - https
produces:
  - application/json
consumes:
  - application/json
paths:
  /validate/service:
    post:
      security:
        - ApiKeyHeader: []
      tags:
        - validation
      summary: validate a commissioning file
      operationId: validateCommissioningFile
      parameters:
        - in: body
          name: body
          description: validate a commissioning file
          required: true
          schema:
            $ref: '#/definitions/ValidatePostServiceRequest'
      responses:
        '200':
          description: Validation Successful
        '400':
          description: Validation Error
          schema:
            type: array
            items:
              $ref: '#/definitions/ValidationError'
        '406':
          description: Invalid Content
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  $ref: '#/definitions/ParserError'
              message:
                type: string
                enum:
                  - the provided commissioning file contains errors
            required:
              - errors
              - message
  /services:
    post:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Create a new service
      operationId: createService
      parameters:
        - in: body
          name: body
          description: Service to be created
          required: true
          schema:
            $ref: '#/definitions/ServicePostRequest'
      responses:
        '201':
          description: Created service
          schema:
            $ref: '#/definitions/ServicePostResult'
        '400':
          description: Validation Error
          schema:
            type: array
            items:
              $ref: '#/definitions/ValidationError'
        '406':
          description: Invalid Content
          schema:
            type: object
            properties:
              code:
                type: string
                enum:
                  - InvalidContent
              message:
                type: string
                example: 'Error in commissioning file: ParserError[]'
            required:
              - code
              - message
        '409':
          description: Conflict with service current state
          schema:
            type: object
            properties:
              code:
                type: string
                enum:
                  - Conflict
              message:
                type: string
                example: >-
                  Service 'servicea1' is still being removed from the system.
                  Try again in X ms
            required:
              - code
              - message
        '500':
          description: Internal Server Error
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Read all services
      operationId: getServicesV1
      responses:
        '301':
          description: Permanent Redirect
          headers:
            Location:
              type: string
              description: The new endpoint URL
  /services/parametersSchema:
    post:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get the service schemas
      operationId: getServiceSchemas
      parameters:
        - in: body
          name: body
          description: Get the service parameters schemas
          required: true
          schema:
            $ref: '#/definitions/ServicePostSchemasRequest'
      responses:
        '201':
          description: Service schemas
          schema:
            $ref: '#/definitions/ServiceSchemas'
        '400':
          description: Validation Error
          schema:
            type: array
            items:
              $ref: '#/definitions/ValidationError'
        '406':
          description: Invalid Content
          schema:
            $ref: '#/definitions/ValidationError'
  /services/{id}/deletion-status:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: >-
        Return the remaining time in milliseconds until the service can be
        installed
      operationId: getServiceDeletionStatusV1
      parameters:
        - name: id
          in: path
          description: Id of the service
          minLength: 4
          type: string
          required: true
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              serviceID:
                type: string
                description: Id of the service
              deletionIsComplete:
                type: boolean
                description: >-
                  Indicates if service was completely removed and can be
                  installed again
              remainingTimeInMs:
                type: number
                description: >-
                  Ms until service is completely removed. 0 if it's already
                  removed
            required:
              - serviceID
              - deletionIsComplete
              - remainingTimeInMs
        '500':
          description: Internal Error while fetching service deletion status
          schema:
            type: object
            properties:
              code:
                type: string
              message:
                type: string
                example: >-
                  GET /api/services/:id/deletion-status ERROR (service
                  'serviceA'): Something went wrong
            required:
              - code
              - message
  /services/{id}:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get a specific service
      operationId: getServiceV1
      responses:
        '301':
          description: Permanent Redirect
          headers:
            Location:
              type: string
              description: The new endpoint URL
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Update an existing service
      operationId: updateServiceV1
      responses:
        '308':
          description: Permanent Redirect
          headers:
            Location:
              type: string
              description: The new endpoint URL
    delete:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Delete an existing service
      operationId: deleteService
      parameters:
        - name: id
          in: path
          description: Id of service
          minLength: 4
          type: string
          required: true
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              id:
                type: string
                description: The id of the deleted service
            required:
              - id
        '400':
          description: Service not found
          schema:
            type: object
            properties:
              code:
                type: string
              message:
                type: string
                example: Service with id 'SERVICE_ID' doesn't exist
            required:
              - code
              - message
  /services/{id}/dependencies:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get the service dependencies
      operationId: getServiceDependencies
      parameters:
        - name: id
          in: path
          description: Id of service
          type: string
          required: true
      responses:
        '200':
          description: Service dependencies
          schema:
            $ref: '#/definitions/ServiceDependencies'
        '404':
          description: Service not found
  /services/ingress-routes:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get all ingress routes
      operationId: getIngressRoutes
      responses:
        '200':
          description: Ingress routes
          schema:
            type: array
            items:
              $ref: '#/definitions/IngressRoute'
        '400':
          description: Invalid request
  /services/links:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - links
      summary: Get all Cybus::Link routes
      operationId: getLinks
      responses:
        '200':
          description: Links
          schema:
            type: array
            items:
              $ref: '#/definitions/Link'
        '400':
          description: Invalid request
  /services/all-links:
    get:
      tags:
        - services
        - links
      summary: Get all links by all services
      operationId: getAllLinks
      parameters:
        - name: onlyFromEnabledServices
          description: Only list on the response resources from enabled services
          type: boolean
          in: query
          default: true
      responses:
        '200':
          description: Links
          schema:
            type: array
            items:
              $ref: '#/definitions/LinkedService'
      security:
        - ApiKeyHeader: []
  /services/{id}/operation:
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Perform an operation on a service
      operationId: execute
      parameters:
        - name: id
          in: path
          description: Id of service
          type: string
          required: true
        - name: body
          in: body
          description: Operation to perform
          required: true
          schema:
            $ref: '#/definitions/ServiceOperationRequest'
      responses:
        '200':
          description: Service
          schema:
            $ref: '#/definitions/Service'
        '400':
          description: Invalid request
        '404':
          description: Service not found
  /resources/runners/{id}:
    delete:
      security:
        - ApiKeyHeader: []
      tags:
        - resource-runners
      summary: Delete specific resource runner
      operationId: deleteResourcesRunner
      parameters:
        - name: id
          in: path
          description: Id of resource runner
          type: string
          required: true
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/ResourcesRunner'
        '400':
          description: Invalid request
  /resources/schemas:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get all of the resource schemas
      operationId: getResourceSchemas
      responses:
        '200':
          description: Resource schemas in a JSON string
          schema:
            $ref: '#/definitions/AllSchemas'
        '500':
          description: Internal error
    post:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Store resources schemas
      operationId: postResourceSchemas
      parameters:
        - in: body
          name: body
          description: Add resources schemas
          required: true
          schema:
            $ref: '#/definitions/ResourcePostSchemasRequest'
      responses:
        '201':
          description: Resource schemas stored
        '400':
          description: Invalid request
  /v2/services:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Read all services
      operationId: getServices
      parameters:
        - name: searchText
          description: The value used to retrieve services by matching service ID or name
          in: query
          type: string
          required: false
          minLength: 3
        - name: page
          description: Page to return
          in: query
          type: integer
          minimum: 1
          default: 1
        - name: itemsPerPage
          description: Number of items per page
          in: query
          type: integer
          minimum: 1
          maximum: 100
          default: 50
        - name: orderBy
          description: Order response by field
          type: string
          in: query
          enum:
            - serviceId
            - name
            - currentState
            - version
            - createdAt
            - targetState
            - updatedAt
          default: serviceId
        - name: order
          description: Ascending or descending order
          type: string
          in: query
          enum:
            - ASC
            - DESC
          default: ASC
      responses:
        '200':
          description: Array of services
          schema:
            $ref: '#/definitions/JsonApiServiceListEnvelope'
        '500':
          description: Internal Server Error
  /v2/services/stats/count:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get the number of installed Services
      operationId: getServiceCounts
      responses:
        '200':
          description: Number of installed Services
          schema:
            $ref: '#/definitions/JsonApiStatsServicesCountEnvelope'
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/JSONAPIError'
  /v2/services/ids:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: >-
        Get paginated list of service IDs for all Services order
        lexicographically Ascending
      operationId: getServiceIDs
      parameters:
        - name: page
          description: Page to return
          in: query
          type: integer
          minimum: 1
          default: 1
        - name: itemsPerPage
          description: Number of items per page
          in: query
          type: integer
          minimum: 1
          maximum: 100
          default: 50
      responses:
        '200':
          description: >-
            Get paginated list of service IDs for all Services order
            lexicographically Ascending
          schema:
            $ref: '#/definitions/JsonApiServiceIds'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/JSONAPIError'
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/JSONAPIError'
  /v2/services/{id}:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get a specific service
      operationId: getService
      parameters:
        - name: id
          in: path
          description: Id of service
          type: string
          required: true
      responses:
        '200':
          description: Service
          schema:
            $ref: '#/definitions/JsonApiServiceDetailsEnvelope'
        '404':
          description: Service not found
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Update an existing service
      operationId: updateService
      parameters:
        - in: path
          description: Id of service
          name: id
          required: true
          type: string
        - in: body
          name: body
          description: Data required for updating a service
          schema:
            $ref: '#/definitions/UpdateServiceRequest'
      responses:
        '202':
          description: Accepted
          schema:
            $ref: '#/definitions/JsonApiServiceUpdateEnvelope'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/JSONAPIError'
        '406':
          description: Invalid Content
          schema:
            $ref: '#/definitions/JSONAPIParserError'
  /v2/services/{id}/serviceCommissioningFile:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
      summary: Get ServiceCommissioningFile for specific service
      operationId: getServiceCommissioningFile
      parameters:
        - name: id
          in: path
          description: Id of service
          type: string
          required: true
      responses:
        '200':
          description: SCF
          schema:
            $ref: '#/definitions/JsonApiServiceCommissioningFileEnvelope'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/JSONAPIError'
        '404':
          description: Service not found
          schema:
            $ref: '#/definitions/JSONAPIError'
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/JSONAPIError'
  /v2/services/{serviceId}/resources:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - services
        - resources
      summary: Read resources by for service
      operationId: getResourcesByService
      parameters:
        - name: serviceId
          in: path
          description: Id of service
          type: string
          required: true
        - name: categories
          in: query
          description: Resource categories (multiple allowed)
          type: array
          collectionFormat: multi
          items:
            type: string
            enum:
              - Connection
              - Container
              - Endpoint
              - File
              - IngressRoute
              - Link
              - Mapping
              - Node
              - Role
              - Server
              - User
              - Volume
        - name: runnerName
          in: query
          description: filter by runner name
          type: string
          minLength: 3
        - name: parentResourceId
          in: query
          description: filter by parentResourceId
          type: string
          minLength: 3
        - name: searchText
          description: >-
            The value used to retrieve service resources by matching resource
            name
          in: query
          type: string
          required: false
          minLength: 3
        - name: page
          description: Page to return
          in: query
          type: integer
          minimum: 1
          default: 1
        - name: itemsPerPage
          description: Number of items per page
          in: query
          type: integer
          minimum: 1
          maximum: 100
          default: 50
        - name: orderBy
          description: Order response by field
          type: string
          in: query
          enum:
            - resourceId
            - runnerName
            - protocol
            - parentResourceId
            - category
            - connectwareServiceUuid
            - resourceName
            - serviceId
          default: resourceId
        - name: order
          description: Ascending or descending order
          type: string
          in: query
          enum:
            - ASC
            - DESC
          default: ASC
        - name: onlyFromEnabledServices
          description: Only list on the response resources from enabled services
          type: boolean
          in: query
          default: false
      responses:
        '200':
          description: Array of services
          schema:
            $ref: '#/definitions/JsonApiResourceListEnvelope'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/JSONAPIError'
        '500':
          description: Internal Server Error
  /v2/resources:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - resources
      summary: Read all resources
      operationId: getResources
      parameters:
        - name: categories
          in: query
          description: Resource categories (multiple allowed)
          type: array
          collectionFormat: multi
          items:
            type: string
            enum:
              - Connection
              - Container
              - Endpoint
              - File
              - IngressRoute
              - Link
              - Mapping
              - Node
              - Role
              - Server
              - User
              - Volume
        - name: runnerName
          description: Resource runner name
          in: query
          type: string
          minLength: 3
        - name: parentResourceId
          description: Filter by parent of requested resources
          in: query
          type: string
          minLength: 3
        - name: searchText
          description: >-
            The value used to retrieve services resources by matching resource
            name
          in: query
          type: string
          required: false
          minLength: 3
        - name: page
          description: Page to return
          in: query
          type: integer
          minimum: 1
          default: 1
        - name: itemsPerPage
          description: Number of items per page
          in: query
          type: integer
          minimum: 1
          maximum: 100
          default: 50
        - name: orderBy
          description: Order response by field
          type: string
          in: query
          enum:
            - resourceId
            - runnerName
            - protocol
            - parentResourceId
            - category
            - connectwareServiceUuid
            - resourceName
            - serviceId
          default: resourceId
        - name: order
          description: Ascending or descending order
          type: string
          in: query
          enum:
            - ASC
            - DESC
          default: ASC
        - name: onlyFromEnabledServices
          description: Only list on the response resources from enabled services
          type: boolean
          in: query
          default: false
      responses:
        '200':
          description: Array of resources
          schema:
            $ref: '#/definitions/JsonApiResourceListEnvelope'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/JSONAPIError'
        '500':
          description: Internal Server Error
  /v2/resources/{resourceId}:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - resources
      summary: Read a specific resource
      operationId: getResource
      parameters:
        - name: resourceId
          in: path
          description: Id of resource
          type: string
          required: true
      responses:
        '200':
          description: Resource
          schema:
            $ref: '#/definitions/JsonApiResourceEnvelope'
        '404':
          description: Resource not found
        '500':
          description: Internal Server Error
  /v2/resources/{resourceId}/operation:
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - resources
      summary: Update an existing resources
      operationId: updateResourceState
      parameters:
        - name: resourceId
          in: path
          description: Id of resource
          type: string
          required: true
        - in: body
          name: body
          description: Operation to perform on the resource
          required: true
          schema:
            $ref: '#/definitions/ResourceOperationRequest'
      responses:
        '200':
          description: Success
        '400':
          description: Invalid request
        '500':
          description: Internal Server Error
  /v2/services/{serviceId}/topics:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - topics
      summary: Get available topics for service ID
      operationId: getTopicsForServiceId
      parameters:
        - name: serviceId
          in: path
          description: Id of service to list topics for
          type: string
          required: true
        - name: page
          description: Page to return
          in: query
          type: integer
          minimum: 1
          default: 1
        - name: itemsPerPage
          description: Number of items per page
          in: query
          type: integer
          minimum: 1
          maximum: 100
          default: 50
        - name: orderBy
          description: Order response by field
          type: string
          in: query
          enum:
            - resourceId
            - category
            - serviceId
          default: resourceId
        - name: order
          description: Ascending or descending order
          type: string
          in: query
          enum:
            - ASC
            - DESC
          default: ASC
        - name: categories
          in: query
          description: Resource categories (multiple allowed)
          type: array
          collectionFormat: multi
          items:
            type: string
            enum:
              - Endpoint
              - Mapping
              - Node
        - name: searchText
          description: >-
            The value used to retrieve topics by matching resource name or
            resource ID
          in: query
          type: string
          required: false
        - name: onlyFromEnabledServices
          description: Only list on the response topics from enabled service
          type: boolean
          in: query
          default: false
      responses:
        '200':
          description: Paginated list of topics
          schema:
            $ref: '#/definitions/JsonApiTopicListEnvelope'
        '400':
          description: Parameter missing
        '404':
          description: No topics found
        '500':
          description: Internal Server Error
  /v2/topics/resources:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - topics
      summary: Get available topics for resources
      operationId: getTopics
      parameters:
        - name: ids
          in: query
          description: The resource IDs to filter by (multiple allowed)
          type: array
          collectionFormat: multi
          items:
            type: string
        - name: categories
          in: query
          description: The resource categories to filter by (multiple allowed)
          type: array
          collectionFormat: multi
          items:
            type: string
            enum:
              - Endpoint
              - Mapping
              - Node
        - name: page
          description: Page to return
          in: query
          type: integer
          minimum: 1
          default: 1
        - name: itemsPerPage
          description: Number of items per page
          in: query
          type: integer
          minimum: 1
          maximum: 100
          default: 50
        - name: orderBy
          description: Order response by field
          type: string
          in: query
          enum:
            - resourceId
            - category
            - serviceId
          default: resourceId
        - name: order
          description: Ascending or descending order
          type: string
          in: query
          enum:
            - ASC
            - DESC
          default: ASC
        - name: searchText
          description: >-
            The value used to retrieve topics by matching resource name or
            resource ID or service ID
          in: query
          type: string
          required: false
        - name: onlyFromEnabledServices
          description: Only list on the response topics from enabled services
          type: boolean
          in: query
          default: false
      responses:
        '200':
          description: Paginated list of topics
          schema:
            $ref: '#/definitions/JsonApiTopicListEnvelope'
        '400':
          description: Parameter missing
        '404':
          description: No topics found
        '500':
          description: Internal Server Error
  /v2/service-graph/adjacency-matrix:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - service-graph
      summary: Get adjacency matrix of services
      operationId: getAdjacencyMatrix
      responses:
        '200':
          description: List of service relationships
          schema:
            $ref: '#/definitions/AdjecencyMatrix'
        '500':
          description: Internal Server Error
  /v2/service-graph/root-nodes:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - service-graph
      summary: Get all root nodes, i.e. all nodes which have no dependencies
      operationId: getRootNodes
      responses:
        '200':
          description: List of root nodes
          schema:
            $ref: '#/definitions/NodeList'
        '500':
          description: Internal Server Error
  /v2/service-graph/dependencies:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - service-graph
      summary: Get all dependencies of a list of services
      operationId: getAllDependencies
      parameters:
        - name: serviceIds
          in: query
          description: List of service to get dependencies for
          type: string
          required: true
        - name: distance
          in: query
          description: >-
            Configures how many hops to return, e.g. 1 for direct dependencies
            only, 2 to return until dependencies of dependencies, etc.
          type: integer
      responses:
        '200':
          description: List of dependencies
          schema:
            $ref: '#/definitions/NodeList'
        '500':
          description: Internal Server Error
  /v2/service-graph/dependencies/count:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - service-graph
      summary: Get number of dependencies of a service
      operationId: getNumberOfDependencies
      parameters:
        - name: serviceId
          in: query
          description: Id of service to get dependencies for
          type: string
          required: true
        - name: distance
          in: query
          description: >-
            Configures how many hops to return, e.g. 1 for direct dependencies
            only, 2 to return until dependencies of dependencies, etc.
          type: integer
      responses:
        '200':
          description: Number of dependencies
          type: string
        '500':
          description: Internal Server Error
  /v2/service-graph/dependents:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - service-graph
      summary: Get all dependents of a list services
      operationId: getAllDependents
      parameters:
        - name: serviceIds
          in: query
          description: List of services to get dependents for
          type: string
          required: true
        - name: distance
          in: query
          description: >-
            Configures how many hops to return, e.g. 1 for direct dependents
            only, 2 to return until dependents of dependents, etc.
          type: integer
      responses:
        '200':
          description: List of dependencies
          schema:
            $ref: '#/definitions/NodeList'
        '500':
          description: Internal Server Error
  /v2/service-graph/dependents/count:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - service-graph
      summary: Get number of dependents of a service
      operationId: getNumberOfDependents
      parameters:
        - name: serviceId
          in: query
          description: Id of service to get dependents for
          type: string
          required: true
        - name: distance
          in: query
          description: >-
            Configures how many hops to return, e.g. 1 for direct dependents
            only, 2 to return until dependents of dependents, etc.
          type: integer
      responses:
        '200':
          description: Number of dependents
          type: string
        '500':
          description: Internal Server Error
  /v2/resources/count/{category}:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - resources
      summary: Get count of resources by category
      operationId: getResourceCategoryCount
      parameters:
        - name: category
          in: path
          description: Resource Category
          type: string
          required: true
          enum:
            - Connection
            - Container
            - Endpoint
            - File
            - IngressRoute
            - Link
            - Mapping
            - Node
            - Role
            - Server
            - User
            - Volume
      responses:
        '200':
          description: Resource
          schema:
            $ref: '#/definitions/JsonApiResourceCountPerCategoryEnvelope'
        '400':
          description: Invalid Resource Category provided
          schema:
            $ref: '#/definitions/JSONAPIError'
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/JSONAPIError'
securityDefinitions:
  ApiKeyHeader:
    type: apiKey
    in: header
    name: Authorization
definitions:
  Service:
    type: object
    properties:
      serviceId:
        type: string
        example: myService
      name:
        type: string
        example: My Service
      version:
        type: string
        example: v1.2.3
      targetState:
        type: string
        example: enabled
      currentState:
        type: string
        example: disabled
      createdAt:
        type: string
        example: 2025-03-06T22:13:43.065Z
      updatedAt:
        type: string
        example: 2025-03-06T22:13:43.065Z
    required:
      - createdAt
      - currentState
      - name
      - serviceId
      - targetState
      - updatedAt
      - version
  JsonApiServiceCommissioningFile:
    type: object
    properties:
      parameters_schema:
        type: object
        additionalProperties: true
      scf:
        type: string
    required:
      - scf
      - parameters_schema
  JsonApiServiceCommissioningFileEnvelope:
    type: object
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      data:
        $ref: '#/definitions/JsonApiServiceCommissioningFile'
      meta:
        type: object
        example: {}
    required:
      - data
      - jsonapi
      - meta
  JsonApiServiceUpdateEnvelope:
    type: object
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      meta:
        type: object
        example: {}
    required:
      - jsonapi
      - meta
  JsonApiServiceDetailsEnvelope:
    type: object
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      data:
        $ref: '#/definitions/ServiceDetails'
      meta:
        type: object
        example: {}
    required:
      - data
      - jsonapi
      - meta
  JsonApiStatsServicesCountEnvelope:
    type: object
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      data:
        type: object
        properties:
          servicesCount:
            type: integer
            example: 1000
        required:
          - servicesCount
      meta:
        type: object
        example: {}
    required:
      - data
      - jsonapi
      - meta
  JsonApiServiceIds:
    type: object
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      data:
        type: array
        items:
          type: string
          example: myService
        required:
          - data
      meta:
        properties:
          pagination:
            $ref: '#/definitions/pagination'
        required:
          - pagination
    required:
      - data
      - jsonapi
      - meta
  ServiceDetails:
    type: object
    properties:
      connectwareServiceUuid:
        type: string
        example: 81a6c550-fad5-11ef-a38c-0242ac120006
      serviceId:
        type: string
        example: myService
      name:
        type: string
        example: My Service
      description:
        type: string
        example: My Service has some resources
      version:
        type: string
        example: v1.2.3
      provider:
        type:
          - string
          - 'null'
        example: Cybus
      homepage:
        type:
          - string
          - 'null'
        example: cybus.io
      icon:
        type:
          - string
          - 'null'
        example: TGFyYTwz
      targetState:
        type: string
        example: enabled
      currentState:
        type: string
        example: disabled
      totalResources:
        type: integer
        example: 105
      roleCount:
        type: integer
        example: 1
      userCount:
        type: integer
        example: 2
      volumeCount:
        type: integer
        example: 3
      fileCount:
        type: integer
        example: 4
      containerCount:
        type: integer
        example: 5
      ingressRouteCount:
        type: integer
        example: 6
      linkCount:
        type: integer
        example: 7
      nodeCount:
        type: integer
        example: 8
      serverCount:
        type: integer
        example: 9
      connectionCount:
        type: integer
        example: 10
      endpointCount:
        type: integer
        example: 11
      mappingCount:
        type: integer
        example: 12
      createdAt:
        type: string
        example: 2025-03-06T22:13:43.065Z
      updatedAt:
        type: string
        example: 2025-03-06T22:13:43.065Z
      parameters:
        type: object
        example:
          host: cybus.io
          port: 443
      marketPlace:
        type: object
        properties:
          directory:
            type: string
          filename:
            type: string
          updatedAt:
            type: string
          version:
            type: string
    required:
      - connectionCount
      - connectwareServiceUuid
      - containerCount
      - createdAt
      - currentState
      - description
      - endpointCount
      - fileCount
      - homepage
      - icon
      - ingressRouteCount
      - linkCount
      - mappingCount
      - marketPlace
      - name
      - nodeCount
      - parameters
      - provider
      - roleCount
      - serverCount
      - serviceId
      - targetState
      - totalResources
      - updatedAt
      - userCount
      - version
      - volumeCount
  JsonApiServiceListEnvelope:
    type: object
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      data:
        type: array
        items:
          $ref: '#/definitions/Service'
      meta:
        type: object
        properties:
          pagination:
            $ref: '#/definitions/pagination'
        required:
          - pagination
    required:
      - data
      - jsonapi
      - meta
  ResourceTopic:
    type: object
    required:
      - topic
      - serviceId
      - resourceId
      - category
    properties:
      topic:
        type: string
        example: services/servicea/A/000
      serviceId:
        type: string
        example: servicea
      resourceId:
        type: string
        example: servicea-A_000
      category:
        type: string
        enum:
          - Endpoint
          - Node
          - Mapping
        example: Endpoint
  Resource:
    type: object
    required:
      - resourceId
      - serviceId
      - category
      - resourceConfig
      - runnerName
      - protocol
      - parentResourceId
    properties:
      resourceId:
        type: string
        example: myResource
      serviceId:
        type: string
        example: myService
      category:
        type: string
        example: Endpoint
      resourceConfig:
        type: object
        required:
          - args
        properties:
          args:
            type: object
            additionalProperties: true
        example:
          args:
            targetState: enabled
            subscribe:
              path: /sayHello
              method: POST
      runnerName:
        type: string
        example: protocol-mapper
      protocol:
        type:
          - string
          - 'null'
        example: Http
      parentResourceId:
        type:
          - string
          - 'null'
        example: myOtherService-myConnectionResource
    oneOf:
      - $ref: '#/definitions/NodeResource'
      - $ref: '#/definitions/ServerResource'
      - $ref: '#/definitions/MappingResource'
      - $ref: '#/definitions/EndpointResource'
      - $ref: '#/definitions/AdsConnectionResource'
      - $ref: '#/definitions/BacnetConnectionResource'
      - $ref: '#/definitions/HeidenhainConnectionResource'
      - $ref: '#/definitions/KafkaConnectionResource'
      - $ref: '#/definitions/OtherConnectionsResource'
      - $ref: '#/definitions/OtherResources'
  NodeResource:
    type: object
    properties:
      protocol:
        type: string
      category:
        type: string
        enum:
          - Node
      parentResourceId:
        type: string
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - topic
              - operation
            properties:
              operation:
                type:
                  - string
                  - 'null'
                enum:
                  - serverProvides
                  - serverReceives
                  - serverProvidesAndReceives
                  - transaction
              topic:
                type: string
  ServerResource:
    type: object
    properties:
      protocol:
        type: string
      category:
        type: string
        enum:
          - Server
  MappingResource:
    type: object
    properties:
      protocol:
        type: string
      category:
        type: string
        enum:
          - Mapping
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - mappings
            properties:
              mappings:
                type: array
                items:
                  type: object
                  required:
                    - publish
                    - subscribe
                  properties:
                    publish:
                      $ref: '#/definitions/MappingResourceConfigPubSub'
                    subscribe:
                      type: array
                      items:
                        $ref: '#/definitions/MappingResourceConfigPubSub'
                    rules:
                      type: array
                      items:
                        type: object
                        additionalProperties: true
  MappingResourceConfigPubSub:
    type: object
    required:
      - topic
    properties:
      topic:
        type: string
      endpoint:
        type: string
      connection:
        type: string
  EndpointResource:
    type: object
    properties:
      protocol:
        type: string
      category:
        type: string
        enum:
          - Endpoint
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - topic
              - type
              - operation
              - address
            properties:
              operation:
                type: string
                enum:
                  - read
                  - subscribe
                  - write
              topic:
                type: string
              rules:
                type: array
                items:
                  type: object
                  additionalProperties: true
              address:
                type: object
                additionalProperties: true
  AdsConnectionResource:
    type: object
    properties:
      protocol:
        type: string
        enum:
          - ads
      category:
        type: string
        enum:
          - Connection
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - connection
            properties:
              connection:
                type: object
                required:
                  - localPort
                  - port
                  - host
                properties:
                  localPort:
                    type: integer
                  routerTcpPort:
                    type: integer
                  port:
                    type: integer
                  host:
                    type: string
  BacnetConnectionResource:
    type: object
    properties:
      protocol:
        type: string
        enum:
          - bacnet
      category:
        type: string
        enum:
          - Connection
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - connection
            properties:
              connection:
                type: object
                required:
                  - deviceAddress
                  - deviceInstance
                properties:
                  deviceAddress:
                    type: string
                  deviceInstance:
                    type: integer
  HeidenhainConnectionResource:
    type: object
    properties:
      protocol:
        type: string
        enum:
          - heidenhain
      category:
        type: string
        enum:
          - Connection
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - connection
            properties:
              connection:
                type: object
                required:
                  - ipAddress
                  - cncType
                properties:
                  ipAddress:
                    type: string
                  cncType:
                    type: string
                    enum:
                      - tnc640
                      - itnc530
                      - tnc426
  KafkaConnectionResource:
    type: object
    properties:
      protocol:
        type: string
        enum:
          - kafka
      category:
        type: string
        enum:
          - Connection
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - connection
            properties:
              connection:
                type: object
                required:
                  - brokers
                properties:
                  brokers:
                    type: array
                    items:
                      type: string
  OtherConnectionsResource:
    type: object
    properties:
      protocol:
        type: string
      category:
        type: string
        enum:
          - Connection
      resourceConfig:
        type: object
        properties:
          args:
            type: object
            required:
              - connection
            properties:
              connection:
                type: object
                additionalProperties: true
  OtherResources:
    type: object
    properties:
      category:
        type: string
        enum:
          - Container
          - File
          - IngressRoute
          - Link
          - Role
          - User
          - Volume
  ResourceOperationRequest:
    type: object
    properties:
      operation:
        type: string
        enum:
          - disable
          - enable
        description: Disable and enable
    required:
      - operation
  JsonApiResourceEnvelope:
    type: object
    required:
      - jsonapi
      - data
      - meta
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      data:
        $ref: '#/definitions/Resource'
      meta:
        type: object
        example: {}
  JsonApiResourceListEnvelope:
    type: object
    required:
      - jsonapi
      - data
      - meta
    properties:
      jsonapi:
        type: object
        required:
          - version
        properties:
          version:
            type: string
            example: '1.1'
      data:
        type: array
        items:
          $ref: '#/definitions/Resource'
      meta:
        type: object
        required:
          - pagination
        properties:
          pagination:
            $ref: '#/definitions/pagination'
  JsonApiTopicListEnvelope:
    type: object
    required:
      - jsonapi
      - data
      - meta
    properties:
      jsonapi:
        type: object
        required:
          - version
        properties:
          version:
            type: string
            example: '1.1'
      data:
        type: array
        items:
          $ref: '#/definitions/ResourceTopic'
      meta:
        type: object
        required:
          - pagination
        properties:
          pagination:
            $ref: '#/definitions/pagination'
  JsonApiResourceCountPerCategoryEnvelope:
    type: object
    required:
      - jsonapi
      - data
      - meta
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      data:
        type: object
        properties:
          resourceCount:
            type: integer
            example: 1000
        required:
          - resourceCount
      meta:
        type: object
        example: {}
  AllSchemas:
    type: object
    additionalProperties:
      type: object
    description: Keys must match the pattern `[a-zA-Z0-9]+`.
  ServiceDependencies:
    type: object
    properties:
      dependent:
        description: Ids of dependent cross reference services
        type: array
        items:
          type: string
      dependsOn:
        description: Ids of depends on cross reference services
        type: array
        items:
          type: string
    required:
      - dependent
      - dependsOn
  ServicePostSchemasRequest:
    type: object
    required:
      - commissioningFile
    properties:
      commissioningFile:
        type: string
        description: >-
          The commissioning file of this service as base64 encoded content of a
          buffer
  ValidatePostServiceRequest:
    type: object
    required:
      - commissioningFile
    properties:
      commissioningFile:
        type: string
        description: >-
          The commissioning file of this service as base64 encoded content of a
          buffer
  ServiceSchemas:
    type: object
  ServicePostRequest:
    type: object
    required:
      - id
      - commissioningFile
    properties:
      id:
        type: string
        minLength: 4
      commissioningFile:
        type: string
        description: >-
          The commissioning file of this service as base64 encoded content of a
          buffer
      parameters:
        type: object
        description: The parameter values of this service as a JSON object
        additionalProperties: true
      marketplace:
        $ref: '#/definitions/MarketplaceServiceRequest'
      targetState:
        type: string
        enum:
          - disabled
          - enabled
  UpdateServiceRequest:
    type: object
    properties:
      parameters:
        type: object
        additionalProperties: true
      commissioningFile:
        type: string
      marketplace:
        $ref: '#/definitions/MarketplaceServiceRequest'
  MarketplaceServiceRequest:
    type: object
    properties:
      filename:
        type: string
      directory:
        type: string
      version:
        type: string
      updatedAt:
        type: string
        format: date-time
  ServiceOperationRequest:
    type: object
    properties:
      operation:
        type: string
        enum:
          - disable
          - enable
          - cancel
        description: Disable and enable
    required:
      - operation
  IngressRoute:
    type: object
    properties:
      id:
        type: string
      containerHost:
        type: string
      containerPort:
        type: integer
      containerPrefixRewrite:
        type: string
      ingressPort:
        type: integer
      ingressUrlPrefix:
        type: string
      type:
        type: string
      headers:
        type: array
        items:
          type: string
  LinkedService:
    type: object
    properties:
      id:
        type: string
      name:
        type: string
      links:
        type: array
        items:
          properties:
            name:
              type: string
            href:
              type: string
          required:
            - name
            - href
    required:
      - id
      - name
      - links
  Link:
    type: object
    properties:
      id:
        type: string
      ingressRoute:
        type: string
      name:
        type: string
      href:
        type: string
  ValidationError:
    type: object
    properties:
      message:
        type: string
    required:
      - message
  ParserError:
    type: object
    properties:
      message:
        type: string
      keyword:
        type: string
      dataPath:
        type: string
      params:
        type: object
        description: |
          Can either be a string or an object with:
            - additionalProperty: string
            - allowedValues: array of strings
        additionalProperties: true
    required:
      - message
  ResourcesRunner:
    type: object
    properties:
      id:
        type: string
        description: The id of the deleted resource runner
  pageNumber:
    description: A page number
    type: integer
    minimum: 1
    default: 1
  itemsPerPage:
    description: Number of items per page
    type: integer
    minimum: 1
    maximum: 100
    default: 50
  pagination:
    type: object
    required:
      - totalPages
      - totalRows
      - pageNumber
      - totalRowsInPage
      - nextPage
      - rowsPerPage
    properties:
      totalPages:
        $ref: '#/definitions/pageNumber'
      totalRows:
        type: integer
        example: 1
      pageNumber:
        $ref: '#/definitions/pageNumber'
      totalRowsInPage:
        type: integer
        example: 1
      nextPage:
        $ref: '#/definitions/pageNumber'
      rowsPerPage:
        $ref: '#/definitions/itemsPerPage'
  JSONAPI:
    type: object
    required:
      - version
    properties:
      version:
        $ref: '#/definitions/JSONAPIVersion'
  JSONAPIVersion:
    type: string
    example: 1.1.1
  JSONAPIError:
    type: object
    required:
      - jsonapi
      - errors
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      errors:
        type: array
        items:
          type: object
          required:
            - status
            - title
            - detail
          properties:
            status:
              type: string
              example: '410'
            title:
              type: string
              example: Gone
            detail:
              type: string
              example: This endpoint has been deprecated and is no longer available.
  JSONAPIParserError:
    type: object
    required:
      - jsonapi
      - errors
    properties:
      jsonapi:
        $ref: '#/definitions/JSONAPI'
      errors:
        type: array
        minItems: 1
        items:
          type: object
          required:
            - status
            - title
            - detail
            - parserErrors
          properties:
            status:
              type: string
              example: '406'
            title:
              type: string
              example: Validation failed
            detail:
              type: string
              example: Error in commissioning file
            parserErrors:
              type: array
              minItems: 1
              items:
                $ref: '#/definitions/ParserError'
  ServiceStatus:
    type: object
    properties:
      id:
        type: string
        description: Unique identifier representing a specific service.
      targetState:
        type: string
        description: Target state of the service (user's wish).
      currentState:
        type: string
        description: Current state of the service.
  ServicePostResult:
    type: object
    required:
      - id
    properties:
      id:
        type: string
        minLength: 4
  ResourcePostSchemasRequest:
    type: object
    required:
      - schemas
    properties:
      schemas:
        description: List of resources schemas
        type: array
        minItems: 1
        items:
          type: object
  AdjecencyMatrix:
    type: object
    required:
      - dependencies
    properties:
      dependencies:
        type: array
        items:
          $ref: '#/definitions/ServiceDependency'
  ServiceDependency:
    type: object
    required:
      - fromNode
      - toNode
    properties:
      fromNode:
        type: string
        description: The ID of the node that depends on 'toNode'
      toNode:
        type: string
        description: The ID of the node that 'fromNode' depends on
  NodeList:
    type: object
    description: A list of services from the service graph
    required:
      - nodes
    properties:
      nodes:
        type: array
        items:
          type: string
        description: List of nodes
