---
components:
  schemas:
    kiosk_media:
      examples:
      - src: "https://cdn.pixabay.com/photo/2017/02/20/18/03/cat-2083492_960_720.jpg"
        name: "cat2"
      additionalProperties: false
      type: "object"
      properties:
        src:
          description: "The source of the media"
          type: "string"
        name:
          description: "The name of the media"
          type: "string"
      required:
      - "name"
      - "src"
    kiosk_auth_success:
      additionalProperties: false
      type: "object"
      properties:
        type:
          const: "auth-success"
          type: "string"
    kiosk_auth_failed:
      additionalProperties: false
      type: "object"
      properties:
        type:
          const: "auth-failed"
          type: "string"
    user_token:
      const: "user/token:{token}"
      type: "string"
    osc_ping:
      additionalProperties: false
      type: "object"
      properties:
        type:
          const: "ping"
          type: "string"
    kiosk_objectList:
      examples:
      - image:
        - src: "https://cdn.pixabay.com/photo/2017/02/20/18/03/cat-2083492_960_720.jpg"
          name: "cat2"
        - src: "https://cdn.pixabay.com/photo/2014/11/30/14/11/cat-551554_960_720.jpg"
          name: "cat1"
        page:
        - src: "https://dfki.de"
          name: "dfki.de"
        video:
        - src: "https://foo.bar/video.mp4"
          name: "test video"
      additionalProperties: false
      type: "object"
      properties:
        image:
          uniqueItems: true
          description: "List of images"
          type: "array"
          items:
            $ref: "#/components/schemas/kiosk_media"
        page:
          uniqueItems: true
          description: "List of pages"
          type: "array"
          items:
            $ref: "#/components/schemas/kiosk_media"
        video:
          uniqueItems: true
          description: "List of videos"
          type: "array"
          items:
            $ref: "#/components/schemas/kiosk_media"
      required:
      - "page"
      - "image"
      - "video"
    osc_auth:
      examples:
      - password: "secret"
        type: "ping"
        username: "user"
      additionalProperties: false
      type: "object"
      properties:
        password:
          type: "string"
        type:
          const: "auth"
          type: "string"
        username:
          type: "string"
      required:
      - "type"
      - "username"
      - "password"
  messages:
    kiosk_list_objects:
      payload:
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "listObjects"
            type: "string"
      name: "kiosk_list_objects"
      tags: []
    kiosk_show_image:
      payload:
        examples:
        - type: "show-image"
          value: "https://foo.bar/image.png"
          target: "test2"
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "show-image"
            type: "string"
          value:
            description: "Tells the client to display a specific image"
            type: "string"
          target:
            description: "The target to show the image on"
            type: "string"
        required:
        - "type"
        - "target"
        - "value"
      name: "kiosk_show_image"
      tags: []
    kiosk_object_list:
      payload:
        examples:
        - type: "show-image"
          value: "https://foo.bar/image.png"
          target: "test2"
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "objectList"
            type: "string"
          value:
            $ref: "#/components/schemas/kiosk_objectList"
          target:
            description: "The target to show the image on"
            type: "string"
        required:
        - "type"
        - "target"
      name: "kiosk_object_list"
      tags: []
    kiosk_auth:
      payload:
        examples:
        - password: "secret"
          type: "auth"
          username: "user"
        additionalProperties: false
        type: "object"
        properties:
          password:
            type: "string"
          type:
            const: "auth"
            type: "string"
          username:
            type: "string"
        required:
        - "type"
        - "username"
        - "password"
      name: "kiosk_auth"
      x-response:
        oneOf:
        - $ref: "#/components/schemas/kiosk_auth_failed"
        - $ref: "#/components/schemas/kiosk_auth_success"
      tags: []
    osc_auth:
      name: "osc_auth"
      tags: []
    kiosk_ping:
      payload:
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "ping"
            type: "string"
      name: "kiosk_ping"
      tags: []
    kiosk_list_targets:
      payload:
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "listTargets"
            type: "string"
      name: "kiosk_list_targets"
      tags: []
    kiosk_target_list:
      payload:
        examples:
        - type: "show-image"
          value: "https://foo.bar/image.png"
          target: "test2"
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "targetList"
            type: "string"
          value:
            type: "array"
            items:
              type: "string"
        required:
        - "type"
      name: "kiosk_target_list"
      tags: []
    kiosk_auth_success:
      payload:
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "auth-success"
            type: "string"
      name: "kiosk_auth_success"
      tags: []
    kiosk_show_video:
      payload:
        examples:
        - type: "show-image"
          value: "https://foo.bar/image.mp4"
          target: "test2"
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "show-video"
            type: "string"
          value:
            description: "Tells the client to display a specific video"
            type: "string"
          target:
            description: "The target to show the video on"
            type: "string"
        required:
        - "type"
        - "target"
        - "value"
      name: "kiosk_show_video"
      tags: []
    kiosk_show_page:
      payload:
        examples:
        - type: "show-image"
          value: "https://foo.bar/"
          target: "test2"
        additionalProperties: false
        type: "object"
        properties:
          type:
            const: "show-page"
            type: "string"
          value:
            description: "Tells the client to display a specific page"
            type: "string"
          target:
            description: "The target to show the page on"
            type: "string"
        required:
        - "type"
        - "target"
        - "value"
      name: "kiosk_show_page"
      tags: []
    kiosk_auth_failed:
      payload:
        $ref: "#/components/schemas/kiosk_auth_failed"
      name: "kiosk_auth_failed"
      tags: []
    osc_ping:
      name: "osc_ping"
      tags: []
