﻿{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "$id": "urn:OCPP:Cp:2:2018:4:MeterValuesRequest",
  "comment": "OCPP 2.0 - v1p0",
  "definitions": {
    "EncodingMethodEnumType": {
      "type": "string",
      "additionalProperties": true,
      "enum": [
        "Other",
        "DLMS Message",
        "COSEM Protected Data",
        "EDL"
      ]
    },
    "LocationEnumType": {
      "type": "string",
      "additionalProperties": true,
      "enum": [
        "Body",
        "Cable",
        "EV",
        "Inlet",
        "Outlet"
      ]
    },
    "MeasurandEnumType": {
      "type": "string",
      "additionalProperties": true,
      "enum": [
        "Current.Export",
        "Current.Import",
        "Current.Offered",
        "Energy.Active.Export.Register",
        "Energy.Active.Import.Register",
        "Energy.Reactive.Export.Register",
        "Energy.Reactive.Import.Register",
        "Energy.Active.Export.Interval",
        "Energy.Active.Import.Interval",
        "Energy.Active.Net",
        "Energy.Reactive.Export.Interval",
        "Energy.Reactive.Import.Interval",
        "Energy.Reactive.Net",
        "Energy.Apparent.Net",
        "Energy.Apparent.Import",
        "Energy.Apparent.Export",
        "Frequency",
        "Power.Active.Export",
        "Power.Active.Import",
        "Power.Factor",
        "Power.Offered",
        "Power.Reactive.Export",
        "Power.Reactive.Import",
        "SoC",
        "Voltage"
      ]
    },
    "PhaseEnumType": {
      "type": "string",
      "additionalProperties": true,
      "enum": [
        "L1",
        "L2",
        "L3",
        "N",
        "L1-N",
        "L2-N",
        "L3-N",
        "L1-L2",
        "L2-L3",
        "L3-L1"
      ]
    },
    "ReadingContextEnumType": {
      "type": "string",
      "additionalProperties": true,
      "enum": [
        "Interruption.Begin",
        "Interruption.End",
        "Other",
        "Sample.Clock",
        "Sample.Periodic",
        "Transaction.Begin",
        "Transaction.End",
        "Trigger"
      ]
    },
    "SignatureMethodEnumType": {
      "type": "string",
      "additionalProperties": true,
      "enum": [
        "ECDSAP256SHA256",
        "ECDSAP384SHA384",
        "ECDSA192SHA256"
      ]
    },
    "MeterValueType": {
      "javaType": "MeterValue",
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "sampledValue": {
          "type": "array",
          "additionalItems": false,
          "items": {
            "$ref": "#/definitions/SampledValueType"
          },
          "minItems": 1
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "timestamp",
        "sampledValue"
      ]
    },
    "SampledValueType": {
      "javaType": "SampledValue",
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "value": {
          "type": "number"
        },
        "context": {
          "$ref": "#/definitions/ReadingContextEnumType"
        },
        "measurand": {
          "$ref": "#/definitions/MeasurandEnumType"
        },
        "phase": {
          "$ref": "#/definitions/PhaseEnumType"
        },
        "location": {
          "$ref": "#/definitions/LocationEnumType"
        },
        "signedMeterValue": {
          "$ref": "#/definitions/SignedMeterValueType"
        },
        "unitOfMeasure": {
          "$ref": "#/definitions/UnitOfMeasureType"
        }
      },
      "required": [
        "value"
      ]
    },
    "SignedMeterValueType": {
      "javaType": "SignedMeterValue",
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "meterValueSignature": {
          "type": "string",
          "maxLength": 2500
        },
        "signatureMethod": {
          "$ref": "#/definitions/SignatureMethodEnumType"
        },
        "encodingMethod": {
          "$ref": "#/definitions/EncodingMethodEnumType"
        },
        "encodedMeterValue": {
          "type": "string",
          "maxLength": 512
        }
      },
      "required": [
        "meterValueSignature",
        "signatureMethod",
        "encodingMethod",
        "encodedMeterValue"
      ]
    },
    "UnitOfMeasureType": {
      "javaType": "UnitOfMeasure",
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "unit": {
          "type": "string",
          "maxLength": 20
        },
        "multiplier": {
          "type": "integer"
        }
      }
    }
  },
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "evseId": {
      "type": "integer"
    },
    "meterValue": {
      "type": "array",
      "additionalItems": false,
      "items": {
        "$ref": "#/definitions/MeterValueType"
      },
      "minItems": 1
    }
  },
  "required": [
    "evseId",
    "meterValue"
  ]
}