#%RAML 0.8
title: WWST Color Temperature
version: v1.0.0-20170918
schemas:
- ColorTemperature: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.color.temperature.json#",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "Copyright (c) 2016, 2017 Open Connectivity Foundation, Inc. All rights reserved.",
      "title": "WWST Color Temperature",
      "definitions": {
        "x.com.st.color.temperature": {
          "type": "object",
          "properties": {
            "ct": {
              "type": "integer",
              "description": "Current color temperature"
            },
            "range": {
              "type": "array",
              "description": "Array defining min,max values for this color temperature on this device",
              "items": {
                "type": "integer"
              },
              "readOnly": true
            }
          }
        }
      },
      "type": "object",
      "allOf": [
        {
          "$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"
        },
        {
          "$ref": "#/definitions/x.com.st.color.temperature"
        }
      ],
      "required": [
        "ct",
        "range"
      ]
    }
- ColorTemperatureUpdate: |
    {
      "id": "http://www.samsung.com/schemas/x.com.st.color.temperature.json#",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "Copyright (c) 2016, 2017 Open Connectivity Foundation, Inc. All rights reserved.",
      "title": "WWST Color Temperature",
      "definitions": {
        "x.com.st.color.temperature": {
          "type": "object",
          "properties": {
            "ct": {
              "type": "integer",
              "description": "Current color temperature"
            },
            "range": {
              "type": "array",
              "description": "Array defining min,max values for this color temperature on this device",
              "items": {
                "type": "integer"
              },
              "readOnly": true
            }
          }
        }
      },
      "type": "object",
      "allOf": [
        {
          "$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"
        },
        {
          "$ref": "#/definitions/x.com.st.color.temperature"
        }
      ],
      "required": [
        "ct"
      ]
    }

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

/WWSTColorTemperatureResURI:
  description: |
        Control the color temperature of lights
  displayName: WWST Color Temperature
  is: [ interface ]

  get:
    description: |
      Retrieves the color temperature of lights
    responses:
      200:
        body:
          application/json:
            schema: ColorTemperature
            example: |
              {
                "rt":           ["x.com.st.color.temperature"],
                "id":           "unique_example_id",
                "ct":  2700,
                "range":        [2700,8000]
              }

  post:
    description: |
      Sets the desired color temperature of lights
    body:
      application/json:
        schema: ColorTemperatureUpdate
        example: |
          {
            "id":           "unique_example_id",
            "ct":  2700
          }
    responses:
      200:
         body:
          application/json:
            schema: ColorTemperatureUpdate
            example: |
              {
                "id":          "unique_example_id",
                "temperature": 2700
              }