servers:
  wss:
    protocol: "wss"
    description: "Websocket base.  \n  \n<b><em>INFO</em></b>:All messages tagged\
      \ with \"authRequired\" in the binding need to have the client authenticate,\
      \ this can be done either via <a href=\"#operation-subscribe-user/login\">user/login</a>\
      \ or <a href=\"#operation-subscribe-user/token\">user/token</a>"
    url: "wss://kosmos.lab.baall.de:"
  mqtt:
    protocol: "mqtt"
    url: "mqtt://kosmos.lab.baall.de:1883"
channels:
  user/login:
    subscribe:
      message:
        oneOf:
        - payload:
            examples:
            - "{\"user\":\"karl\",\"pass\",\"verysecret\"}"
            additionalProperties: false
            type: "object"
            properties:
              pass:
                description: "the password to login in with"
                type: "string"
              user:
                description: "the username to login in with"
                type: "string"
          name: "user/login"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        topic: "user/login"
        message: "{message}"
      ws:
        path: "/ws"
        message: "user/login:{message}"
  /event:
    subscribe:
      message:
        oneOf:
        - payload:
            $ref: "/doc/openapi.yaml#/components/schemas/event"
          name: "event"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        authRequired: true
        userLevel: 1
        topic: "/event"
        message: "{message}"
      ws:
        path: "/ws"
        authRequired: true
        userLevel: 1
        message: "/event:{message}"
  user/token:
    subscribe:
      message:
        oneOf:
        - payload:
            $ref: "#/components/schemas/user_token"
          name: "user/token"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        topic: "user/token"
        message: "{message}"
      ws:
        path: "/ws"
        message: "user/token:{message}"
  device/{uuid}/state:
    publish:
      message:
        oneOf:
        - payload:
            examples:
            - state: "OFF"
            - heatingTemperatureSetting: 20.5
            - color:
                r: 255
                b: 255
                g: 0
            - "on": false
            description: "the state of the given device"
            type: "object"
          name: "device/state"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        authRequired: true
        userLevel: 1
        topic: "device/{uuid}/state"
        message: "{message}"
      ws:
        path: "/ws"
        authRequired: true
        userLevel: 1
        message: "device/{uuid}/state:{message}"
    parameters:
      uuid:
        schema:
          type: "string"
        description: "the uuid of the device"
  device/{uuid}/location:
    publish:
      message:
        oneOf:
        - payload:
            $ref: "/doc/openapi.yaml#/components/schemas/deviceLocation"
          name: "device/location"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        authRequired: true
        userLevel: 1
        topic: "device/{uuid}/location"
        message: "{message}"
      ws:
        path: "/ws"
        authRequired: true
        userLevel: 1
        message: "device/{uuid}/location:{message}"
    parameters:
      uuid:
        schema:
          type: "string"
        description: "the uuid of the device the location refers to"
  /kioskws:
    subscribe:
      message:
        oneOf:
        - $ref: "#/components/messages/kiosk_list_objects"
        - $ref: "#/components/messages/kiosk_list_targets"
        - $ref: "#/components/messages/kiosk_ping"
        - $ref: "#/components/messages/kiosk_auth"
      tags:
      - name: "kiosk"
    publish:
      message:
        oneOf:
        - $ref: "#/components/messages/kiosk_show_image"
        - $ref: "#/components/messages/kiosk_show_page"
        - $ref: "#/components/messages/kiosk_show_video"
        - $ref: "#/components/messages/kiosk_auth_failed"
        - $ref: "#/components/messages/kiosk_auth_success"
        - $ref: "#/components/messages/kiosk_object_list"
        - $ref: "#/components/messages/kiosk_target_list"
      tags:
      - name: "kiosk"
    bindings:
      ws:
        path: "/kioskws"
        message: "{message}"
    description: "This websocket is used by the kiosk plugin. It is used by clients\
      \ and admins of the kiosk application alike to exchange messages"
  device/{uuid}/set:
    subscribe:
      message:
        oneOf:
        - payload:
            examples:
            - state: "OFF"
            - heatingTemperatureSetting: 20.5
            - color:
                r: 255
                b: 255
                g: 0
            - "on": false
            description: "the value(s) to set"
            type: "object"
          name: "device_set"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        authRequired: true
        userLevel: 1
        topic: "device/{uuid}/set"
        message: "{message}"
      ws:
        path: "/ws"
        authRequired: true
        userLevel: 1
        message: "device/{uuid}/set:{message}"
    parameters:
      uuid:
        schema:
          type: "string"
        description: "the uuid of the device you want to control"
  device/{uuid}/event:
    subscribe:
      message:
        oneOf:
        - payload:
            $ref: "/doc/openapi.yaml#/components/schemas/event"
          name: "device_event"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        authRequired: true
        userLevel: 1
        topic: "device/{uuid}/event"
        message: "{message}"
      ws:
        path: "/ws"
        authRequired: true
        userLevel: 1
        message: "device/{uuid}/event:{message}"
    parameters:
      uuid:
        schema:
          type: "string"
        description: "The UUID of the device this event belongs to, events will only\
          \ be visible for users with read access to the device"
  device/{uuid}/config:
    subscribe:
      message:
        oneOf:
        - payload:
            examples:
            - schema: "https://kosmos-lab.de/schema/Lamp.json"
              name: "lamp1"
              state:
                "on": true
            - schema: "https://kosmos-lab.de/schema/MultiSensor.json"
              name: "kosmos_multi17"
              state:
                currentEnvironmentTemperature: 17
                humidityLevel: 10
              scopes:
                read: "kosmos:read"
                del: "kosmos:del"
                write: "kosmos:write"
            - schema: "https://kosmos-lab.de/schema/MultiSensor.json"
              name: "multi2"
              state:
                currentEnvironmentTemperature: 17
                humidityLevel: 10
            additionalProperties: false
            type: "object"
            properties:
              schema:
                description: "The $id/url of the schema to use. If its a schema not\
                  \ already in the system the $id MUST be a reachable Url describing\
                  \ the schema."
                type: "string"
              name:
                minLength: 3
                description: "The name to use for the new device, if no name is set\
                  \ uuid will be used. Does not need to be unique."
                type: "string"
              state:
                default: "{}"
                description: "The starting state of the device, needs to contain all\
                  \ required values if the schema has any and needs to be valid against\
                  \ the schema."
                type: "object"
              scopes:
                $ref: "/doc/openapi.yaml#/components/schemas/deviceScopes"
            required:
            - "schema"
          name: "device/add"
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        authRequired: true
        userLevel: 1
        topic: "device/{uuid}/config"
        message: "{message}"
      ws:
        path: "/ws"
        authRequired: true
        userLevel: 1
        message: "device/{uuid}/config:{message}"
    parameters:
      uuid:
        schema:
          type: "string"
        description: "the uuid of the device you want to control"
  /osc/ws:
    subscribe:
      message:
        oneOf:
        - $ref: "#/components/messages/osc_ping"
        - $ref: "#/components/messages/osc_auth"
    bindings:
      ws:
        path: "/osc/ws"
        message: "{message}"
  locations:
    subscribe:
      message:
        oneOf:
        - description: "This messages signals to the server, that we are interested\
            \ in getting all device locations. The server will return all locations\
            \ via <a href=\"#operation-publish-device/{uuid}/location\">device/{uuid}/location</a>."
          tags: []
      tags:
      - name: "KosmoS"
    bindings:
      mqtt:
        authRequired: true
        userLevel: 1
        topic: "locations"
      ws:
        path: "/ws"
        authRequired: true
        userLevel: 1
asyncapi: "2.4.0"
info:
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
  contact:
    name: "Jan Janssen"
    email: "Jan.Janssen@dfki.de"
  description: "# KosmoS ASynchron API  \n## KosmoS async webservice  \nAll operations\
    \ tagged with \"KosmoS\" are part of the default websocket and mqtt service. \
    \ \n## YAML specification  \nYou can find the newest openapi specification on\
    \ [/doc/openapi.yaml](/doc/openapi.yaml) or [/doc/openapi.json](/doc/openapi.json).\
    \  \nThe human readable description of the openapi can be found [/doc/openapi.html](/doc/openapi.html).\
    \  \nYou can find the newest asyncapi specification on [/doc/asyncapi.yaml](/doc/asyncapi.yaml)\
    \ or [/doc/asyncapi.json](/doc/asyncapi.json).  \nThe human readable description\
    \ of the asyncapi can be found [/doc/asyncapi.html](/doc/asyncapi.html).  \n**NOTE**:\
    \ These files are automatically generated and also contain your plugins etc."
  title: "KosmoS asyncApi"
  version: "v0.8.6"