{
  "swagger": "2.0",
  "info": {
    "title": "Restricted Switch",
    "version": "2019-11-19",
    "license": {
      "name": "OCF Data Model License",
      "url": "https://github.com/openconnectivityfoundation/core/blob/e28a9e0a92e17042ba3e83661e4c0fbce8bdc4ba/LICENSE.md",
      "x-copyright": "Copyright 2019 Open Connectivity Foundation, Inc. All rights reserved."
    },
    "termsOfService": "https://openconnectivityfoundation.github.io/core/DISCLAIMER.md"
  },
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/RestrictedSwitchResURI": {
      "get": {
        "description": "This Resource describes a switch(on/off) restricting UPDATE for 'on'.\nThe Property \"state\" is a Boolean.\nA state of True means that the switch is turned on.\nA state of False means that the switch is turned off.",
        "parameters": [
          {
            "$ref": "#/parameters/interface"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "x-example": {
              "rt": [
                "oic.r.switch.restricted"
              ],
              "if": [
                "oic.if.a",
                "oic.if.baseline"
              ],
              "state": true
            },
            "schema": {
              "$ref": "#/definitions/RestrictedSwitch"
            }
          }
        }
      },
      "post": {
        "description": "A request to set the state to true is not allowed in an UPDATE",
        "parameters": [
          {
            "$ref": "#/parameters/interface"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/RestrictedSwitchUpdate"
            },
            "x-example": {
              "state": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "x-example": {
              "state": false
            },
            "schema": {
              "$ref": "#/definitions/RestrictedSwitch"
            }
          },
          "403": {
            "description": "This response is generated by the OCF server when the client sends:\nAn UPDATE with an value for True.\n403 means the request is forbidden.\n",
            "x-example": {}
          }
        }
      }
    }
  },
  "parameters": {
    "interface": {
      "in": "query",
      "name": "if",
      "type": "string",
      "enum": [
        "oic.if.a",
        "oic.if.baseline"
      ]
    }
  },
  "definitions": {
    "RestrictedSwitch": {
      "properties": {
        "rt": {
          "description": "The Resource Type.",
          "items": {
            "enum": [
              "oic.r.switch.restricted"
            ],
            "maxLength": 64,
            "type": "string"
          },
          "minItems": 1,
          "uniqueItems": true,
          "readOnly": true,
          "type": "array"
        },
        "state": {
          "description": "The status of the restricted switch.",
          "type": "boolean"
        },
        "n": {
          "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/n"
        },
        "id": {
          "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/id"
        },
        "if": {
          "description": "The OCF Interface set supported by this Resource.",
          "items": {
            "enum": [
              "oic.if.a",
              "oic.if.baseline"
            ],
            "type": "string"
          },
          "minItems": 2,
          "uniqueItems": true,
          "readOnly": true,
          "type": "array"
        }
      },
      "type": "object",
      "required": [
        "state"
      ]
    },
    "RestrictedSwitchUpdate": {
      "properties": {
        "state": {
          "description": "Only False, which means 'off', is allowed in an UPDATE.",
          "enum": [
            false
          ],
          "type": "boolean"
        }
      },
      "type": "object",
      "required": [
        "state"
      ]
    }
  }
}