openapi: 3.0.2
info:
  title: Siveillance Intrusion API
  description: |
    The Siveillance Intrusion API allows managing Intrusion systems.
  contact:
    name: Siveillance Intrusion Team
  x-logo:
    url: logo.png
    altText: Siemens Logo
  version: 0.1.0
servers:
  - url: https://api.bpcloud.siemens.com/sec-intrusion/v1/partitions/{partitionId}
    description: Production Endpoint
    variables:
      partitionId:
        default: REQUIRED
tags:
  - name: systems
    description: Systems
paths:
  /systems:
    get:
      x-horizon-permission: bss.building.read
      tags:
        - systems
      parameters:
        - $ref: '#/components/parameters/limitParam'
        - $ref: '#/components/parameters/offsetParam'
      summary: Get Systems
      operationId: GetIntrusionSystems
      security:
        - service_auth: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntrusionSystemList'
  /systems/{systemId}:
    parameters:
      - $ref: '#/components/parameters/systemIdParam'
    get:
      x-horizon-permission: bss.building.read
      parameters:
        - $ref: '#/components/parameters/extendSystemParam'
        - $ref: '#/components/parameters/fieldsSystemParam'
      tags:
        - systems
      summary: Get a System
      operationId: GetIntrusionSystemById
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntrusionSystemData'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - service_auth: []
components:
  securitySchemes:
    service_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  parameters:
    offsetParam:
      in: query
      name: offset
      required: false
      schema:
        type: integer
      description: Offset (amount of entries to skip)
    limitParam:
      in: query
      name: limit
      required: false
      schema:
        type: integer
      description: Page Limit (max page size)
    systemIdParam:
      in: path
      name: systemId
      required: true
      schema:
        $ref: '#/components/schemas/EntityId'
      description: System ID
    extendSystemParam:
      in: query
      name: extend
      schema:
        type: string
        example: none
      description: |
        A comma separated list of references to extend.
        | value | description |
        | ----- | ----- |
        | none | do not extend (default) |
        | all | extend all references |
        | device | extend `device` in response |
    fieldsSystemParam:
      in: query
      name: fields
      schema:
        type: string
      description: >
        A comma separated list of resource fields to include.

        When a `fields` parameter is not applied all fields except collection
        resource and structure resources are returned.

        When a `fields` parameter is applied, only the named fields are
        returned.


        Possible values:

        | value | description |

        | ----- | ----- |

        | id | include `id` in response |

        | base | include `base` in response |

        | config | include `config` in response |

        | statistics | include `statistics`  in response |

        Example: `?fields=id,base``
  schemas:
    EntityId:
      type: string
      format: uuid
      description: |
        A globally unique ID identitifying an entity.
    DeviceRef:
      type: object
      required:
        - id
        - type
      properties:
        id:
          type: string
        type:
          enum:
            - Device
        extended:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/Device'
    Device:
      type: object
      properties: {}
    IntrusionSystemList:
      type: object
      description: |
        A list of print jobs.
      required:
        - data
      properties:
        links:
          type: object
          properties:
            next:
              type: string
              example: https://api.bx.com/systems?offset=100
        meta:
          $ref: '#/components/schemas/MetaInfo'
        data:
          type: array
          items:
            $ref: '#/components/schemas/IntrusionSystemBase'
    IntrusionSystemData:
      type: object
      required:
        - data
      properties:
        self:
          type: object
          readOnly: true
          properties:
            id:
              $ref: '#/components/schemas/EntityId'
            type:
              enum:
                - IntrusionSystem
        data:
          $ref: '#/components/schemas/IntrusionSystem'
    IntrusionSystem:
      type: object
      allOf:
        - $ref: '#/components/schemas/IntrusionSystemBase'
      properties:
        device:
          $ref: '#/components/schemas/DeviceRef'
        config:
          $ref: '#/components/schemas/IntrusionSystemConfiguration'
    IntrusionSystemBaseResource:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          example: Bank Vault
        serialNumber:
          type: string
          example: '2534675'
        family:
          $ref: '#/components/schemas/IntrusionSystemType'
        state:
          $ref: '#/components/schemas/IntrusionSystemState'
    IntrusionSystemBase:
      type: object
      required:
        - base
        - id
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/EntityId'
        base:
          $ref: '#/components/schemas/IntrusionSystemBaseResource'
        statistics:
          type: object
          properties: {}
    IntrusionSystemType:
      type: string
      enum:
        - Siveillance
    IntrusionSystemState:
      type: string
      enum:
        - Operational
        - Unknown
    IntrusionSystemConfiguration:
      type: object
      additionalProperties: false
      discriminator:
        propertyName: family
        mapping:
          Siveillance: '#/components/schemas/SiveillanceSystemConfiguration'
      required:
        - family
      properties:
        family:
          $ref: '#/components/schemas/IntrusionSystemType'
    OtherSystemConfiguration:
      type: object
      allOf:
        - $ref: '#/components/schemas/IntrusionSystemConfiguration'
      properties:
        test:
          type: string
    SiveillanceSystemConfiguration:
      type: object
      allOf:
        - $ref: '#/components/schemas/IntrusionSystemConfiguration'
      properties:
        systemVersion:
          type: string
          example: 2.3.12.2033
        kernelVersion:
          type: string
          example: 5.44.3
        equipmentNumber:
          type: string
          example: TBD
        lastSystemStartUtc:
          type: string
          format: date-time
        licenseDateUtc:
          type: string
          format: date-time
        busAmount:
          type: integer
          example: 4
        amountControlPanels:
          type: integer
          example: 2
        interfaces:
          $ref: '#/components/schemas/SiveillanceInterfaceTypeCollection'
        storageStatistics:
          $ref: '#/components/schemas/SiveillanceStorageStatistics'
        deviceStatistics:
          $ref: '#/components/schemas/SiveillanceDeviceStatisticsCollection'
        inputStatistics:
          $ref: '#/components/schemas/SiveillanceInputProfileStatisticsCollection'
        outputStatistics:
          $ref: '#/components/schemas/SiveillanceOutputStatistics'
        areaStatistics:
          $ref: '#/components/schemas/SiveillanceAreaStatisticsCollection'
    SiveillanceDeviceStatisticsCollection:
      type: object
      properties:
        count:
          type: integer
          format: int64
        items:
          type: array
          items:
            $ref: '#/components/schemas/SiveillanceDeviceStatistics'
    SiveillanceInputProfileStatisticsCollection:
      type: object
      properties:
        totalInputCount:
          type: integer
          format: int64
        totalInputProfileCount:
          type: integer
          format: int64
        items:
          type: array
          items:
            $ref: '#/components/schemas/SiveillanceInputProfileStatistics'
    SiveillanceAreaStatisticsCollection:
      type: object
      properties:
        totalAreaCount:
          type: integer
          format: int64
        areaTypes:
          type: array
          items:
            $ref: '#/components/schemas/SiveillanceAreaTypeStatistics'
    SiveillanceInterfaceTypeCollection:
      type: array
      items:
        $ref: '#/components/schemas/SiveillanceInterfaceType'
    SiveillanceInterfaceType:
      type: string
      enum:
        - SSH
    SiveillanceStorageStatistics:
      type: object
      properties:
        availableDiskKb:
          type: integer
          example: 909100
        availableFlashKb:
          type: integer
          example: 10902
    SiveillanceOutputStatistics:
      type: object
      properties:
        count:
          type: integer
          example: 105
    SiveillanceDeviceStatistics:
      type: object
      properties:
        count:
          type: integer
          example: 7
        type:
          type: string
          example: MIO
    SiveillanceInputProfileStatistics:
      type: object
      properties:
        inputAmount:
          type: integer
          example: 7
        category:
          $ref: '#/components/schemas/InputCategory'
        name:
          type: string
          example: Motion Detector VdS
        id:
          type: integer
          format: int64
          example: 100
    InputCategory:
      type: string
      enum:
        - Unknown
        - MotionDetector
    SiveillanceAreaTypeStatistics:
      type: object
      properties:
        areaCount:
          type: integer
          example: 7
        id:
          type: integer
          example: 1
        name:
          type: string
          example: Door
        category:
          $ref: '#/components/schemas/AreaCategory'
    AreaCategory:
      type: string
      enum:
        - Partition
        - Door
        - Perimeter
        - Other
    MetaInfo:
      type: object
      additionalProperties: false
      properties:
        page:
          $ref: '#/components/schemas/MetaPageInfo'
    MetaPageInfo:
      type: object
      properties:
        totalElements:
          type: integer
          example: 102
        currentOffset:
          type: integer
          example: 100
        elements:
          type: integer
          example: 2
    Error:
      type: object
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                example: e31f00cc-7a5d-46c2-a272-771e6a8d6ff0
                description: >-
                  A unique identifier for this particular occurrence of the
                  problem.
              code:
                type: string
                description: >-
                  An application-specific error code, expressed as a string
                  value.
                example: 200-0201
              status:
                type: string
                example: '403'
                description: >-
                  The HTTP status code applicable to this problem, expressed as
                  a string value.
              title:
                type: string
                description: >-
                  A short, human-readable summary of the problem that SHOULD NOT
                  change from occurrence to occurrence of the problem, except
                  for purposes of localization.
                example: Forbidden to perform this action
              detail:
                type: string
                description: >-
                  a human-readable explanation specific to this occurrence of
                  the problem. Like ```title```, this field’s value can be
                  localized.
                example: Missing permission
              source:
                type: object
                properties:
                  pointer:
                    type: string
                    description: >-
                      a JSON Pointer
                      [[RFC6901]](https://tools.ietf.org/html/rfc6901) to the
                      associated entity in the request document
                    example: /data/attributes/title
