#%RAML 0.8
title: WWST Robot Cleaner Cleaning mode
version: v1.0.0-20170911
schemas:
- Mode: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.robot.cleaner.cleaning.json#",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "Copyright (c) 2016, 2017 Open Connectivity Foundation, Inc. All rights reserved.",
      "title": "WWST Mode",
      "definitions": {
        "x.com.st.robot.cleaner.cleaning": {
          "type": "object",
          "properties": {
            "supportedModes": {
              "type": "array",
              "readOnly": true,
              "description": "Array of possible modes the device supports.",
              "items": {
                "type": "string"
              }
            },
            "modes": {
              "type": "array",
              "description": "Array of the currently active mode(s)",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "type": "object",
      "allOf": [
        {
          "$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"
        },
        {
          "$ref": "#/definitions/x.com.st.robot.cleaner.cleaning"
        }
      ],
      "required": [
        "supportedModes",
        "modes"
      ]
    }
- ModeUpdate: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.robot.cleaner.cleaning.json#",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "Copyright (c) 2016, 2017 Open Connectivity Foundation, Inc. All rights reserved.",
      "title": "WWST Mode Update",
      "definitions": {
        "x.com.st.robot.cleaner.cleaning": {
          "type": "object",
          "properties": {
            "modes": {
              "type": "array",
              "description": "Desired mode",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "type": "object",
      "allOf": [
        {
          "$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"
        },
        {
          "$ref": "#/definitions/x.com.st.robot.cleaner.cleaning"
        }
      ],
      "required": [
        "modes"
      ]
    }

traits:
  - interface:
      queryParameters:
        if:
          enum: ["oic.if.a","oic.if.s","oic.if.baseline"]

/WWSTRobotCleanerCleaningmodeResURI:
  description: |
        Robot Cleaner Cleaning mode
  displayName: WWST Robot Cleaner Cleaning mode
  is: [ interface ]

  get:
    description: |
      Retrieves the current robot cleaner cleaning mode
    responses:
      200:
        body:
          application/json:
            schema: Mode
            example: |
              {
                "rt":             ["x.com.st.robot.cleaner.cleaning"],
                "id":             "unique_example_id",
                "modes": [ "auto" ],
                "supportedModes": ["auto", "part", "repeat", "manual"]
              }

  post:
    description: |
      Sets the desired robot cleaner cleaning mode
    body:
      application/json:
        schema: ModeUpdate
        example: |
          {
            "id":    "unique_example_id",
            "modes": ["auto"]
          }
    responses:
      200:
        body:
          application/json:
            schema: ModeUpdate
            example: |
              {
                "id":    "unique_example_id",
                "modes": ["auto"]
              }

      403:
        description: |
          This response is generated by the OIC Server when the client sends:
            An update with an value for mode that is not found in supportedModes.
          The server responds with the current resource representation.
        body:
          application/json:
            schema: Mode
            example: |
              {
                "id":             "unique_example_id",
                "modes": [ "auto" ],
                "supportedModes": ["auto", "part", "repeat", "manual"]
              }
