openapi: 3.0.3
info:
  title: SDF Protocol Information for BLE
  description: |-
    SDF Protocol Information for BLE devices.
  version: 0.10.0
externalDocs:
  description: SDF Protocol Mapping IETF draft
  url: https://datatracker.ietf.org/doc/draft-ietf-asdf-sdf-protocol-mapping/

paths: {}

components:
  schemas:
# BLE Protocol Info
## A Service is a device with optional service IDs
    ProtocolInfo-BLE-ServiceMap:
      type: object
      properties:
        ble:
          type: object
          properties:
            services:
              type: array
              items:
                type: object
                allOf:
                  - $ref: '#/components/schemas/ProtocolInfo-BLE-Service'
            cached:
              description: |-
                If we can cache information, then device doesn't need
                to be rediscovered before every connected.
              type: boolean
              default: false
            cacheExpiryDuration:
              description: cache expiry period in seconds, when device allows
              type: integer
              example: 3600 # default 1 hour
            autoUpdate:
              description: |-
                autoupdate services if device supports it (default)
              type: boolean
              example: true
            bonding: #optional, by default defined in SCIM object 
              type: string
              example: default
              enum:
                - default 
                - none
                - justworks
                - passkey
                - oob

    ProtocolInfo-BLE-Service:
      required:
        - serviceID
      type: object
      properties:
        serviceID:
          type: string
          format: uuid
          example: 00001809-0000-1000-8000-00805f9b34fb
        characteristics:
          type: array
          items:
            $ref: '#/components/schemas/ProtocolInfo-BLE-Characteristic'

    ProtocolInfo-BLE-Characteristic:
      type: object
      properties:
        characteristicID:
          type: string
          format: uuid
          example: 00002a1c-0000-1000-8000-00805f9b34fb
        flags:
          type: array
          example:
          - read
          - write
          items:
            type: string
            enum:
              - read
              - write
              - notify
        descriptors:
          type: array
          items:
            $ref: '#/components/schemas/ProtocolInfo-BLE-Descriptor'

    ProtocolInfo-BLE-Descriptor:
      type: object
      properties:
        descriptorID:
          type: string
          format: uuid
          example: 00002902-0000-1000-8000-00805f9b34fb

##  Protocol Info for BLE Broadcast
    ProtocolInfo-BLE-Broadcast:
      required:
        - ble
      type: object
      properties:
        ble:
          type: object
          properties:
            connectable:
              type: boolean
