#%RAML 0.8
title: WWST Fan Speed
version: v1.0.0-20170911
schemas:
- FanSpeed: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.fanspeed.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.fanspeed": {
          "type": "object",
          "properties": {
            "fanSpeed": {
              "type": "integer",
              "description": "Current fanSpeed"
            },
            "range": {
              "type": "array",
              "description": "Array defining min,max values for this fanSpeed on this device",
              "items": {
                "type": "integer"
              },
              "readOnly": true
            },
            "step": {
              "type": "integer",
              "description": "Step of fan speed",
              "readOnly": true
            }
          }
        }
    },
    "type": "object",
    "allOf": [
      {"$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"},
      {"$ref": "#/definitions/x.com.st.fanspeed"}
    ],
    "required": ["fanSpeed", "range", "step"]
    }
- FanSpeedUpdate: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.fanspeed.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.fanspeed": {
          "type": "object",
          "properties": {
            "fanSpeed": {
              "type": "integer",
              "description": "Current fanSpeed"
            }
          }
        }
      },
      "type": "object",
      "allOf": [
        {"$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"},
        {"$ref": "#/definitions/x.com.st.fanspeed"}
      ],
      "required": ["fanSpeed"]
    }

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

/WWSTFanSpeedResURI:
  description: |
        Fan Speed
  displayName: WWST Fan Speed
  is: [ interface ]

  get:
    description: |
      Retrieves the current fan speed
    responses:
      200:
        body:
          application/json:
            schema: FanSpeed
            example: |
              {
                "rt": ["x.com.st.fanspeed"],
                "id": "unique_example_id",
                "fanSpeed":  20,
                "range":        [0,100],
                "step" : 10
              }

  post:
    description: |
      Sets the desired fan speed
    body:
      application/json:
        schema: FanSpeedUpdate
        example: |
          {
            "id":    "unique_example_id",
            "fanSpeed":  20
          }
    responses:
      200:
        body:
          application/json:
            schema: FanSpeedUpdate
            example: |
              {
                "id":    "unique_example_id",
                "fanSpeed":  20
              }
