#%RAML 0.8
title: OCFBattery
version: v1.1.0-20160519
traits:
 - interface :
     queryParameters:
       if:
         enum: ["oic.if.s", "oic.if.baseline"]

/BatteryResURI:
  description: |
    This resource describes a battery function.
    The charge is an integer showing the current battery charge level.
    The charge is a percentage in the range 0-100.
    A value of 0 means fully discharged.
    A value of 100 means fully charged.

  displayName: Battery
  
  is : ['interface']
  get:
    description: |
      Retrieves the state of the battery.

    responses :
      200:
        body:
          application/json:
            schema: |
              {
                "id": "http://openinterconnect.org/iotdatamodels/schemas/oic.r.energy.battery.json#",
                "$schema": "http://json-schema.org/draft-04/schema#",
                "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.",
                "title": "Battery",
                "definitions": {
                  "oic.r.energy.battery": {
                    "type": "object",
                    "properties": {
                      "charge" : {
                        "type": "integer",
                        "description": "ReadOnly, The current charge percentage.",
                        "default": 25
                      }
                    }
                  }
                },
                "type": "object",
                "allOf": [
                  {"$ref": "oic.core.json#/definitions/oic.core"},
                  {"$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"},
                  {"$ref": "#/definitions/oic.r.energy.battery"}
                ],
                "required": [ "charge" ]
              }

            example: |
              {
                "rt":     ["oic.r.energy.battery"],
                "id":     "unique_example_id",
                "charge": 50
              }
