#%RAML 0.8
title: WWST Thermostat Fan
version: v1.0.0-20170918
schemas:
- Mode: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.mode.fan.thermostat.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.mode.fan.thermostat": {
          "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.mode.fan.thermostat"}
    ],
    "required": ["supportedModes", "modes"]
    }
- ModeUpdate: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.mode.fan.thermostat.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.mode.fan.thermostat": {
          "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.mode.fan.thermostat"}
      ],
      "required": ["modes"]
    }

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

/WWSTThermostatFanResURI:
  description: |
        Controlling thermostat fan mode
  displayName: WWST Thermostat Fan
  is: [ interface ]

  get:
    description: |
      Retrieves the current thermostat fan mode
    responses:
      200:
        body:
          application/json:
            schema: Mode
            example: |
              {
                "rt": ["x.com.st.mode.fan.thermostat"],
                "id": "unique_example_id",
                "modes": ["on"],
                "supportedModes": ["on", "auto", "circulate"]
              }

  post:
    description: |
      Sets the desired thermostat fan mode
    body:
      application/json:
        schema: ModeUpdate
        example: |
          {
            "id":    "unique_example_id",
            "modes": ["on"]
          }
    responses:
      200:
        body:
          application/json:
            schema: ModeUpdate
            example: |
              {
                "id":    "unique_example_id",
                "modes": ["on"]
              }

      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: ModeUpdate
            example: |
              {
                "id": "unique_example_id",
                "modes": ["on"],
                "supportedModes": ["on", "auto", "circulate"]
              }
