{
  "id": "http://openinterconnect.org/iotdatamodels/schemas/oic.r.energy.battery.json#",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description" : "Copyright (c) 2016, 2017 Open Connectivity Foundation, Inc. All rights reserved.",
  "title": "Battery",
  "definitions": {
    "oic.r.energy.battery": {
      "type": "object",
      "properties": {
        "charge" : {
          "type": "integer",
          "description": "The current charge percentage.",
          "readOnly": true,
          "minimum": 0,
          "maximum": 100
        },
        "capacity" : {
          "type": "number",
          "description": "The total capacity in Amp-hours (Ah).",
          "readOnly": true
        },
        "charging" : {
          "type": "boolean",
          "description": "The status of charging.",
          "readOnly": true
        },
        "discharging" : {
          "type": "boolean",
          "description": "The status of discharging.",
          "readOnly": true
        },
        "lowbattery" : {
          "type": "boolean",
          "description": "The status of the low battery warning based upon the defined threshold.",
          "readOnly": true
        },
        "batterythreshold" : {
          "type": "integer",
          "description": "The threshold percentage for the low battery warning.",
          "minimum": 0,
          "maximum": 100
        }
      }
    }
  },
  "type": "object",
  "allOf": [
    {"$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"},
    {"$ref": "#/definitions/oic.r.energy.battery"}
  ],
  "required": [ "charge" ]
}
