// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 Kevin Vavelin, Codetics (https://codetics.fr)
//! OCPP 2.0.1 composite datatypes.
use ocpp_core::DateTime;
use ocpp_core::validate::{self as v, Path, Validate, Violation};
use serde::{Deserialize, Serialize};
use crate::enums::*;
/// AC_ Charging_ Parameters
/// EV AC charging parameters.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ACChargingParameters {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// AC_ Charging_ Parameters. Energy_ Amount. Energy_ Amount
/// Amount of energy requested (in Wh). This includes energy required for preconditioning.
#[serde(rename = "energyAmount")]
pub energy_amount: i64,
/// AC_ Charging_ Parameters. EV_ Min. Current
/// Minimum current (amps) supported by the electric vehicle (per phase).
#[serde(rename = "evMinCurrent")]
pub ev_min_current: i64,
/// AC_ Charging_ Parameters. EV_ Max. Current
/// Maximum current (amps) supported by the electric vehicle (per phase). Includes cable capacity.
#[serde(rename = "evMaxCurrent")]
pub ev_max_current: i64,
/// AC_ Charging_ Parameters. EV_ Max. Voltage
/// Maximum voltage supported by the electric vehicle
#[serde(rename = "evMaxVoltage")]
pub ev_max_voltage: i64,
}
impl Validate for ACChargingParameters {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}
/// APN
/// Collection of configuration data needed to make a data-connection over a cellular network.
/// NOTE: When asking a GSM modem to dial in, it is possible to specify which mobile operator should be used. This can be done with the mobile country code (MCC) in combination with a mobile network code (MNC). Example: If your preferred network is Vodafone Netherlands, the MCC=204 and the MNC=04 which means the key PreferredNetwork = 20404 Some modems allows to specify a preferred network, which means, if this network is not available, a different network is used. If you specify UseOnlyPreferredNetwork and this network is not available, the modem will not dial in.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct APN {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// APN. APN. URI
/// The Access Point Name as an URL.
#[serde(rename = "apn")]
pub apn: String,
/// APN. APN. User_ Name
/// APN username.
#[serde(
rename = "apnUserName",
default,
skip_serializing_if = "Option::is_none"
)]
pub apn_user_name: Option<String>,
/// APN. APN. Password
/// APN Password.
#[serde(
rename = "apnPassword",
default,
skip_serializing_if = "Option::is_none"
)]
pub apn_password: Option<String>,
/// APN. SIMPIN. PIN_ Code
/// SIM card pin code.
#[serde(rename = "simPin", default, skip_serializing_if = "Option::is_none")]
pub sim_pin: Option<i64>,
/// APN. Preferred_ Network. Mobile_ Network_ ID
/// Preferred network, written as MCC and MNC concatenated. See note.
#[serde(
rename = "preferredNetwork",
default,
skip_serializing_if = "Option::is_none"
)]
pub preferred_network: Option<String>,
/// APN. Use_ Only_ Preferred_ Network. Indicator
/// Default: false. Use only the preferred Network, do
/// not dial in when not available. See Note.
#[serde(
rename = "useOnlyPreferredNetwork",
default,
skip_serializing_if = "Option::is_none"
)]
pub use_only_preferred_network: Option<bool>,
#[serde(rename = "apnAuthentication")]
pub apn_authentication: APNAuthenticationEnum,
}
impl Validate for APN {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.apn;
let p = path.field("apn");
v::max_length(x, 512, &p)?;
}
if let Some(x) = &self.apn_user_name {
let p = path.field("apnUserName");
v::max_length(x, 20, &p)?;
}
if let Some(x) = &self.apn_password {
let p = path.field("apnPassword");
v::max_length(x, 20, &p)?;
}
if let Some(x) = &self.preferred_network {
let p = path.field("preferredNetwork");
v::max_length(x, 6, &p)?;
}
Ok(())
}
}
/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct AdditionalInfo {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// This field specifies the additional IdToken.
#[serde(rename = "additionalIdToken")]
pub additional_id_token: String,
/// This defines the type of the additionalIdToken. This is a custom type, so the implementation needs to be agreed upon by all involved parties.
#[serde(rename = "type")]
pub r#type: String,
}
impl Validate for AdditionalInfo {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.additional_id_token;
let p = path.field("additionalIdToken");
v::max_length(x, 36, &p)?;
}
{
let x = &self.r#type;
let p = path.field("type");
v::max_length(x, 50, &p)?;
}
Ok(())
}
}
/// Contains the identifier to use for authorization.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct AuthorizationData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "idToken")]
pub id_token: IdToken,
#[serde(
rename = "idTokenInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub id_token_info: Option<IdTokenInfo>,
}
impl Validate for AuthorizationData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.id_token;
let p = path.field("idToken");
x.validate(&p)?;
}
if let Some(x) = &self.id_token_info {
let p = path.field("idTokenInfo");
x.validate(&p)?;
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct CertificateHashData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "hashAlgorithm")]
pub hash_algorithm: HashAlgorithmEnum,
/// Hashed value of the Issuer DN (Distinguished Name).
#[serde(rename = "issuerNameHash")]
pub issuer_name_hash: String,
/// Hashed value of the issuers public key
#[serde(rename = "issuerKeyHash")]
pub issuer_key_hash: String,
/// The serial number of the certificate.
#[serde(rename = "serialNumber")]
pub serial_number: String,
}
impl Validate for CertificateHashData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.issuer_name_hash;
let p = path.field("issuerNameHash");
v::max_length(x, 128, &p)?;
}
{
let x = &self.issuer_key_hash;
let p = path.field("issuerKeyHash");
v::max_length(x, 128, &p)?;
}
{
let x = &self.serial_number;
let p = path.field("serialNumber");
v::max_length(x, 40, &p)?;
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct CertificateHashDataChain {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "certificateHashData")]
pub certificate_hash_data: CertificateHashData,
#[serde(rename = "certificateType")]
pub certificate_type: GetCertificateIdUseEnum,
#[serde(
rename = "childCertificateHashData",
default,
skip_serializing_if = "Option::is_none"
)]
pub child_certificate_hash_data: Option<Vec<CertificateHashData>>,
}
impl Validate for CertificateHashDataChain {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.certificate_hash_data;
let p = path.field("certificateHashData");
x.validate(&p)?;
}
if let Some(x) = &self.child_certificate_hash_data {
let p = path.field("childCertificateHashData");
v::items(x, Some(1), Some(4), &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
Ok(())
}
}
/// Charging_ Limit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ChargingLimit {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "chargingLimitSource")]
pub charging_limit_source: ChargingLimitSourceEnum,
/// Charging_ Limit. Is_ Grid_ Critical. Indicator
/// Indicates whether the charging limit is critical for the grid.
#[serde(
rename = "isGridCritical",
default,
skip_serializing_if = "Option::is_none"
)]
pub is_grid_critical: Option<bool>,
}
impl Validate for ChargingLimit {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}
/// Charging_ Needs
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ChargingNeeds {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(
rename = "acChargingParameters",
default,
skip_serializing_if = "Option::is_none"
)]
pub ac_charging_parameters: Option<ACChargingParameters>,
#[serde(
rename = "dcChargingParameters",
default,
skip_serializing_if = "Option::is_none"
)]
pub dc_charging_parameters: Option<DCChargingParameters>,
#[serde(rename = "requestedEnergyTransfer")]
pub requested_energy_transfer: EnergyTransferModeEnum,
/// Charging_ Needs. Departure_ Time. Date_ Time
/// Estimated departure time of the EV.
#[serde(
rename = "departureTime",
default,
skip_serializing_if = "Option::is_none"
)]
pub departure_time: Option<DateTime>,
}
impl Validate for ChargingNeeds {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.ac_charging_parameters {
let p = path.field("acChargingParameters");
x.validate(&p)?;
}
if let Some(x) = &self.dc_charging_parameters {
let p = path.field("dcChargingParameters");
x.validate(&p)?;
}
Ok(())
}
}
/// Charging_ Profile
/// A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ChargingProfile {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Identified_ Object. MRID. Numeric_ Identifier
/// Id of ChargingProfile.
#[serde(rename = "id")]
pub id: i64,
/// Charging_ Profile. Stack_ Level. Counter
/// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
#[serde(rename = "stackLevel")]
pub stack_level: i64,
#[serde(rename = "chargingProfilePurpose")]
pub charging_profile_purpose: ChargingProfilePurposeEnum,
#[serde(rename = "chargingProfileKind")]
pub charging_profile_kind: ChargingProfileKindEnum,
#[serde(
rename = "recurrencyKind",
default,
skip_serializing_if = "Option::is_none"
)]
pub recurrency_kind: Option<RecurrencyKindEnum>,
/// Charging_ Profile. Valid_ From. Date_ Time
/// Point in time at which the profile starts to be valid. If absent, the profile is valid as soon as it is received by the Charging Station.
#[serde(rename = "validFrom", default, skip_serializing_if = "Option::is_none")]
pub valid_from: Option<DateTime>,
/// Charging_ Profile. Valid_ To. Date_ Time
/// Point in time at which the profile stops to be valid. If absent, the profile is valid until it is replaced by another profile.
#[serde(rename = "validTo", default, skip_serializing_if = "Option::is_none")]
pub valid_to: Option<DateTime>,
#[serde(rename = "chargingSchedule")]
pub charging_schedule: Vec<ChargingSchedule>,
/// SHALL only be included if ChargingProfilePurpose is set to TxProfile. The transactionId is used to match the profile to a specific transaction.
#[serde(
rename = "transactionId",
default,
skip_serializing_if = "Option::is_none"
)]
pub transaction_id: Option<String>,
}
impl Validate for ChargingProfile {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.charging_schedule;
let p = path.field("chargingSchedule");
v::items(x, Some(1), Some(3), &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
if let Some(x) = &self.transaction_id {
let p = path.field("transactionId");
v::max_length(x, 36, &p)?;
}
Ok(())
}
}
/// Charging_ Profile
/// A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ChargingProfileCriterion {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(
rename = "chargingProfilePurpose",
default,
skip_serializing_if = "Option::is_none"
)]
pub charging_profile_purpose: Option<ChargingProfilePurposeEnum>,
/// Charging_ Profile. Stack_ Level. Counter
/// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
#[serde(
rename = "stackLevel",
default,
skip_serializing_if = "Option::is_none"
)]
pub stack_level: Option<i64>,
/// List of all the chargingProfileIds requested. Any ChargingProfile that matches one of these profiles will be reported. If omitted, the Charging Station SHALL not filter on chargingProfileId. This field SHALL NOT contain more ids than set in <<configkey-charging-profile-entries,ChargingProfileEntries.maxLimit>>
#[serde(
rename = "chargingProfileId",
default,
skip_serializing_if = "Option::is_none"
)]
pub charging_profile_id: Option<Vec<i64>>,
/// For which charging limit sources, charging profiles SHALL be reported. If omitted, the Charging Station SHALL not filter on chargingLimitSource.
#[serde(
rename = "chargingLimitSource",
default,
skip_serializing_if = "Option::is_none"
)]
pub charging_limit_source: Option<Vec<ChargingLimitSourceEnum>>,
}
impl Validate for ChargingProfileCriterion {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.charging_profile_id {
let p = path.field("chargingProfileId");
v::items(x, Some(1), None, &p)?;
}
if let Some(x) = &self.charging_limit_source {
let p = path.field("chargingLimitSource");
v::items(x, Some(1), Some(4), &p)?;
}
Ok(())
}
}
/// Charging_ Schedule
/// Charging schedule structure defines a list of charging periods, as used in: GetCompositeSchedule.conf and ChargingProfile.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ChargingSchedule {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Identifies the ChargingSchedule.
#[serde(rename = "id")]
pub id: i64,
/// Charging_ Schedule. Start_ Schedule. Date_ Time
/// Starting point of an absolute schedule. If absent the schedule will be relative to start of charging.
#[serde(
rename = "startSchedule",
default,
skip_serializing_if = "Option::is_none"
)]
pub start_schedule: Option<DateTime>,
/// Charging_ Schedule. Duration. Elapsed_ Time
/// Duration of the charging schedule in seconds. If the duration is left empty, the last period will continue indefinitely or until end of the transaction if chargingProfilePurpose = TxProfile.
#[serde(rename = "duration", default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[serde(rename = "chargingRateUnit")]
pub charging_rate_unit: ChargingRateUnitEnum,
#[serde(rename = "chargingSchedulePeriod")]
pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
/// Charging_ Schedule. Min_ Charging_ Rate. Numeric
/// Minimum charging rate supported by the EV. The unit of measure is defined by the chargingRateUnit. This parameter is intended to be used by a local smart charging algorithm to optimize the power allocation for in the case a charging process is inefficient at lower charging rates. Accepts at most one digit fraction (e.g. 8.1)
#[serde(
rename = "minChargingRate",
default,
skip_serializing_if = "Option::is_none"
)]
pub min_charging_rate: Option<f64>,
#[serde(
rename = "salesTariff",
default,
skip_serializing_if = "Option::is_none"
)]
pub sales_tariff: Option<SalesTariff>,
}
impl Validate for ChargingSchedule {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.charging_schedule_period;
let p = path.field("chargingSchedulePeriod");
v::items(x, Some(1), Some(1024), &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
if let Some(x) = &self.sales_tariff {
let p = path.field("salesTariff");
x.validate(&p)?;
}
Ok(())
}
}
/// Charging_ Schedule_ Period
/// Charging schedule period structure defines a time period in a charging schedule.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ChargingSchedulePeriod {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Charging_ Schedule_ Period. Start_ Period. Elapsed_ Time
/// Start of the period, in seconds from the start of schedule. The value of StartPeriod also defines the stop time of the previous period.
#[serde(rename = "startPeriod")]
pub start_period: i64,
/// Charging_ Schedule_ Period. Limit. Measure
/// Charging rate limit during the schedule period, in the applicable chargingRateUnit, for example in Amperes (A) or Watts (W). Accepts at most one digit fraction (e.g. 8.1).
#[serde(rename = "limit")]
pub limit: f64,
/// Charging_ Schedule_ Period. Number_ Phases. Counter
/// The number of phases that can be used for charging. If a number of phases is needed, numberPhases=3 will be assumed unless another number is given.
#[serde(
rename = "numberPhases",
default,
skip_serializing_if = "Option::is_none"
)]
pub number_phases: Option<i64>,
/// Values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching the phase connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true. It’s not allowed unless both conditions above are true. If both conditions are true, and phaseToUse is omitted, the Charging Station / EVSE will make the selection on its own.
#[serde(
rename = "phaseToUse",
default,
skip_serializing_if = "Option::is_none"
)]
pub phase_to_use: Option<i64>,
}
impl Validate for ChargingSchedulePeriod {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}
/// Charge_ Point
/// The physical system where an Electrical Vehicle (EV) can be charged.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ChargingStation {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Device. Serial_ Number. Serial_ Number
/// Vendor-specific device identifier.
#[serde(
rename = "serialNumber",
default,
skip_serializing_if = "Option::is_none"
)]
pub serial_number: Option<String>,
/// Device. Model. CI20_ Text
/// Defines the model of the device.
#[serde(rename = "model")]
pub model: String,
#[serde(rename = "modem", default, skip_serializing_if = "Option::is_none")]
pub modem: Option<Modem>,
/// Identifies the vendor (not necessarily in a unique manner).
#[serde(rename = "vendorName")]
pub vendor_name: String,
/// This contains the firmware version of the Charging Station.
#[serde(
rename = "firmwareVersion",
default,
skip_serializing_if = "Option::is_none"
)]
pub firmware_version: Option<String>,
}
impl Validate for ChargingStation {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.serial_number {
let p = path.field("serialNumber");
v::max_length(x, 25, &p)?;
}
{
let x = &self.model;
let p = path.field("model");
v::max_length(x, 20, &p)?;
}
if let Some(x) = &self.modem {
let p = path.field("modem");
x.validate(&p)?;
}
{
let x = &self.vendor_name;
let p = path.field("vendorName");
v::max_length(x, 50, &p)?;
}
if let Some(x) = &self.firmware_version {
let p = path.field("firmwareVersion");
v::max_length(x, 50, &p)?;
}
Ok(())
}
}
/// Charging_ Profile
/// A ChargingProfile consists of a ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ClearChargingProfile {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Identified_ Object. MRID. Numeric_ Identifier
/// Specifies the id of the EVSE for which to clear charging profiles. An evseId of zero (0) specifies the charging profile for the overall Charging Station. Absence of this parameter means the clearing applies to all charging profiles that match the other criteria in the request.
#[serde(rename = "evseId", default, skip_serializing_if = "Option::is_none")]
pub evse_id: Option<i64>,
#[serde(
rename = "chargingProfilePurpose",
default,
skip_serializing_if = "Option::is_none"
)]
pub charging_profile_purpose: Option<ChargingProfilePurposeEnum>,
/// Charging_ Profile. Stack_ Level. Counter
/// Specifies the stackLevel for which charging profiles will be cleared, if they meet the other criteria in the request.
#[serde(
rename = "stackLevel",
default,
skip_serializing_if = "Option::is_none"
)]
pub stack_level: Option<i64>,
}
impl Validate for ClearChargingProfile {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ClearMonitoringResult {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "status")]
pub status: ClearMonitoringStatusEnum,
/// Id of the monitor of which a clear was requested.
#[serde(rename = "id")]
pub id: i64,
#[serde(
rename = "statusInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub status_info: Option<StatusInfo>,
}
impl Validate for ClearMonitoringResult {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.status_info {
let p = path.field("statusInfo");
x.validate(&p)?;
}
Ok(())
}
}
/// A physical or logical component
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Component {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "evse", default, skip_serializing_if = "Option::is_none")]
pub evse: Option<EVSE>,
/// Name of the component. Name should be taken from the list of standardized component names whenever possible. Case Insensitive. strongly advised to use Camel Case.
#[serde(rename = "name")]
pub name: String,
/// Name of instance in case the component exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
#[serde(rename = "instance", default, skip_serializing_if = "Option::is_none")]
pub instance: Option<String>,
}
impl Validate for Component {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.evse {
let p = path.field("evse");
x.validate(&p)?;
}
{
let x = &self.name;
let p = path.field("name");
v::max_length(x, 50, &p)?;
}
if let Some(x) = &self.instance {
let p = path.field("instance");
v::max_length(x, 50, &p)?;
}
Ok(())
}
}
/// Class to report components, variables and variable attributes and characteristics.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ComponentVariable {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable", default, skip_serializing_if = "Option::is_none")]
pub variable: Option<Variable>,
}
impl Validate for ComponentVariable {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
if let Some(x) = &self.variable {
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
/// Composite_ Schedule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct CompositeSchedule {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "chargingSchedulePeriod")]
pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
/// The ID of the EVSE for which the
/// schedule is requested. When evseid=0, the
/// Charging Station calculated the expected
/// consumption for the grid connection.
#[serde(rename = "evseId")]
pub evse_id: i64,
/// Duration of the schedule in seconds.
#[serde(rename = "duration")]
pub duration: i64,
/// Composite_ Schedule. Start. Date_ Time
/// Date and time at which the schedule becomes active. All time measurements within the schedule are relative to this timestamp.
#[serde(rename = "scheduleStart")]
pub schedule_start: DateTime,
#[serde(rename = "chargingRateUnit")]
pub charging_rate_unit: ChargingRateUnitEnum,
}
impl Validate for CompositeSchedule {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.charging_schedule_period;
let p = path.field("chargingSchedulePeriod");
v::items(x, Some(1), None, &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
Ok(())
}
}
/// Consumption_ Cost
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ConsumptionCost {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Consumption_ Cost. Start_ Value. Numeric
/// The lowest level of consumption that defines the starting point of this consumption block. The block interval extends to the start of the next interval.
#[serde(rename = "startValue")]
pub start_value: f64,
#[serde(rename = "cost")]
pub cost: Vec<Cost>,
}
impl Validate for ConsumptionCost {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.cost;
let p = path.field("cost");
v::items(x, Some(1), Some(3), &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
Ok(())
}
}
/// Cost
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Cost {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "costKind")]
pub cost_kind: CostKindEnum,
/// Cost. Amount. Amount
/// The estimated or actual cost per kWh
#[serde(rename = "amount")]
pub amount: i64,
/// Cost. Amount_ Multiplier. Integer
/// Values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value is determined by: amount * 10 ^ amountMultiplier
#[serde(
rename = "amountMultiplier",
default,
skip_serializing_if = "Option::is_none"
)]
pub amount_multiplier: Option<i64>,
}
impl Validate for Cost {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}
/// This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CustomData {
#[serde(rename = "vendorId")]
pub vendor_id: String,
/// Vendor-specific properties.
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
impl Validate for CustomData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
{
let x = &self.vendor_id;
let p = path.field("vendorId");
v::max_length(x, 255, &p)?;
}
Ok(())
}
}
/// DC_ Charging_ Parameters
/// EV DC charging parameters
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DCChargingParameters {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// DC_ Charging_ Parameters. EV_ Max. Current
/// Maximum current (amps) supported by the electric vehicle. Includes cable capacity.
#[serde(rename = "evMaxCurrent")]
pub ev_max_current: i64,
/// DC_ Charging_ Parameters. EV_ Max. Voltage
/// Maximum voltage supported by the electric vehicle
#[serde(rename = "evMaxVoltage")]
pub ev_max_voltage: i64,
/// DC_ Charging_ Parameters. Energy_ Amount. Energy_ Amount
/// Amount of energy requested (in Wh). This inludes energy required for preconditioning.
#[serde(
rename = "energyAmount",
default,
skip_serializing_if = "Option::is_none"
)]
pub energy_amount: Option<i64>,
/// DC_ Charging_ Parameters. EV_ Max. Power
/// Maximum power (in W) supported by the electric vehicle. Required for DC charging.
#[serde(
rename = "evMaxPower",
default,
skip_serializing_if = "Option::is_none"
)]
pub ev_max_power: Option<i64>,
/// DC_ Charging_ Parameters. State_ Of_ Charge. Numeric
/// Energy available in the battery (in percent of the battery capacity)
#[serde(
rename = "stateOfCharge",
default,
skip_serializing_if = "Option::is_none"
)]
pub state_of_charge: Option<i64>,
/// DC_ Charging_ Parameters. EV_ Energy_ Capacity. Numeric
/// Capacity of the electric vehicle battery (in Wh)
#[serde(
rename = "evEnergyCapacity",
default,
skip_serializing_if = "Option::is_none"
)]
pub ev_energy_capacity: Option<i64>,
/// DC_ Charging_ Parameters. Full_ SOC. Percentage
/// Percentage of SoC at which the EV considers the battery fully charged. (possible values: 0 - 100)
#[serde(rename = "fullSoC", default, skip_serializing_if = "Option::is_none")]
pub full_so_c: Option<i64>,
/// DC_ Charging_ Parameters. Bulk_ SOC. Percentage
/// Percentage of SoC at which the EV considers a fast charging process to end. (possible values: 0 - 100)
#[serde(rename = "bulkSoC", default, skip_serializing_if = "Option::is_none")]
pub bulk_so_c: Option<i64>,
}
impl Validate for DCChargingParameters {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.state_of_charge {
let p = path.field("stateOfCharge");
v::minimum(*x, 0i64, &p)?;
v::maximum(*x, 100i64, &p)?;
}
if let Some(x) = &self.full_so_c {
let p = path.field("fullSoC");
v::minimum(*x, 0i64, &p)?;
v::maximum(*x, 100i64, &p)?;
}
if let Some(x) = &self.bulk_so_c {
let p = path.field("bulkSoC");
v::minimum(*x, 0i64, &p)?;
v::maximum(*x, 100i64, &p)?;
}
Ok(())
}
}
/// EVSE
/// Electric Vehicle Supply Equipment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct EVSE {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Identified_ Object. MRID. Numeric_ Identifier
/// EVSE Identifier. This contains a number (> 0) designating an EVSE of the Charging Station.
#[serde(rename = "id")]
pub id: i64,
/// An id to designate a specific connector (on an EVSE) by connector index number.
#[serde(
rename = "connectorId",
default,
skip_serializing_if = "Option::is_none"
)]
pub connector_id: Option<i64>,
}
impl Validate for EVSE {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}
/// Class to report an event notification for a component-variable.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct EventData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Identifies the event. This field can be referred to as a cause by other events.
#[serde(rename = "eventId")]
pub event_id: i64,
/// Timestamp of the moment the report was generated.
#[serde(rename = "timestamp")]
pub timestamp: DateTime,
#[serde(rename = "trigger")]
pub trigger: EventTriggerEnum,
/// Refers to the Id of an event that is considered to be the cause for this event.
#[serde(rename = "cause", default, skip_serializing_if = "Option::is_none")]
pub cause: Option<i64>,
/// Actual value (_attributeType_ Actual) of the variable.
/// The Configuration Variable <<configkey-reporting-value-size,ReportingValueSize>> can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
#[serde(rename = "actualValue")]
pub actual_value: String,
/// Technical (error) code as reported by component.
#[serde(rename = "techCode", default, skip_serializing_if = "Option::is_none")]
pub tech_code: Option<String>,
/// Technical detail information as reported by component.
#[serde(rename = "techInfo", default, skip_serializing_if = "Option::is_none")]
pub tech_info: Option<String>,
/// _Cleared_ is set to true to report the clearing of a monitored situation, i.e. a 'return to normal'.
#[serde(rename = "cleared", default, skip_serializing_if = "Option::is_none")]
pub cleared: Option<bool>,
/// If an event notification is linked to a specific transaction, this field can be used to specify its transactionId.
#[serde(
rename = "transactionId",
default,
skip_serializing_if = "Option::is_none"
)]
pub transaction_id: Option<String>,
#[serde(rename = "component")]
pub component: Component,
/// Identifies the VariableMonitoring which triggered the event.
#[serde(
rename = "variableMonitoringId",
default,
skip_serializing_if = "Option::is_none"
)]
pub variable_monitoring_id: Option<i64>,
#[serde(rename = "eventNotificationType")]
pub event_notification_type: EventNotificationEnum,
#[serde(rename = "variable")]
pub variable: Variable,
}
impl Validate for EventData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.actual_value;
let p = path.field("actualValue");
v::max_length(x, 2500, &p)?;
}
if let Some(x) = &self.tech_code {
let p = path.field("techCode");
v::max_length(x, 50, &p)?;
}
if let Some(x) = &self.tech_info {
let p = path.field("techInfo");
v::max_length(x, 500, &p)?;
}
if let Some(x) = &self.transaction_id {
let p = path.field("transactionId");
v::max_length(x, 36, &p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
/// Firmware
/// Represents a copy of the firmware that can be loaded/updated on the Charging Station.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Firmware {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Firmware. Location. URI
/// URI defining the origin of the firmware.
#[serde(rename = "location")]
pub location: String,
/// Firmware. Retrieve. Date_ Time
/// Date and time at which the firmware shall be retrieved.
#[serde(rename = "retrieveDateTime")]
pub retrieve_date_time: DateTime,
/// Firmware. Install. Date_ Time
/// Date and time at which the firmware shall be installed.
#[serde(
rename = "installDateTime",
default,
skip_serializing_if = "Option::is_none"
)]
pub install_date_time: Option<DateTime>,
/// Certificate with which the firmware was signed.
/// PEM encoded X.509 certificate.
#[serde(
rename = "signingCertificate",
default,
skip_serializing_if = "Option::is_none"
)]
pub signing_certificate: Option<String>,
/// Firmware. Signature. Signature
/// Base64 encoded firmware signature.
#[serde(rename = "signature", default, skip_serializing_if = "Option::is_none")]
pub signature: Option<String>,
}
impl Validate for Firmware {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.location;
let p = path.field("location");
v::max_length(x, 512, &p)?;
}
if let Some(x) = &self.signing_certificate {
let p = path.field("signingCertificate");
v::max_length(x, 5500, &p)?;
}
if let Some(x) = &self.signature {
let p = path.field("signature");
v::max_length(x, 800, &p)?;
}
Ok(())
}
}
/// Class to hold parameters for GetVariables request.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GetVariableData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(
rename = "attributeType",
default,
skip_serializing_if = "Option::is_none"
)]
pub attribute_type: Option<AttributeEnum>,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
}
impl Validate for GetVariableData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
/// Class to hold results of GetVariables request.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GetVariableResult {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(
rename = "attributeStatusInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub attribute_status_info: Option<StatusInfo>,
#[serde(rename = "attributeStatus")]
pub attribute_status: GetVariableStatusEnum,
#[serde(
rename = "attributeType",
default,
skip_serializing_if = "Option::is_none"
)]
pub attribute_type: Option<AttributeEnum>,
/// Value of requested attribute type of component-variable. This field can only be empty when the given status is NOT accepted.
/// The Configuration Variable <<configkey-reporting-value-size,ReportingValueSize>> can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
#[serde(
rename = "attributeValue",
default,
skip_serializing_if = "Option::is_none"
)]
pub attribute_value: Option<String>,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
}
impl Validate for GetVariableResult {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.attribute_status_info {
let p = path.field("attributeStatusInfo");
x.validate(&p)?;
}
if let Some(x) = &self.attribute_value {
let p = path.field("attributeValue");
v::max_length(x, 2500, &p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct IdToken {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(
rename = "additionalInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub additional_info: Option<Vec<AdditionalInfo>>,
/// IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also contain a UUID.
#[serde(rename = "idToken")]
pub id_token: String,
#[serde(rename = "type")]
pub r#type: IdTokenEnum,
}
impl Validate for IdToken {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.additional_info {
let p = path.field("additionalInfo");
v::items(x, Some(1), None, &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
{
let x = &self.id_token;
let p = path.field("idToken");
v::max_length(x, 36, &p)?;
}
Ok(())
}
}
/// ID_ Token
/// Contains status information about an identifier.
/// It is advised to not stop charging for a token that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is not given, the status has no end date.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct IdTokenInfo {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "status")]
pub status: AuthorizationStatusEnum,
/// ID_ Token. Expiry. Date_ Time
/// Date and Time after which the token must be considered invalid.
#[serde(
rename = "cacheExpiryDateTime",
default,
skip_serializing_if = "Option::is_none"
)]
pub cache_expiry_date_time: Option<DateTime>,
/// Priority from a business point of view. Default priority is 0, The range is from -9 to 9. Higher values indicate a higher priority. The chargingPriority in <<transactioneventresponse,TransactionEventResponse>> overrules this one.
#[serde(
rename = "chargingPriority",
default,
skip_serializing_if = "Option::is_none"
)]
pub charging_priority: Option<i64>,
/// ID_ Token. Language1. Language_ Code
/// Preferred user interface language of identifier user. Contains a language code as defined in <<ref-RFC5646,\[RFC5646\]>>.
#[serde(rename = "language1", default, skip_serializing_if = "Option::is_none")]
pub language1: Option<String>,
/// Only used when the IdToken is only valid for one or more specific EVSEs, not for the entire Charging Station.
#[serde(rename = "evseId", default, skip_serializing_if = "Option::is_none")]
pub evse_id: Option<Vec<i64>>,
#[serde(
rename = "groupIdToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub group_id_token: Option<IdToken>,
/// ID_ Token. Language2. Language_ Code
/// Second preferred user interface language of identifier user. Don’t use when language1 is omitted, has to be different from language1. Contains a language code as defined in <<ref-RFC5646,\[RFC5646\]>>.
#[serde(rename = "language2", default, skip_serializing_if = "Option::is_none")]
pub language2: Option<String>,
#[serde(
rename = "personalMessage",
default,
skip_serializing_if = "Option::is_none"
)]
pub personal_message: Option<MessageContent>,
}
impl Validate for IdTokenInfo {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.language1 {
let p = path.field("language1");
v::max_length(x, 8, &p)?;
}
if let Some(x) = &self.evse_id {
let p = path.field("evseId");
v::items(x, Some(1), None, &p)?;
}
if let Some(x) = &self.group_id_token {
let p = path.field("groupIdToken");
x.validate(&p)?;
}
if let Some(x) = &self.language2 {
let p = path.field("language2");
v::max_length(x, 8, &p)?;
}
if let Some(x) = &self.personal_message {
let p = path.field("personalMessage");
x.validate(&p)?;
}
Ok(())
}
}
/// Log
/// Generic class for the configuration of logging entries.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct LogParameters {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Log. Remote_ Location. URI
/// The URL of the location at the remote system where the log should be stored.
#[serde(rename = "remoteLocation")]
pub remote_location: String,
/// Log. Oldest_ Timestamp. Date_ Time
/// This contains the date and time of the oldest logging information to include in the diagnostics.
#[serde(
rename = "oldestTimestamp",
default,
skip_serializing_if = "Option::is_none"
)]
pub oldest_timestamp: Option<DateTime>,
/// Log. Latest_ Timestamp. Date_ Time
/// This contains the date and time of the latest logging information to include in the diagnostics.
#[serde(
rename = "latestTimestamp",
default,
skip_serializing_if = "Option::is_none"
)]
pub latest_timestamp: Option<DateTime>,
}
impl Validate for LogParameters {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.remote_location;
let p = path.field("remoteLocation");
v::max_length(x, 512, &p)?;
}
Ok(())
}
}
/// Message_ Content
/// Contains message details, for a message to be displayed on a Charging Station.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct MessageContent {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "format")]
pub format: MessageFormatEnum,
/// Message_ Content. Language. Language_ Code
/// Message language identifier. Contains a language code as defined in <<ref-RFC5646,\[RFC5646\]>>.
#[serde(rename = "language", default, skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
/// Message_ Content. Content. Message
/// Message contents.
#[serde(rename = "content")]
pub content: String,
}
impl Validate for MessageContent {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.language {
let p = path.field("language");
v::max_length(x, 8, &p)?;
}
{
let x = &self.content;
let p = path.field("content");
v::max_length(x, 512, &p)?;
}
Ok(())
}
}
/// Message_ Info
/// Contains message details, for a message to be displayed on a Charging Station.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct MessageInfo {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "display", default, skip_serializing_if = "Option::is_none")]
pub display: Option<Component>,
/// Identified_ Object. MRID. Numeric_ Identifier
/// Master resource identifier, unique within an exchange context. It is defined within the OCPP context as a positive Integer value (greater or equal to zero).
#[serde(rename = "id")]
pub id: i64,
#[serde(rename = "priority")]
pub priority: MessagePriorityEnum,
#[serde(rename = "state", default, skip_serializing_if = "Option::is_none")]
pub state: Option<MessageStateEnum>,
/// Message_ Info. Start. Date_ Time
/// From what date-time should this message be shown. If omitted: directly.
#[serde(
rename = "startDateTime",
default,
skip_serializing_if = "Option::is_none"
)]
pub start_date_time: Option<DateTime>,
/// Message_ Info. End. Date_ Time
/// Until what date-time should this message be shown, after this date/time this message SHALL be removed.
#[serde(
rename = "endDateTime",
default,
skip_serializing_if = "Option::is_none"
)]
pub end_date_time: Option<DateTime>,
/// During which transaction shall this message be shown.
/// Message SHALL be removed by the Charging Station after transaction has
/// ended.
#[serde(
rename = "transactionId",
default,
skip_serializing_if = "Option::is_none"
)]
pub transaction_id: Option<String>,
#[serde(rename = "message")]
pub message: MessageContent,
}
impl Validate for MessageInfo {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.display {
let p = path.field("display");
x.validate(&p)?;
}
if let Some(x) = &self.transaction_id {
let p = path.field("transactionId");
v::max_length(x, 36, &p)?;
}
{
let x = &self.message;
let p = path.field("message");
x.validate(&p)?;
}
Ok(())
}
}
/// Meter_ Value
/// Collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All sampled values in a MeterValue are sampled at the same point in time.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct MeterValue {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "sampledValue")]
pub sampled_value: Vec<SampledValue>,
/// Meter_ Value. Timestamp. Date_ Time
/// Timestamp for measured value(s).
#[serde(rename = "timestamp")]
pub timestamp: DateTime,
}
impl Validate for MeterValue {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.sampled_value;
let p = path.field("sampledValue");
v::items(x, Some(1), None, &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
Ok(())
}
}
/// Wireless_ Communication_ Module
/// Defines parameters required for initiating and maintaining wireless communication with other devices.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Modem {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Wireless_ Communication_ Module. ICCID. CI20_ Text
/// This contains the ICCID of the modem’s SIM card.
#[serde(rename = "iccid", default, skip_serializing_if = "Option::is_none")]
pub iccid: Option<String>,
/// Wireless_ Communication_ Module. IMSI. CI20_ Text
/// This contains the IMSI of the modem’s SIM card.
#[serde(rename = "imsi", default, skip_serializing_if = "Option::is_none")]
pub imsi: Option<String>,
}
impl Validate for Modem {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.iccid {
let p = path.field("iccid");
v::max_length(x, 20, &p)?;
}
if let Some(x) = &self.imsi {
let p = path.field("imsi");
v::max_length(x, 20, &p)?;
}
Ok(())
}
}
/// Class to hold parameters of SetVariableMonitoring request.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct MonitoringData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
#[serde(rename = "variableMonitoring")]
pub variable_monitoring: Vec<VariableMonitoring>,
}
impl Validate for MonitoringData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
{
let x = &self.variable_monitoring;
let p = path.field("variableMonitoring");
v::items(x, Some(1), None, &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
Ok(())
}
}
/// Communication_ Function
/// The NetworkConnectionProfile defines the functional and technical parameters of a communication link.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct NetworkConnectionProfile {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "apn", default, skip_serializing_if = "Option::is_none")]
pub apn: Option<APN>,
#[serde(rename = "ocppVersion")]
pub ocpp_version: OCPPVersionEnum,
#[serde(rename = "ocppTransport")]
pub ocpp_transport: OCPPTransportEnum,
/// Communication_ Function. OCPP_ Central_ System_ URL. URI
/// URL of the CSMS(s) that this Charging Station communicates with.
#[serde(rename = "ocppCsmsUrl")]
pub ocpp_csms_url: String,
/// Duration in seconds before a message send by the Charging Station via this network connection times-out.
/// The best setting depends on the underlying network and response times of the CSMS.
/// If you are looking for a some guideline: use 30 seconds as a starting point.
#[serde(rename = "messageTimeout")]
pub message_timeout: i64,
/// This field specifies the security profile used when connecting to the CSMS with this NetworkConnectionProfile.
#[serde(rename = "securityProfile")]
pub security_profile: i64,
#[serde(rename = "ocppInterface")]
pub ocpp_interface: OCPPInterfaceEnum,
#[serde(rename = "vpn", default, skip_serializing_if = "Option::is_none")]
pub vpn: Option<VPN>,
}
impl Validate for NetworkConnectionProfile {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.apn {
let p = path.field("apn");
x.validate(&p)?;
}
{
let x = &self.ocpp_csms_url;
let p = path.field("ocppCsmsUrl");
v::max_length(x, 512, &p)?;
}
if let Some(x) = &self.vpn {
let p = path.field("vpn");
x.validate(&p)?;
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct OCSPRequestData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "hashAlgorithm")]
pub hash_algorithm: HashAlgorithmEnum,
/// Hashed value of the Issuer DN (Distinguished Name).
#[serde(rename = "issuerNameHash")]
pub issuer_name_hash: String,
/// Hashed value of the issuers public key
#[serde(rename = "issuerKeyHash")]
pub issuer_key_hash: String,
/// The serial number of the certificate.
#[serde(rename = "serialNumber")]
pub serial_number: String,
/// This contains the responder URL (Case insensitive).
#[serde(rename = "responderURL")]
pub responder_url: String,
}
impl Validate for OCSPRequestData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.issuer_name_hash;
let p = path.field("issuerNameHash");
v::max_length(x, 128, &p)?;
}
{
let x = &self.issuer_key_hash;
let p = path.field("issuerKeyHash");
v::max_length(x, 128, &p)?;
}
{
let x = &self.serial_number;
let p = path.field("serialNumber");
v::max_length(x, 40, &p)?;
}
{
let x = &self.responder_url;
let p = path.field("responderURL");
v::max_length(x, 512, &p)?;
}
Ok(())
}
}
/// Relative_ Timer_ Interval
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct RelativeTimeInterval {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Relative_ Timer_ Interval. Start. Elapsed_ Time
/// Start of the interval, in seconds from NOW.
#[serde(rename = "start")]
pub start: i64,
/// Relative_ Timer_ Interval. Duration. Elapsed_ Time
/// Duration of the interval, in seconds.
#[serde(rename = "duration", default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
}
impl Validate for RelativeTimeInterval {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}
/// Class to report components, variables and variable attributes and characteristics.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ReportData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
#[serde(rename = "variableAttribute")]
pub variable_attribute: Vec<VariableAttribute>,
#[serde(
rename = "variableCharacteristics",
default,
skip_serializing_if = "Option::is_none"
)]
pub variable_characteristics: Option<VariableCharacteristics>,
}
impl Validate for ReportData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
{
let x = &self.variable_attribute;
let p = path.field("variableAttribute");
v::items(x, Some(1), Some(4), &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
if let Some(x) = &self.variable_characteristics {
let p = path.field("variableCharacteristics");
x.validate(&p)?;
}
Ok(())
}
}
/// Sales_ Tariff
/// NOTE: This dataType is based on dataTypes from <<ref-ISOIEC15118-2,ISO 15118-2>>.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SalesTariff {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Identified_ Object. MRID. Numeric_ Identifier
/// SalesTariff identifier used to identify one sales tariff. An SAID remains a unique identifier for one schedule throughout a charging session.
#[serde(rename = "id")]
pub id: i64,
/// Sales_ Tariff. Sales. Tariff_ Description
/// A human readable title/short description of the sales tariff e.g. for HMI display purposes.
#[serde(
rename = "salesTariffDescription",
default,
skip_serializing_if = "Option::is_none"
)]
pub sales_tariff_description: Option<String>,
/// Sales_ Tariff. Num_ E_ Price_ Levels. Counter
/// Defines the overall number of distinct price levels used across all provided SalesTariff elements.
#[serde(
rename = "numEPriceLevels",
default,
skip_serializing_if = "Option::is_none"
)]
pub num_e_price_levels: Option<i64>,
#[serde(rename = "salesTariffEntry")]
pub sales_tariff_entry: Vec<SalesTariffEntry>,
}
impl Validate for SalesTariff {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.sales_tariff_description {
let p = path.field("salesTariffDescription");
v::max_length(x, 32, &p)?;
}
{
let x = &self.sales_tariff_entry;
let p = path.field("salesTariffEntry");
v::items(x, Some(1), Some(1024), &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
Ok(())
}
}
/// Sales_ Tariff_ Entry
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SalesTariffEntry {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "relativeTimeInterval")]
pub relative_time_interval: RelativeTimeInterval,
/// Sales_ Tariff_ Entry. E_ Price_ Level. Unsigned_ Integer
/// Defines the price level of this SalesTariffEntry (referring to NumEPriceLevels). Small values for the EPriceLevel represent a cheaper TariffEntry. Large values for the EPriceLevel represent a more expensive TariffEntry.
#[serde(
rename = "ePriceLevel",
default,
skip_serializing_if = "Option::is_none"
)]
pub e_price_level: Option<i64>,
#[serde(
rename = "consumptionCost",
default,
skip_serializing_if = "Option::is_none"
)]
pub consumption_cost: Option<Vec<ConsumptionCost>>,
}
impl Validate for SalesTariffEntry {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.relative_time_interval;
let p = path.field("relativeTimeInterval");
x.validate(&p)?;
}
if let Some(x) = &self.e_price_level {
let p = path.field("ePriceLevel");
v::minimum(*x, 0i64, &p)?;
}
if let Some(x) = &self.consumption_cost {
let p = path.field("consumptionCost");
v::items(x, Some(1), Some(3), &p)?;
for (i0, it0) in x.iter().enumerate() {
let p0 = p.index(i0);
it0.validate(&p0)?;
}
}
Ok(())
}
}
/// Sampled_ Value
/// Single sampled value in MeterValues. Each value can be accompanied by optional fields.
/// To save on mobile data usage, default values of all of the optional fields are such that. The value without any additional fields will be interpreted, as a register reading of active import energy in Wh (Watt-hour) units.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SampledValue {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Sampled_ Value. Value. Measure
/// Indicates the measured value.
#[serde(rename = "value")]
pub value: f64,
#[serde(rename = "context", default, skip_serializing_if = "Option::is_none")]
pub context: Option<ReadingContextEnum>,
#[serde(rename = "measurand", default, skip_serializing_if = "Option::is_none")]
pub measurand: Option<MeasurandEnum>,
#[serde(rename = "phase", default, skip_serializing_if = "Option::is_none")]
pub phase: Option<PhaseEnum>,
#[serde(rename = "location", default, skip_serializing_if = "Option::is_none")]
pub location: Option<LocationEnum>,
#[serde(
rename = "signedMeterValue",
default,
skip_serializing_if = "Option::is_none"
)]
pub signed_meter_value: Option<SignedMeterValue>,
#[serde(
rename = "unitOfMeasure",
default,
skip_serializing_if = "Option::is_none"
)]
pub unit_of_measure: Option<UnitOfMeasure>,
}
impl Validate for SampledValue {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.signed_meter_value {
let p = path.field("signedMeterValue");
x.validate(&p)?;
}
if let Some(x) = &self.unit_of_measure {
let p = path.field("unitOfMeasure");
x.validate(&p)?;
}
Ok(())
}
}
/// Class to hold parameters of SetVariableMonitoring request.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SetMonitoringData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// An id SHALL only be given to replace an existing monitor. The Charging Station handles the generation of id's for new monitors.
#[serde(rename = "id", default, skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
/// Monitor only active when a transaction is ongoing on a component relevant to this transaction. Default = false.
#[serde(
rename = "transaction",
default,
skip_serializing_if = "Option::is_none"
)]
pub transaction: Option<bool>,
/// Value for threshold or delta monitoring.
/// For Periodic or PeriodicClockAligned this is the interval in seconds.
#[serde(rename = "value")]
pub value: f64,
#[serde(rename = "type")]
pub r#type: MonitorEnum,
/// The severity that will be assigned to an event that is triggered by this monitor. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
/// The severity levels have the following meaning: +
/// *0-Danger* +
/// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
/// *1-Hardware Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
/// *2-System Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
/// *3-Critical* +
/// Indicates a critical error. Action is required. +
/// *4-Error* +
/// Indicates a non-urgent error. Action is required. +
/// *5-Alert* +
/// Indicates an alert event. Default severity for any type of monitoring event. +
/// *6-Warning* +
/// Indicates a warning event. Action may be required. +
/// *7-Notice* +
/// Indicates an unusual event. No immediate action is required. +
/// *8-Informational* +
/// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
/// *9-Debug* +
/// Indicates information useful to developers for debugging, not useful during operations.
#[serde(rename = "severity")]
pub severity: i64,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
}
impl Validate for SetMonitoringData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
/// Class to hold result of SetVariableMonitoring request.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SetMonitoringResult {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Id given to the VariableMonitor by the Charging Station. The Id is only returned when status is accepted. Installed VariableMonitors should have unique id's but the id's of removed Installed monitors should have unique id's but the id's of removed monitors MAY be reused.
#[serde(rename = "id", default, skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
#[serde(
rename = "statusInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub status_info: Option<StatusInfo>,
#[serde(rename = "status")]
pub status: SetMonitoringStatusEnum,
#[serde(rename = "type")]
pub r#type: MonitorEnum,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
/// The severity that will be assigned to an event that is triggered by this monitor. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
/// The severity levels have the following meaning: +
/// *0-Danger* +
/// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
/// *1-Hardware Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
/// *2-System Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
/// *3-Critical* +
/// Indicates a critical error. Action is required. +
/// *4-Error* +
/// Indicates a non-urgent error. Action is required. +
/// *5-Alert* +
/// Indicates an alert event. Default severity for any type of monitoring event. +
/// *6-Warning* +
/// Indicates a warning event. Action may be required. +
/// *7-Notice* +
/// Indicates an unusual event. No immediate action is required. +
/// *8-Informational* +
/// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
/// *9-Debug* +
/// Indicates information useful to developers for debugging, not useful during operations.
#[serde(rename = "severity")]
pub severity: i64,
}
impl Validate for SetMonitoringResult {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.status_info {
let p = path.field("statusInfo");
x.validate(&p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SetVariableData {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(
rename = "attributeType",
default,
skip_serializing_if = "Option::is_none"
)]
pub attribute_type: Option<AttributeEnum>,
/// Value to be assigned to attribute of variable.
/// The Configuration Variable <<configkey-configuration-value-size,ConfigurationValueSize>> can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these values will always remain equal.
#[serde(rename = "attributeValue")]
pub attribute_value: String,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
}
impl Validate for SetVariableData {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.attribute_value;
let p = path.field("attributeValue");
v::max_length(x, 1000, &p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SetVariableResult {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(
rename = "attributeType",
default,
skip_serializing_if = "Option::is_none"
)]
pub attribute_type: Option<AttributeEnum>,
#[serde(rename = "attributeStatus")]
pub attribute_status: SetVariableStatusEnum,
#[serde(
rename = "attributeStatusInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub attribute_status_info: Option<StatusInfo>,
#[serde(rename = "component")]
pub component: Component,
#[serde(rename = "variable")]
pub variable: Variable,
}
impl Validate for SetVariableResult {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.attribute_status_info {
let p = path.field("attributeStatusInfo");
x.validate(&p)?;
}
{
let x = &self.component;
let p = path.field("component");
x.validate(&p)?;
}
{
let x = &self.variable;
let p = path.field("variable");
x.validate(&p)?;
}
Ok(())
}
}
/// Represent a signed version of the meter value.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SignedMeterValue {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Base64 encoded, contains the signed data which might contain more then just the meter value. It can contain information like timestamps, reference to a customer etc.
#[serde(rename = "signedMeterData")]
pub signed_meter_data: String,
/// Method used to create the digital signature.
#[serde(rename = "signingMethod")]
pub signing_method: String,
/// Method used to encode the meter values before applying the digital signature algorithm.
#[serde(rename = "encodingMethod")]
pub encoding_method: String,
/// Base64 encoded, sending depends on configuration variable _PublicKeyWithSignedMeterValue_.
#[serde(rename = "publicKey")]
pub public_key: String,
}
impl Validate for SignedMeterValue {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.signed_meter_data;
let p = path.field("signedMeterData");
v::max_length(x, 2500, &p)?;
}
{
let x = &self.signing_method;
let p = path.field("signingMethod");
v::max_length(x, 50, &p)?;
}
{
let x = &self.encoding_method;
let p = path.field("encodingMethod");
v::max_length(x, 50, &p)?;
}
{
let x = &self.public_key;
let p = path.field("publicKey");
v::max_length(x, 2500, &p)?;
}
Ok(())
}
}
/// Element providing more information about the status.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct StatusInfo {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// A predefined code for the reason why the status is returned in this response. The string is case-insensitive.
#[serde(rename = "reasonCode")]
pub reason_code: String,
/// Additional text to provide detailed information.
#[serde(
rename = "additionalInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub additional_info: Option<String>,
}
impl Validate for StatusInfo {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.reason_code;
let p = path.field("reasonCode");
v::max_length(x, 20, &p)?;
}
if let Some(x) = &self.additional_info {
let p = path.field("additionalInfo");
v::max_length(x, 512, &p)?;
}
Ok(())
}
}
/// Transaction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Transaction {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// This contains the Id of the transaction.
#[serde(rename = "transactionId")]
pub transaction_id: String,
#[serde(
rename = "chargingState",
default,
skip_serializing_if = "Option::is_none"
)]
pub charging_state: Option<ChargingStateEnum>,
/// Transaction. Time_ Spent_ Charging. Elapsed_ Time
/// Contains the total time that energy flowed from EVSE to EV during the transaction (in seconds). Note that timeSpentCharging is smaller or equal to the duration of the transaction.
#[serde(
rename = "timeSpentCharging",
default,
skip_serializing_if = "Option::is_none"
)]
pub time_spent_charging: Option<i64>,
#[serde(
rename = "stoppedReason",
default,
skip_serializing_if = "Option::is_none"
)]
pub stopped_reason: Option<ReasonEnum>,
/// The ID given to remote start request (<<requeststarttransactionrequest, RequestStartTransactionRequest>>. This enables to CSMS to match the started transaction to the given start request.
#[serde(
rename = "remoteStartId",
default,
skip_serializing_if = "Option::is_none"
)]
pub remote_start_id: Option<i64>,
}
impl Validate for Transaction {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.transaction_id;
let p = path.field("transactionId");
v::max_length(x, 36, &p)?;
}
Ok(())
}
}
/// Represents a UnitOfMeasure with a multiplier
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct UnitOfMeasure {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type.
/// This field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
/// If an applicable unit is available in that list, otherwise a "custom" unit might be used.
#[serde(rename = "unit", default, skip_serializing_if = "Option::is_none")]
pub unit: Option<String>,
/// Multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10 raised to the 3rd power. Default is 0.
#[serde(
rename = "multiplier",
default,
skip_serializing_if = "Option::is_none"
)]
pub multiplier: Option<i64>,
}
impl Validate for UnitOfMeasure {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.unit {
let p = path.field("unit");
v::max_length(x, 20, &p)?;
}
Ok(())
}
}
/// VPN
/// VPN Configuration settings
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct VPN {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// VPN. Server. URI
/// VPN Server Address
#[serde(rename = "server")]
pub server: String,
/// VPN. User. User_ Name
/// VPN User
#[serde(rename = "user")]
pub user: String,
/// VPN. Group. Group_ Name
/// VPN group.
#[serde(rename = "group", default, skip_serializing_if = "Option::is_none")]
pub group: Option<String>,
/// VPN. Password. Password
/// VPN Password.
#[serde(rename = "password")]
pub password: String,
/// VPN. Key. VPN_ Key
/// VPN shared secret.
#[serde(rename = "key")]
pub key: String,
#[serde(rename = "type")]
pub r#type: VPNEnum,
}
impl Validate for VPN {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.server;
let p = path.field("server");
v::max_length(x, 512, &p)?;
}
{
let x = &self.user;
let p = path.field("user");
v::max_length(x, 20, &p)?;
}
if let Some(x) = &self.group {
let p = path.field("group");
v::max_length(x, 20, &p)?;
}
{
let x = &self.password;
let p = path.field("password");
v::max_length(x, 20, &p)?;
}
{
let x = &self.key;
let p = path.field("key");
v::max_length(x, 255, &p)?;
}
Ok(())
}
}
/// Reference key to a component-variable.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Variable {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Name of the variable. Name should be taken from the list of standardized variable names whenever possible. Case Insensitive. strongly advised to use Camel Case.
#[serde(rename = "name")]
pub name: String,
/// Name of instance in case the variable exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
#[serde(rename = "instance", default, skip_serializing_if = "Option::is_none")]
pub instance: Option<String>,
}
impl Validate for Variable {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
{
let x = &self.name;
let p = path.field("name");
v::max_length(x, 50, &p)?;
}
if let Some(x) = &self.instance {
let p = path.field("instance");
v::max_length(x, 50, &p)?;
}
Ok(())
}
}
/// Attribute data of a variable.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct VariableAttribute {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub r#type: Option<AttributeEnum>,
/// Value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
/// The Configuration Variable <<configkey-reporting-value-size,ReportingValueSize>> can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
#[serde(rename = "value", default, skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
#[serde(
rename = "mutability",
default,
skip_serializing_if = "Option::is_none"
)]
pub mutability: Option<MutabilityEnum>,
/// If true, value will be persistent across system reboots or power down. Default when omitted is false.
#[serde(
rename = "persistent",
default,
skip_serializing_if = "Option::is_none"
)]
pub persistent: Option<bool>,
/// If true, value that will never be changed by the Charging Station at runtime. Default when omitted is false.
#[serde(rename = "constant", default, skip_serializing_if = "Option::is_none")]
pub constant: Option<bool>,
}
impl Validate for VariableAttribute {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.value {
let p = path.field("value");
v::max_length(x, 2500, &p)?;
}
Ok(())
}
}
/// Fixed read-only parameters of a variable.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct VariableCharacteristics {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Unit of the variable. When the transmitted value has a unit, this field SHALL be included.
#[serde(rename = "unit", default, skip_serializing_if = "Option::is_none")]
pub unit: Option<String>,
#[serde(rename = "dataType")]
pub data_type: DataEnum,
/// Minimum possible value of this variable.
#[serde(rename = "minLimit", default, skip_serializing_if = "Option::is_none")]
pub min_limit: Option<f64>,
/// Maximum possible value of this variable. When the datatype of this Variable is String, OptionList, SequenceList or MemberList, this field defines the maximum length of the (CSV) string.
#[serde(rename = "maxLimit", default, skip_serializing_if = "Option::is_none")]
pub max_limit: Option<f64>,
/// Allowed values when variable is Option/Member/SequenceList.
/// * OptionList: The (Actual) Variable value must be a single value from the reported (CSV) enumeration list.
/// * MemberList: The (Actual) Variable value may be an (unordered) (sub-)set of the reported (CSV) valid values list.
/// * SequenceList: The (Actual) Variable value may be an ordered (priority, etc) (sub-)set of the reported (CSV) valid values.
///
/// This is a comma separated list.
/// The Configuration Variable <<configkey-configuration-value-size,ConfigurationValueSize>> can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these values will always remain equal.
#[serde(
rename = "valuesList",
default,
skip_serializing_if = "Option::is_none"
)]
pub values_list: Option<String>,
/// Flag indicating if this variable supports monitoring.
#[serde(rename = "supportsMonitoring")]
pub supports_monitoring: bool,
}
impl Validate for VariableCharacteristics {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
if let Some(x) = &self.unit {
let p = path.field("unit");
v::max_length(x, 16, &p)?;
}
if let Some(x) = &self.values_list {
let p = path.field("valuesList");
v::max_length(x, 1000, &p)?;
}
Ok(())
}
}
/// A monitoring setting for a variable.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct VariableMonitoring {
#[serde(
rename = "customData",
default,
skip_serializing_if = "Option::is_none"
)]
pub custom_data: Option<CustomData>,
/// Identifies the monitor.
#[serde(rename = "id")]
pub id: i64,
/// Monitor only active when a transaction is ongoing on a component relevant to this transaction.
#[serde(rename = "transaction")]
pub transaction: bool,
/// Value for threshold or delta monitoring.
/// For Periodic or PeriodicClockAligned this is the interval in seconds.
#[serde(rename = "value")]
pub value: f64,
#[serde(rename = "type")]
pub r#type: MonitorEnum,
/// The severity that will be assigned to an event that is triggered by this monitor. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
/// The severity levels have the following meaning: +
/// *0-Danger* +
/// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
/// *1-Hardware Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
/// *2-System Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
/// *3-Critical* +
/// Indicates a critical error. Action is required. +
/// *4-Error* +
/// Indicates a non-urgent error. Action is required. +
/// *5-Alert* +
/// Indicates an alert event. Default severity for any type of monitoring event. +
/// *6-Warning* +
/// Indicates a warning event. Action may be required. +
/// *7-Notice* +
/// Indicates an unusual event. No immediate action is required. +
/// *8-Informational* +
/// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
/// *9-Debug* +
/// Indicates information useful to developers for debugging, not useful during operations.
#[serde(rename = "severity")]
pub severity: i64,
}
impl Validate for VariableMonitoring {
fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
if let Some(x) = &self.custom_data {
let p = path.field("customData");
x.validate(&p)?;
}
Ok(())
}
}