Skip to main content

ocpp_types/v201/
common.rs

1// @generated by ocpp-codegen from schemas/. Do not edit by hand -- run
2// `scripts/generate.sh` to regenerate; manual changes will be overwritten.
3
4/// 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.
5#[derive(Debug, Clone, PartialEq, Eq)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7pub struct CustomData {
8    #[cfg_attr(feature = "serde", serde(rename = "vendorId"))]
9    pub vendor_id: heapless::String<255usize>,
10}
11#[cfg(feature = "validate")]
12impl crate::validate::Validate for CustomData {
13    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
14        Ok(())
15    }
16}
17/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
18#[derive(Debug, Clone, PartialEq, Eq)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20pub struct AdditionalInfo<CustomDataType = crate::NoCustomData> {
21    /// This field specifies the additional IdToken.
22    #[cfg_attr(feature = "serde", serde(rename = "additionalIdToken"))]
23    pub additional_id_token: heapless::String<36usize>,
24    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
25    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
26    pub custom_data: Option<CustomDataType>,
27    /// This defines the type of the additionalIdToken. This is a custom type, so the implementation needs to be agreed upon by all involved parties.
28    pub r#type: heapless::String<50usize>,
29}
30#[cfg(feature = "validate")]
31impl<CustomDataType> crate::validate::Validate for AdditionalInfo<CustomDataType> {
32    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
33        Ok(())
34    }
35}
36/// Enumeration of possible idToken types.
37#[derive(Debug, Clone, PartialEq, Eq)]
38#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
39pub enum IdTokenEnum {
40    Central,
41    #[cfg_attr(feature = "serde", serde(rename = "eMAID"))]
42    EMAID,
43    ISO14443,
44    ISO15693,
45    KeyCode,
46    Local,
47    MacAddress,
48    NoAuthorization,
49}
50#[cfg(feature = "validate")]
51impl crate::validate::Validate for IdTokenEnum {
52    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
53        Ok(())
54    }
55}
56#[cfg(feature = "alloc")]
57/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
58#[derive(Debug, Clone, PartialEq, Eq)]
59#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
60pub struct IdToken<CustomDataType = crate::NoCustomData> {
61    #[cfg_attr(feature = "serde", serde(rename = "additionalInfo"))]
62    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
63    pub additional_info: Option<alloc::vec::Vec<AdditionalInfo<CustomDataType>>>,
64    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
65    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
66    pub custom_data: Option<CustomDataType>,
67    /// IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also contain a UUID.
68    #[cfg_attr(feature = "serde", serde(rename = "idToken"))]
69    pub id_token: heapless::String<36usize>,
70    pub r#type: IdTokenEnum,
71}
72#[cfg(all(feature = "validate", feature = "alloc"))]
73impl<CustomDataType> crate::validate::Validate for IdToken<CustomDataType> {
74    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
75        if let Some(value) = &self.additional_info {
76            crate::validate::check_min_items(value.len(), 1usize)
77                .map_err(|error| error.in_field("additionalInfo"))?;
78            for (index, item) in value.iter().enumerate() {
79                crate::validate::Validate::validate(item)
80                    .map_err(|error| error.in_index(index).in_field("additionalInfo"))?;
81            }
82        }
83        crate::validate::Validate::validate(&self.r#type)
84            .map_err(|error| error.in_field("type"))?;
85        Ok(())
86    }
87}
88#[cfg(not(feature = "alloc"))]
89/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
90#[derive(Debug, Clone, PartialEq, Eq)]
91#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
92pub struct IdToken<
93    CustomDataType = crate::NoCustomData,
94    const ID_TOKEN_ADDITIONAL_INFO_CAP: usize = 8usize,
95> {
96    #[cfg_attr(feature = "serde", serde(rename = "additionalInfo"))]
97    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
98    pub additional_info: Option<
99        heapless::Vec<AdditionalInfo<CustomDataType>, ID_TOKEN_ADDITIONAL_INFO_CAP>,
100    >,
101    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
102    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
103    pub custom_data: Option<CustomDataType>,
104    /// IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also contain a UUID.
105    #[cfg_attr(feature = "serde", serde(rename = "idToken"))]
106    pub id_token: heapless::String<36usize>,
107    pub r#type: IdTokenEnum,
108}
109#[cfg(all(feature = "validate", not(feature = "alloc")))]
110impl<CustomDataType, const ID_TOKEN_ADDITIONAL_INFO_CAP: usize> crate::validate::Validate
111for IdToken<CustomDataType, ID_TOKEN_ADDITIONAL_INFO_CAP> {
112    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
113        if let Some(value) = &self.additional_info {
114            crate::validate::check_min_items(value.len(), 1usize)
115                .map_err(|error| error.in_field("additionalInfo"))?;
116            for (index, item) in value.iter().enumerate() {
117                crate::validate::Validate::validate(item)
118                    .map_err(|error| error.in_index(index).in_field("additionalInfo"))?;
119            }
120        }
121        crate::validate::Validate::validate(&self.r#type)
122            .map_err(|error| error.in_field("type"))?;
123        Ok(())
124    }
125}
126/// Used algorithms for the hashes provided.
127#[derive(Debug, Clone, PartialEq, Eq)]
128#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
129pub enum HashAlgorithmEnum {
130    SHA256,
131    SHA384,
132    SHA512,
133}
134#[cfg(feature = "validate")]
135impl crate::validate::Validate for HashAlgorithmEnum {
136    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
137        Ok(())
138    }
139}
140#[derive(Debug, Clone, PartialEq, Eq)]
141#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
142pub struct OCSPRequestData<CustomDataType = crate::NoCustomData> {
143    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
144    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
145    pub custom_data: Option<CustomDataType>,
146    #[cfg_attr(feature = "serde", serde(rename = "hashAlgorithm"))]
147    pub hash_algorithm: HashAlgorithmEnum,
148    /// Hashed value of the issuers public key
149    #[cfg_attr(feature = "serde", serde(rename = "issuerKeyHash"))]
150    pub issuer_key_hash: heapless::String<128usize>,
151    /// Hashed value of the Issuer DN (Distinguished Name).
152    #[cfg_attr(feature = "serde", serde(rename = "issuerNameHash"))]
153    pub issuer_name_hash: heapless::String<128usize>,
154    /// This contains the responder URL (Case insensitive).
155    #[cfg_attr(feature = "serde", serde(rename = "responderURL"))]
156    pub responder_u_r_l: heapless::String<512usize>,
157    /// The serial number of the certificate.
158    #[cfg_attr(feature = "serde", serde(rename = "serialNumber"))]
159    pub serial_number: heapless::String<40usize>,
160}
161#[cfg(feature = "validate")]
162impl<CustomDataType> crate::validate::Validate for OCSPRequestData<CustomDataType> {
163    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
164        crate::validate::Validate::validate(&self.hash_algorithm)
165            .map_err(|error| error.in_field("hashAlgorithm"))?;
166        Ok(())
167    }
168}
169/// Certificate status information.
170/// - if all certificates are valid: return 'Accepted'.
171/// - if one of the certificates was revoked, return 'CertificateRevoked'.
172#[derive(Debug, Clone, PartialEq, Eq)]
173#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
174pub enum AuthorizeCertificateStatusEnum {
175    Accepted,
176    SignatureError,
177    CertificateExpired,
178    CertificateRevoked,
179    NoCertificateAvailable,
180    CertChainError,
181    ContractCancelled,
182}
183#[cfg(feature = "validate")]
184impl crate::validate::Validate for AuthorizeCertificateStatusEnum {
185    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
186        Ok(())
187    }
188}
189/// Message_ Content. Format. Message_ Format_ Code
190/// urn:x-enexis:ecdm:uid:1:570848
191/// Format of the message.
192#[derive(Debug, Clone, PartialEq, Eq)]
193#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
194pub enum MessageFormatEnum {
195    ASCII,
196    HTML,
197    URI,
198    UTF8,
199}
200#[cfg(feature = "validate")]
201impl crate::validate::Validate for MessageFormatEnum {
202    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
203        Ok(())
204    }
205}
206/// Message_ Content
207/// urn:x-enexis:ecdm:uid:2:234490
208/// Contains message details, for a message to be displayed on a Charging Station.
209#[derive(Debug, Clone, PartialEq, Eq)]
210#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
211pub struct MessageContent<CustomDataType = crate::NoCustomData> {
212    /// Message_ Content. Content. Message
213    /// urn:x-enexis:ecdm:uid:1:570852
214    /// Message contents.
215    pub content: heapless::String<512usize>,
216    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
217    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
218    pub custom_data: Option<CustomDataType>,
219    pub format: MessageFormatEnum,
220    /// Message_ Content. Language. Language_ Code
221    /// urn:x-enexis:ecdm:uid:1:570849
222    /// Message language identifier. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
223    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
224    pub language: Option<heapless::String<8usize>>,
225}
226#[cfg(feature = "validate")]
227impl<CustomDataType> crate::validate::Validate for MessageContent<CustomDataType> {
228    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
229        crate::validate::Validate::validate(&self.format)
230            .map_err(|error| error.in_field("format"))?;
231        Ok(())
232    }
233}
234/// ID_ Token. Status. Authorization_ Status
235/// urn:x-oca:ocpp:uid:1:569372
236/// Current status of the ID Token.
237#[derive(Debug, Clone, PartialEq, Eq)]
238#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
239pub enum AuthorizationStatusEnum {
240    Accepted,
241    Blocked,
242    ConcurrentTx,
243    Expired,
244    Invalid,
245    NoCredit,
246    NotAllowedTypeEVSE,
247    NotAtThisLocation,
248    NotAtThisTime,
249    Unknown,
250}
251#[cfg(feature = "validate")]
252impl crate::validate::Validate for AuthorizationStatusEnum {
253    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
254        Ok(())
255    }
256}
257#[cfg(feature = "alloc")]
258/// ID_ Token
259/// urn:x-oca:ocpp:uid:2:233247
260/// Contains status information about an identifier.
261/// 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.
262#[derive(Debug, Clone, PartialEq, Eq)]
263#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
264pub struct IdTokenInfo<CustomDataType = crate::NoCustomData> {
265    /// ID_ Token. Expiry. Date_ Time
266    /// urn:x-oca:ocpp:uid:1:569373
267    /// Date and Time after which the token must be considered invalid.
268    #[cfg_attr(feature = "serde", serde(rename = "cacheExpiryDateTime"))]
269    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
270    pub cache_expiry_date_time: Option<crate::OcppTimestamp>,
271    /// 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 &lt;&lt;transactioneventresponse,TransactionEventResponse&gt;&gt; overrules this one.
272    #[cfg_attr(feature = "serde", serde(rename = "chargingPriority"))]
273    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
274    pub charging_priority: Option<i64>,
275    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
276    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
277    pub custom_data: Option<CustomDataType>,
278    /// Only used when the IdToken is only valid for one or more specific EVSEs, not for the entire Charging Station.
279    #[cfg_attr(feature = "serde", serde(rename = "evseId"))]
280    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
281    pub evse_id: Option<alloc::vec::Vec<i64>>,
282    #[cfg_attr(feature = "serde", serde(rename = "groupIdToken"))]
283    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
284    pub group_id_token: Option<IdToken<CustomDataType>>,
285    /// ID_ Token. Language1. Language_ Code
286    /// urn:x-oca:ocpp:uid:1:569374
287    /// Preferred user interface language of identifier user. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
288    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
289    pub language1: Option<heapless::String<8usize>>,
290    /// ID_ Token. Language2. Language_ Code
291    /// urn:x-oca:ocpp:uid:1:569375
292    /// 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 &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
293    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
294    pub language2: Option<heapless::String<8usize>>,
295    #[cfg_attr(feature = "serde", serde(rename = "personalMessage"))]
296    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
297    pub personal_message: Option<MessageContent<CustomDataType>>,
298    pub status: AuthorizationStatusEnum,
299}
300#[cfg(all(feature = "validate", feature = "alloc"))]
301impl<CustomDataType> crate::validate::Validate for IdTokenInfo<CustomDataType> {
302    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
303        if let Some(value) = &self.evse_id {
304            crate::validate::check_min_items(value.len(), 1usize)
305                .map_err(|error| error.in_field("evseId"))?;
306        }
307        if let Some(value) = &self.group_id_token {
308            crate::validate::Validate::validate(value)
309                .map_err(|error| error.in_field("groupIdToken"))?;
310        }
311        if let Some(value) = &self.personal_message {
312            crate::validate::Validate::validate(value)
313                .map_err(|error| error.in_field("personalMessage"))?;
314        }
315        crate::validate::Validate::validate(&self.status)
316            .map_err(|error| error.in_field("status"))?;
317        Ok(())
318    }
319}
320#[cfg(not(feature = "alloc"))]
321/// ID_ Token
322/// urn:x-oca:ocpp:uid:2:233247
323/// Contains status information about an identifier.
324/// 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.
325#[derive(Debug, Clone, PartialEq, Eq)]
326#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
327pub struct IdTokenInfo<
328    CustomDataType = crate::NoCustomData,
329    const ID_TOKEN_INFO_EVSE_ID_CAP: usize = 8usize,
330    const ID_TOKEN_ADDITIONAL_INFO_CAP: usize = 8usize,
331> {
332    /// ID_ Token. Expiry. Date_ Time
333    /// urn:x-oca:ocpp:uid:1:569373
334    /// Date and Time after which the token must be considered invalid.
335    #[cfg_attr(feature = "serde", serde(rename = "cacheExpiryDateTime"))]
336    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
337    pub cache_expiry_date_time: Option<crate::OcppTimestamp>,
338    /// 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 &lt;&lt;transactioneventresponse,TransactionEventResponse&gt;&gt; overrules this one.
339    #[cfg_attr(feature = "serde", serde(rename = "chargingPriority"))]
340    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
341    pub charging_priority: Option<i64>,
342    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
343    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
344    pub custom_data: Option<CustomDataType>,
345    /// Only used when the IdToken is only valid for one or more specific EVSEs, not for the entire Charging Station.
346    #[cfg_attr(feature = "serde", serde(rename = "evseId"))]
347    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
348    pub evse_id: Option<heapless::Vec<i64, ID_TOKEN_INFO_EVSE_ID_CAP>>,
349    #[cfg_attr(feature = "serde", serde(rename = "groupIdToken"))]
350    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
351    pub group_id_token: Option<IdToken<CustomDataType, ID_TOKEN_ADDITIONAL_INFO_CAP>>,
352    /// ID_ Token. Language1. Language_ Code
353    /// urn:x-oca:ocpp:uid:1:569374
354    /// Preferred user interface language of identifier user. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
355    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
356    pub language1: Option<heapless::String<8usize>>,
357    /// ID_ Token. Language2. Language_ Code
358    /// urn:x-oca:ocpp:uid:1:569375
359    /// 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 &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
360    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
361    pub language2: Option<heapless::String<8usize>>,
362    #[cfg_attr(feature = "serde", serde(rename = "personalMessage"))]
363    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
364    pub personal_message: Option<MessageContent<CustomDataType>>,
365    pub status: AuthorizationStatusEnum,
366}
367#[cfg(all(feature = "validate", not(feature = "alloc")))]
368impl<
369    CustomDataType,
370    const ID_TOKEN_INFO_EVSE_ID_CAP: usize,
371    const ID_TOKEN_ADDITIONAL_INFO_CAP: usize,
372> crate::validate::Validate
373for IdTokenInfo<
374    CustomDataType,
375    ID_TOKEN_INFO_EVSE_ID_CAP,
376    ID_TOKEN_ADDITIONAL_INFO_CAP,
377> {
378    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
379        if let Some(value) = &self.evse_id {
380            crate::validate::check_min_items(value.len(), 1usize)
381                .map_err(|error| error.in_field("evseId"))?;
382        }
383        if let Some(value) = &self.group_id_token {
384            crate::validate::Validate::validate(value)
385                .map_err(|error| error.in_field("groupIdToken"))?;
386        }
387        if let Some(value) = &self.personal_message {
388            crate::validate::Validate::validate(value)
389                .map_err(|error| error.in_field("personalMessage"))?;
390        }
391        crate::validate::Validate::validate(&self.status)
392            .map_err(|error| error.in_field("status"))?;
393        Ok(())
394    }
395}
396/// Wireless_ Communication_ Module
397/// urn:x-oca:ocpp:uid:2:233306
398/// Defines parameters required for initiating and maintaining wireless communication with other devices.
399#[derive(Debug, Clone, PartialEq, Eq)]
400#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
401pub struct Modem<CustomDataType = crate::NoCustomData> {
402    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
403    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
404    pub custom_data: Option<CustomDataType>,
405    /// Wireless_ Communication_ Module. ICCID. CI20_ Text
406    /// urn:x-oca:ocpp:uid:1:569327
407    /// This contains the ICCID of the modem’s SIM card.
408    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
409    pub iccid: Option<heapless::String<20usize>>,
410    /// Wireless_ Communication_ Module. IMSI. CI20_ Text
411    /// urn:x-oca:ocpp:uid:1:569328
412    /// This contains the IMSI of the modem’s SIM card.
413    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
414    pub imsi: Option<heapless::String<20usize>>,
415}
416#[cfg(feature = "validate")]
417impl<CustomDataType> crate::validate::Validate for Modem<CustomDataType> {
418    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
419        Ok(())
420    }
421}
422/// Charge_ Point
423/// urn:x-oca:ocpp:uid:2:233122
424/// The physical system where an Electrical Vehicle (EV) can be charged.
425#[derive(Debug, Clone, PartialEq, Eq)]
426#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
427pub struct ChargingStation<CustomDataType = crate::NoCustomData> {
428    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
429    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
430    pub custom_data: Option<CustomDataType>,
431    /// This contains the firmware version of the Charging Station.
432    #[cfg_attr(feature = "serde", serde(rename = "firmwareVersion"))]
433    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
434    pub firmware_version: Option<heapless::String<50usize>>,
435    /// Device. Model. CI20_ Text
436    /// urn:x-oca:ocpp:uid:1:569325
437    /// Defines the model of the device.
438    pub model: heapless::String<20usize>,
439    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
440    pub modem: Option<Modem<CustomDataType>>,
441    /// Device. Serial_ Number. Serial_ Number
442    /// urn:x-oca:ocpp:uid:1:569324
443    /// Vendor-specific device identifier.
444    #[cfg_attr(feature = "serde", serde(rename = "serialNumber"))]
445    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
446    pub serial_number: Option<heapless::String<25usize>>,
447    /// Identifies the vendor (not necessarily in a unique manner).
448    #[cfg_attr(feature = "serde", serde(rename = "vendorName"))]
449    pub vendor_name: heapless::String<50usize>,
450}
451#[cfg(feature = "validate")]
452impl<CustomDataType> crate::validate::Validate for ChargingStation<CustomDataType> {
453    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
454        if let Some(value) = &self.modem {
455            crate::validate::Validate::validate(value)
456                .map_err(|error| error.in_field("modem"))?;
457        }
458        Ok(())
459    }
460}
461/// This contains the reason for sending this message to the CSMS.
462#[derive(Debug, Clone, PartialEq, Eq)]
463#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
464pub enum BootReasonEnum {
465    ApplicationReset,
466    FirmwareUpdate,
467    LocalReset,
468    PowerUp,
469    RemoteReset,
470    ScheduledReset,
471    Triggered,
472    Unknown,
473    Watchdog,
474}
475#[cfg(feature = "validate")]
476impl crate::validate::Validate for BootReasonEnum {
477    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
478        Ok(())
479    }
480}
481/// This contains whether the Charging Station has been registered
482/// within the CSMS.
483#[derive(Debug, Clone, PartialEq, Eq)]
484#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
485pub enum RegistrationStatusEnum {
486    Accepted,
487    Pending,
488    Rejected,
489}
490#[cfg(feature = "validate")]
491impl crate::validate::Validate for RegistrationStatusEnum {
492    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
493        Ok(())
494    }
495}
496/// Element providing more information about the status.
497#[derive(Debug, Clone, PartialEq, Eq)]
498#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
499pub struct StatusInfo<CustomDataType = crate::NoCustomData> {
500    /// Additional text to provide detailed information.
501    #[cfg_attr(feature = "serde", serde(rename = "additionalInfo"))]
502    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
503    pub additional_info: Option<heapless::String<512usize>>,
504    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
505    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
506    pub custom_data: Option<CustomDataType>,
507    /// A predefined code for the reason why the status is returned in this response. The string is case-insensitive.
508    #[cfg_attr(feature = "serde", serde(rename = "reasonCode"))]
509    pub reason_code: heapless::String<20usize>,
510}
511#[cfg(feature = "validate")]
512impl<CustomDataType> crate::validate::Validate for StatusInfo<CustomDataType> {
513    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
514        Ok(())
515    }
516}
517/// This indicates the success or failure of the canceling of a reservation by CSMS.
518#[derive(Debug, Clone, PartialEq, Eq)]
519#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
520pub enum CancelReservationStatusEnum {
521    Accepted,
522    Rejected,
523}
524#[cfg(feature = "validate")]
525impl crate::validate::Validate for CancelReservationStatusEnum {
526    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
527        Ok(())
528    }
529}
530/// Indicates the type of the signed certificate that is returned. When omitted the certificate is used for both the 15118 connection (if implemented) and the Charging Station to CSMS connection. This field is required when a typeOfCertificate was included in the &lt;&lt;signcertificaterequest,SignCertificateRequest&gt;&gt; that requested this certificate to be signed AND both the 15118 connection and the Charging Station connection are implemented.
531#[derive(Debug, Clone, PartialEq, Eq)]
532#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
533pub enum CertificateSigningUseEnum {
534    ChargingStationCertificate,
535    V2GCertificate,
536}
537#[cfg(feature = "validate")]
538impl crate::validate::Validate for CertificateSigningUseEnum {
539    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
540        Ok(())
541    }
542}
543/// Returns whether certificate signing has been accepted, otherwise rejected.
544#[derive(Debug, Clone, PartialEq, Eq)]
545#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
546pub enum CertificateSignedStatusEnum {
547    Accepted,
548    Rejected,
549}
550#[cfg(feature = "validate")]
551impl crate::validate::Validate for CertificateSignedStatusEnum {
552    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
553        Ok(())
554    }
555}
556/// EVSE
557/// urn:x-oca:ocpp:uid:2:233123
558/// Electric Vehicle Supply Equipment
559#[derive(Debug, Clone, PartialEq, Eq)]
560#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
561pub struct EVSE<CustomDataType = crate::NoCustomData> {
562    /// An id to designate a specific connector (on an EVSE) by connector index number.
563    #[cfg_attr(feature = "serde", serde(rename = "connectorId"))]
564    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
565    pub connector_id: Option<i64>,
566    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
567    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
568    pub custom_data: Option<CustomDataType>,
569    /// Identified_ Object. MRID. Numeric_ Identifier
570    /// urn:x-enexis:ecdm:uid:1:569198
571    /// EVSE Identifier. This contains a number (&gt; 0) designating an EVSE of the Charging Station.
572    pub id: i64,
573}
574#[cfg(feature = "validate")]
575impl<CustomDataType> crate::validate::Validate for EVSE<CustomDataType> {
576    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
577        Ok(())
578    }
579}
580/// This contains the type of availability change that the Charging Station should perform.
581#[derive(Debug, Clone, PartialEq, Eq)]
582#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
583pub enum OperationalStatusEnum {
584    Inoperative,
585    Operative,
586}
587#[cfg(feature = "validate")]
588impl crate::validate::Validate for OperationalStatusEnum {
589    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
590        Ok(())
591    }
592}
593/// This indicates whether the Charging Station is able to perform the availability change.
594#[derive(Debug, Clone, PartialEq, Eq)]
595#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
596pub enum ChangeAvailabilityStatusEnum {
597    Accepted,
598    Rejected,
599    Scheduled,
600}
601#[cfg(feature = "validate")]
602impl crate::validate::Validate for ChangeAvailabilityStatusEnum {
603    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
604        Ok(())
605    }
606}
607/// Accepted if the Charging Station has executed the request, otherwise rejected.
608#[derive(Debug, Clone, PartialEq, Eq)]
609#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
610pub enum ClearCacheStatusEnum {
611    Accepted,
612    Rejected,
613}
614#[cfg(feature = "validate")]
615impl crate::validate::Validate for ClearCacheStatusEnum {
616    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
617        Ok(())
618    }
619}
620/// Charging_ Profile. Charging_ Profile_ Purpose. Charging_ Profile_ Purpose_ Code
621/// urn:x-oca:ocpp:uid:1:569231
622/// Specifies to purpose of the charging profiles that will be cleared, if they meet the other criteria in the request.
623#[derive(Debug, Clone, PartialEq, Eq)]
624#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
625pub enum ChargingProfilePurposeEnum {
626    ChargingStationExternalConstraints,
627    ChargingStationMaxProfile,
628    TxDefaultProfile,
629    TxProfile,
630}
631#[cfg(feature = "validate")]
632impl crate::validate::Validate for ChargingProfilePurposeEnum {
633    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
634        Ok(())
635    }
636}
637/// Charging_ Profile
638/// urn:x-oca:ocpp:uid:2:233255
639/// A ChargingProfile consists of a ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
640#[derive(Debug, Clone, PartialEq, Eq)]
641#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
642pub struct ClearChargingProfile<CustomDataType = crate::NoCustomData> {
643    #[cfg_attr(feature = "serde", serde(rename = "chargingProfilePurpose"))]
644    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
645    pub charging_profile_purpose: Option<ChargingProfilePurposeEnum>,
646    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
647    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
648    pub custom_data: Option<CustomDataType>,
649    /// Identified_ Object. MRID. Numeric_ Identifier
650    /// urn:x-enexis:ecdm:uid:1:569198
651    /// 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.
652    #[cfg_attr(feature = "serde", serde(rename = "evseId"))]
653    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
654    pub evse_id: Option<i64>,
655    /// Charging_ Profile. Stack_ Level. Counter
656    /// urn:x-oca:ocpp:uid:1:569230
657    /// Specifies the stackLevel for which charging profiles will be cleared, if they meet the other criteria in the request.
658    #[cfg_attr(feature = "serde", serde(rename = "stackLevel"))]
659    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
660    pub stack_level: Option<i64>,
661}
662#[cfg(feature = "validate")]
663impl<CustomDataType> crate::validate::Validate for ClearChargingProfile<CustomDataType> {
664    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
665        if let Some(value) = &self.charging_profile_purpose {
666            crate::validate::Validate::validate(value)
667                .map_err(|error| error.in_field("chargingProfilePurpose"))?;
668        }
669        Ok(())
670    }
671}
672/// Indicates if the Charging Station was able to execute the request.
673#[derive(Debug, Clone, PartialEq, Eq)]
674#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
675pub enum ClearChargingProfileStatusEnum {
676    Accepted,
677    Unknown,
678}
679#[cfg(feature = "validate")]
680impl crate::validate::Validate for ClearChargingProfileStatusEnum {
681    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
682        Ok(())
683    }
684}
685/// Returns whether the Charging Station has been able to remove the message.
686#[derive(Debug, Clone, PartialEq, Eq)]
687#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
688pub enum ClearMessageStatusEnum {
689    Accepted,
690    Unknown,
691}
692#[cfg(feature = "validate")]
693impl crate::validate::Validate for ClearMessageStatusEnum {
694    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
695        Ok(())
696    }
697}
698/// Result of the clear request for this monitor, identified by its Id.
699#[derive(Debug, Clone, PartialEq, Eq)]
700#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
701pub enum ClearMonitoringStatusEnum {
702    Accepted,
703    Rejected,
704    NotFound,
705}
706#[cfg(feature = "validate")]
707impl crate::validate::Validate for ClearMonitoringStatusEnum {
708    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
709        Ok(())
710    }
711}
712#[derive(Debug, Clone, PartialEq, Eq)]
713#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
714pub struct ClearMonitoringResult<CustomDataType = crate::NoCustomData> {
715    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
716    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
717    pub custom_data: Option<CustomDataType>,
718    /// Id of the monitor of which a clear was requested.
719    pub id: i64,
720    pub status: ClearMonitoringStatusEnum,
721    #[cfg_attr(feature = "serde", serde(rename = "statusInfo"))]
722    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
723    pub status_info: Option<StatusInfo<CustomDataType>>,
724}
725#[cfg(feature = "validate")]
726impl<CustomDataType> crate::validate::Validate
727for ClearMonitoringResult<CustomDataType> {
728    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
729        crate::validate::Validate::validate(&self.status)
730            .map_err(|error| error.in_field("status"))?;
731        if let Some(value) = &self.status_info {
732            crate::validate::Validate::validate(value)
733                .map_err(|error| error.in_field("statusInfo"))?;
734        }
735        Ok(())
736    }
737}
738/// Source of the charging limit.
739#[derive(Debug, Clone, PartialEq, Eq)]
740#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
741pub enum ChargingLimitSourceEnum {
742    EMS,
743    Other,
744    SO,
745    CSO,
746}
747#[cfg(feature = "validate")]
748impl crate::validate::Validate for ChargingLimitSourceEnum {
749    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
750        Ok(())
751    }
752}
753#[derive(Debug, Clone, PartialEq, Eq)]
754#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
755pub struct CertificateHashData<CustomDataType = crate::NoCustomData> {
756    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
757    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
758    pub custom_data: Option<CustomDataType>,
759    #[cfg_attr(feature = "serde", serde(rename = "hashAlgorithm"))]
760    pub hash_algorithm: HashAlgorithmEnum,
761    /// Hashed value of the issuers public key
762    #[cfg_attr(feature = "serde", serde(rename = "issuerKeyHash"))]
763    pub issuer_key_hash: heapless::String<128usize>,
764    /// Hashed value of the Issuer DN (Distinguished Name).
765    #[cfg_attr(feature = "serde", serde(rename = "issuerNameHash"))]
766    pub issuer_name_hash: heapless::String<128usize>,
767    /// The serial number of the certificate.
768    #[cfg_attr(feature = "serde", serde(rename = "serialNumber"))]
769    pub serial_number: heapless::String<40usize>,
770}
771#[cfg(feature = "validate")]
772impl<CustomDataType> crate::validate::Validate for CertificateHashData<CustomDataType> {
773    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
774        crate::validate::Validate::validate(&self.hash_algorithm)
775            .map_err(|error| error.in_field("hashAlgorithm"))?;
776        Ok(())
777    }
778}
779/// Indicates whether the request was accepted.
780#[derive(Debug, Clone, PartialEq, Eq)]
781#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
782pub enum CustomerInformationStatusEnum {
783    Accepted,
784    Rejected,
785    Invalid,
786}
787#[cfg(feature = "validate")]
788impl crate::validate::Validate for CustomerInformationStatusEnum {
789    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
790        Ok(())
791    }
792}
793/// This indicates the success or failure of the data transfer.
794#[derive(Debug, Clone, PartialEq, Eq)]
795#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
796pub enum DataTransferStatusEnum {
797    Accepted,
798    Rejected,
799    UnknownMessageId,
800    UnknownVendorId,
801}
802#[cfg(feature = "validate")]
803impl crate::validate::Validate for DataTransferStatusEnum {
804    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
805        Ok(())
806    }
807}
808/// Charging Station indicates if it can process the request.
809#[derive(Debug, Clone, PartialEq, Eq)]
810#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
811pub enum DeleteCertificateStatusEnum {
812    Accepted,
813    Failed,
814    NotFound,
815}
816#[cfg(feature = "validate")]
817impl crate::validate::Validate for DeleteCertificateStatusEnum {
818    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
819        Ok(())
820    }
821}
822/// This contains the progress status of the firmware installation.
823#[derive(Debug, Clone, PartialEq, Eq)]
824#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
825pub enum FirmwareStatusEnum {
826    Downloaded,
827    DownloadFailed,
828    Downloading,
829    DownloadScheduled,
830    DownloadPaused,
831    Idle,
832    InstallationFailed,
833    Installing,
834    Installed,
835    InstallRebooting,
836    InstallScheduled,
837    InstallVerificationFailed,
838    InvalidSignature,
839    SignatureVerified,
840}
841#[cfg(feature = "validate")]
842impl crate::validate::Validate for FirmwareStatusEnum {
843    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
844        Ok(())
845    }
846}
847/// Defines whether certificate needs to be installed or updated.
848#[derive(Debug, Clone, PartialEq, Eq)]
849#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
850pub enum CertificateActionEnum {
851    Install,
852    Update,
853}
854#[cfg(feature = "validate")]
855impl crate::validate::Validate for CertificateActionEnum {
856    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
857        Ok(())
858    }
859}
860/// Indicates whether the message was processed properly.
861#[derive(Debug, Clone, PartialEq, Eq)]
862#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
863pub enum Iso15118EVCertificateStatusEnum {
864    Accepted,
865    Failed,
866}
867#[cfg(feature = "validate")]
868impl crate::validate::Validate for Iso15118EVCertificateStatusEnum {
869    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
870        Ok(())
871    }
872}
873/// This field specifies the report base.
874#[derive(Debug, Clone, PartialEq, Eq)]
875#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
876pub enum ReportBaseEnum {
877    ConfigurationInventory,
878    FullInventory,
879    SummaryInventory,
880}
881#[cfg(feature = "validate")]
882impl crate::validate::Validate for ReportBaseEnum {
883    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
884        Ok(())
885    }
886}
887/// This indicates whether the Charging Station is able to accept this request.
888#[derive(Debug, Clone, PartialEq, Eq)]
889#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
890pub enum GenericDeviceModelStatusEnum {
891    Accepted,
892    Rejected,
893    NotSupported,
894    EmptyResultSet,
895}
896#[cfg(feature = "validate")]
897impl crate::validate::Validate for GenericDeviceModelStatusEnum {
898    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
899        Ok(())
900    }
901}
902/// This indicates whether the charging station was able to retrieve the OCSP certificate status.
903#[derive(Debug, Clone, PartialEq, Eq)]
904#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
905pub enum GetCertificateStatusEnum {
906    Accepted,
907    Failed,
908}
909#[cfg(feature = "validate")]
910impl crate::validate::Validate for GetCertificateStatusEnum {
911    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
912        Ok(())
913    }
914}
915#[cfg(feature = "alloc")]
916/// Charging_ Profile
917/// urn:x-oca:ocpp:uid:2:233255
918/// A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
919#[derive(Debug, Clone, PartialEq, Eq)]
920#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
921pub struct ChargingProfileCriterion<CustomDataType = crate::NoCustomData> {
922    /// For which charging limit sources, charging profiles SHALL be reported. If omitted, the Charging Station SHALL not filter on chargingLimitSource.
923    #[cfg_attr(feature = "serde", serde(rename = "chargingLimitSource"))]
924    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
925    pub charging_limit_source: Option<heapless::Vec<ChargingLimitSourceEnum, 4usize>>,
926    /// 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 &lt;&lt;configkey-charging-profile-entries,ChargingProfileEntries.maxLimit&gt;&gt;
927    #[cfg_attr(feature = "serde", serde(rename = "chargingProfileId"))]
928    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
929    pub charging_profile_id: Option<alloc::vec::Vec<i64>>,
930    #[cfg_attr(feature = "serde", serde(rename = "chargingProfilePurpose"))]
931    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
932    pub charging_profile_purpose: Option<ChargingProfilePurposeEnum>,
933    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
934    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
935    pub custom_data: Option<CustomDataType>,
936    /// Charging_ Profile. Stack_ Level. Counter
937    /// urn:x-oca:ocpp:uid:1:569230
938    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
939    #[cfg_attr(feature = "serde", serde(rename = "stackLevel"))]
940    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
941    pub stack_level: Option<i64>,
942}
943#[cfg(all(feature = "validate", feature = "alloc"))]
944impl<CustomDataType> crate::validate::Validate
945for ChargingProfileCriterion<CustomDataType> {
946    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
947        if let Some(value) = &self.charging_limit_source {
948            crate::validate::check_min_items(value.len(), 1usize)
949                .map_err(|error| error.in_field("chargingLimitSource"))?;
950            for (index, item) in value.iter().enumerate() {
951                crate::validate::Validate::validate(item)
952                    .map_err(|error| {
953                        error.in_index(index).in_field("chargingLimitSource")
954                    })?;
955            }
956        }
957        if let Some(value) = &self.charging_profile_id {
958            crate::validate::check_min_items(value.len(), 1usize)
959                .map_err(|error| error.in_field("chargingProfileId"))?;
960        }
961        if let Some(value) = &self.charging_profile_purpose {
962            crate::validate::Validate::validate(value)
963                .map_err(|error| error.in_field("chargingProfilePurpose"))?;
964        }
965        Ok(())
966    }
967}
968#[cfg(not(feature = "alloc"))]
969/// Charging_ Profile
970/// urn:x-oca:ocpp:uid:2:233255
971/// A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
972#[derive(Debug, Clone, PartialEq, Eq)]
973#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
974pub struct ChargingProfileCriterion<
975    CustomDataType = crate::NoCustomData,
976    const CHARGING_PROFILE_CRITERION_CHARGING_PROFILE_ID_CAP: usize = 8usize,
977> {
978    /// For which charging limit sources, charging profiles SHALL be reported. If omitted, the Charging Station SHALL not filter on chargingLimitSource.
979    #[cfg_attr(feature = "serde", serde(rename = "chargingLimitSource"))]
980    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
981    pub charging_limit_source: Option<heapless::Vec<ChargingLimitSourceEnum, 4usize>>,
982    /// 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 &lt;&lt;configkey-charging-profile-entries,ChargingProfileEntries.maxLimit&gt;&gt;
983    #[cfg_attr(feature = "serde", serde(rename = "chargingProfileId"))]
984    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
985    pub charging_profile_id: Option<
986        heapless::Vec<i64, CHARGING_PROFILE_CRITERION_CHARGING_PROFILE_ID_CAP>,
987    >,
988    #[cfg_attr(feature = "serde", serde(rename = "chargingProfilePurpose"))]
989    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
990    pub charging_profile_purpose: Option<ChargingProfilePurposeEnum>,
991    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
992    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
993    pub custom_data: Option<CustomDataType>,
994    /// Charging_ Profile. Stack_ Level. Counter
995    /// urn:x-oca:ocpp:uid:1:569230
996    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
997    #[cfg_attr(feature = "serde", serde(rename = "stackLevel"))]
998    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
999    pub stack_level: Option<i64>,
1000}
1001#[cfg(all(feature = "validate", not(feature = "alloc")))]
1002impl<
1003    CustomDataType,
1004    const CHARGING_PROFILE_CRITERION_CHARGING_PROFILE_ID_CAP: usize,
1005> crate::validate::Validate
1006for ChargingProfileCriterion<
1007    CustomDataType,
1008    CHARGING_PROFILE_CRITERION_CHARGING_PROFILE_ID_CAP,
1009> {
1010    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1011        if let Some(value) = &self.charging_limit_source {
1012            crate::validate::check_min_items(value.len(), 1usize)
1013                .map_err(|error| error.in_field("chargingLimitSource"))?;
1014            for (index, item) in value.iter().enumerate() {
1015                crate::validate::Validate::validate(item)
1016                    .map_err(|error| {
1017                        error.in_index(index).in_field("chargingLimitSource")
1018                    })?;
1019            }
1020        }
1021        if let Some(value) = &self.charging_profile_id {
1022            crate::validate::check_min_items(value.len(), 1usize)
1023                .map_err(|error| error.in_field("chargingProfileId"))?;
1024        }
1025        if let Some(value) = &self.charging_profile_purpose {
1026            crate::validate::Validate::validate(value)
1027                .map_err(|error| error.in_field("chargingProfilePurpose"))?;
1028        }
1029        Ok(())
1030    }
1031}
1032/// This indicates whether the Charging Station is able to process this request and will send &lt;&lt;reportchargingprofilesrequest, ReportChargingProfilesRequest&gt;&gt; messages.
1033#[derive(Debug, Clone, PartialEq, Eq)]
1034#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1035pub enum GetChargingProfileStatusEnum {
1036    Accepted,
1037    NoProfiles,
1038}
1039#[cfg(feature = "validate")]
1040impl crate::validate::Validate for GetChargingProfileStatusEnum {
1041    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1042        Ok(())
1043    }
1044}
1045/// Can be used to force a power or current profile.
1046#[derive(Debug, Clone, PartialEq, Eq)]
1047#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1048pub enum ChargingRateUnitEnum {
1049    W,
1050    A,
1051}
1052#[cfg(feature = "validate")]
1053impl crate::validate::Validate for ChargingRateUnitEnum {
1054    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1055        Ok(())
1056    }
1057}
1058/// Charging_ Schedule_ Period
1059/// urn:x-oca:ocpp:uid:2:233257
1060/// Charging schedule period structure defines a time period in a charging schedule.
1061#[derive(Debug, Clone, PartialEq)]
1062#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1063pub struct ChargingSchedulePeriod<CustomDataType = crate::NoCustomData> {
1064    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1065    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1066    pub custom_data: Option<CustomDataType>,
1067    /// Charging_ Schedule_ Period. Limit. Measure
1068    /// urn:x-oca:ocpp:uid:1:569241
1069    /// 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).
1070    pub limit: f64,
1071    /// Charging_ Schedule_ Period. Number_ Phases. Counter
1072    /// urn:x-oca:ocpp:uid:1:569242
1073    /// 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.
1074    #[cfg_attr(feature = "serde", serde(rename = "numberPhases"))]
1075    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1076    pub number_phases: Option<i64>,
1077    /// 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.
1078    #[cfg_attr(feature = "serde", serde(rename = "phaseToUse"))]
1079    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1080    pub phase_to_use: Option<i64>,
1081    /// Charging_ Schedule_ Period. Start_ Period. Elapsed_ Time
1082    /// urn:x-oca:ocpp:uid:1:569240
1083    /// Start of the period, in seconds from the start of schedule. The value of StartPeriod also defines the stop time of the previous period.
1084    #[cfg_attr(feature = "serde", serde(rename = "startPeriod"))]
1085    pub start_period: i64,
1086}
1087#[cfg(feature = "validate")]
1088impl<CustomDataType> crate::validate::Validate
1089for ChargingSchedulePeriod<CustomDataType> {
1090    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1091        Ok(())
1092    }
1093}
1094#[cfg(feature = "alloc")]
1095/// Composite_ Schedule
1096/// urn:x-oca:ocpp:uid:2:233362
1097#[derive(Debug, Clone, PartialEq)]
1098#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1099pub struct CompositeSchedule<CustomDataType = crate::NoCustomData> {
1100    #[cfg_attr(feature = "serde", serde(rename = "chargingRateUnit"))]
1101    pub charging_rate_unit: ChargingRateUnitEnum,
1102    #[cfg_attr(feature = "serde", serde(rename = "chargingSchedulePeriod"))]
1103    pub charging_schedule_period: alloc::vec::Vec<
1104        ChargingSchedulePeriod<CustomDataType>,
1105    >,
1106    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1107    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1108    pub custom_data: Option<CustomDataType>,
1109    /// Duration of the schedule in seconds.
1110    pub duration: i64,
1111    /// The ID of the EVSE for which the
1112    /// schedule is requested. When evseid=0, the
1113    /// Charging Station calculated the expected
1114    /// consumption for the grid connection.
1115    #[cfg_attr(feature = "serde", serde(rename = "evseId"))]
1116    pub evse_id: i64,
1117    /// Composite_ Schedule. Start. Date_ Time
1118    /// urn:x-oca:ocpp:uid:1:569456
1119    /// Date and time at which the schedule becomes active. All time measurements within the schedule are relative to this timestamp.
1120    #[cfg_attr(feature = "serde", serde(rename = "scheduleStart"))]
1121    pub schedule_start: crate::OcppTimestamp,
1122}
1123#[cfg(all(feature = "validate", feature = "alloc"))]
1124impl<CustomDataType> crate::validate::Validate for CompositeSchedule<CustomDataType> {
1125    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1126        crate::validate::Validate::validate(&self.charging_rate_unit)
1127            .map_err(|error| error.in_field("chargingRateUnit"))?;
1128        crate::validate::check_min_items(self.charging_schedule_period.len(), 1usize)
1129            .map_err(|error| error.in_field("chargingSchedulePeriod"))?;
1130        for (index, item) in self.charging_schedule_period.iter().enumerate() {
1131            crate::validate::Validate::validate(item)
1132                .map_err(|error| {
1133                    error.in_index(index).in_field("chargingSchedulePeriod")
1134                })?;
1135        }
1136        Ok(())
1137    }
1138}
1139#[cfg(not(feature = "alloc"))]
1140/// Composite_ Schedule
1141/// urn:x-oca:ocpp:uid:2:233362
1142#[derive(Debug, Clone, PartialEq)]
1143#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1144pub struct CompositeSchedule<
1145    CustomDataType = crate::NoCustomData,
1146    const COMPOSITE_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP: usize = 8usize,
1147> {
1148    #[cfg_attr(feature = "serde", serde(rename = "chargingRateUnit"))]
1149    pub charging_rate_unit: ChargingRateUnitEnum,
1150    #[cfg_attr(feature = "serde", serde(rename = "chargingSchedulePeriod"))]
1151    pub charging_schedule_period: heapless::Vec<
1152        ChargingSchedulePeriod<CustomDataType>,
1153        COMPOSITE_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP,
1154    >,
1155    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1156    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1157    pub custom_data: Option<CustomDataType>,
1158    /// Duration of the schedule in seconds.
1159    pub duration: i64,
1160    /// The ID of the EVSE for which the
1161    /// schedule is requested. When evseid=0, the
1162    /// Charging Station calculated the expected
1163    /// consumption for the grid connection.
1164    #[cfg_attr(feature = "serde", serde(rename = "evseId"))]
1165    pub evse_id: i64,
1166    /// Composite_ Schedule. Start. Date_ Time
1167    /// urn:x-oca:ocpp:uid:1:569456
1168    /// Date and time at which the schedule becomes active. All time measurements within the schedule are relative to this timestamp.
1169    #[cfg_attr(feature = "serde", serde(rename = "scheduleStart"))]
1170    pub schedule_start: crate::OcppTimestamp,
1171}
1172#[cfg(all(feature = "validate", not(feature = "alloc")))]
1173impl<
1174    CustomDataType,
1175    const COMPOSITE_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP: usize,
1176> crate::validate::Validate
1177for CompositeSchedule<CustomDataType, COMPOSITE_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP> {
1178    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1179        crate::validate::Validate::validate(&self.charging_rate_unit)
1180            .map_err(|error| error.in_field("chargingRateUnit"))?;
1181        crate::validate::check_min_items(self.charging_schedule_period.len(), 1usize)
1182            .map_err(|error| error.in_field("chargingSchedulePeriod"))?;
1183        for (index, item) in self.charging_schedule_period.iter().enumerate() {
1184            crate::validate::Validate::validate(item)
1185                .map_err(|error| {
1186                    error.in_index(index).in_field("chargingSchedulePeriod")
1187                })?;
1188        }
1189        Ok(())
1190    }
1191}
1192/// The Charging Station will indicate if it was
1193/// able to process the request
1194#[derive(Debug, Clone, PartialEq, Eq)]
1195#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1196pub enum GenericStatusEnum {
1197    Accepted,
1198    Rejected,
1199}
1200#[cfg(feature = "validate")]
1201impl crate::validate::Validate for GenericStatusEnum {
1202    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1203        Ok(())
1204    }
1205}
1206/// If provided the Charging Station shall return Display Messages with the given priority only.
1207#[derive(Debug, Clone, PartialEq, Eq)]
1208#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1209pub enum MessagePriorityEnum {
1210    AlwaysFront,
1211    InFront,
1212    NormalCycle,
1213}
1214#[cfg(feature = "validate")]
1215impl crate::validate::Validate for MessagePriorityEnum {
1216    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1217        Ok(())
1218    }
1219}
1220/// If provided the Charging Station shall return Display Messages with the given state only.
1221#[derive(Debug, Clone, PartialEq, Eq)]
1222#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1223pub enum MessageStateEnum {
1224    Charging,
1225    Faulted,
1226    Idle,
1227    Unavailable,
1228}
1229#[cfg(feature = "validate")]
1230impl crate::validate::Validate for MessageStateEnum {
1231    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1232        Ok(())
1233    }
1234}
1235/// Indicates if the Charging Station has Display Messages that match the request criteria in the &lt;&lt;getdisplaymessagesrequest,GetDisplayMessagesRequest&gt;&gt;
1236#[derive(Debug, Clone, PartialEq, Eq)]
1237#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1238pub enum GetDisplayMessagesStatusEnum {
1239    Accepted,
1240    Unknown,
1241}
1242#[cfg(feature = "validate")]
1243impl crate::validate::Validate for GetDisplayMessagesStatusEnum {
1244    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1245        Ok(())
1246    }
1247}
1248#[derive(Debug, Clone, PartialEq, Eq)]
1249#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1250pub enum GetCertificateIdUseEnum {
1251    V2GRootCertificate,
1252    MORootCertificate,
1253    CSMSRootCertificate,
1254    V2GCertificateChain,
1255    ManufacturerRootCertificate,
1256}
1257#[cfg(feature = "validate")]
1258impl crate::validate::Validate for GetCertificateIdUseEnum {
1259    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1260        Ok(())
1261    }
1262}
1263#[derive(Debug, Clone, PartialEq, Eq)]
1264#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1265pub struct CertificateHashDataChain<CustomDataType = crate::NoCustomData> {
1266    #[cfg_attr(feature = "serde", serde(rename = "certificateHashData"))]
1267    pub certificate_hash_data: CertificateHashData<CustomDataType>,
1268    #[cfg_attr(feature = "serde", serde(rename = "certificateType"))]
1269    pub certificate_type: GetCertificateIdUseEnum,
1270    #[cfg_attr(feature = "serde", serde(rename = "childCertificateHashData"))]
1271    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1272    pub child_certificate_hash_data: Option<
1273        heapless::Vec<CertificateHashData<CustomDataType>, 4usize>,
1274    >,
1275    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1276    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1277    pub custom_data: Option<CustomDataType>,
1278}
1279#[cfg(feature = "validate")]
1280impl<CustomDataType> crate::validate::Validate
1281for CertificateHashDataChain<CustomDataType> {
1282    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1283        crate::validate::Validate::validate(&self.certificate_hash_data)
1284            .map_err(|error| error.in_field("certificateHashData"))?;
1285        crate::validate::Validate::validate(&self.certificate_type)
1286            .map_err(|error| error.in_field("certificateType"))?;
1287        if let Some(value) = &self.child_certificate_hash_data {
1288            crate::validate::check_min_items(value.len(), 1usize)
1289                .map_err(|error| error.in_field("childCertificateHashData"))?;
1290            for (index, item) in value.iter().enumerate() {
1291                crate::validate::Validate::validate(item)
1292                    .map_err(|error| {
1293                        error.in_index(index).in_field("childCertificateHashData")
1294                    })?;
1295            }
1296        }
1297        Ok(())
1298    }
1299}
1300/// Charging Station indicates if it can process the request.
1301#[derive(Debug, Clone, PartialEq, Eq)]
1302#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1303pub enum GetInstalledCertificateStatusEnum {
1304    Accepted,
1305    NotFound,
1306}
1307#[cfg(feature = "validate")]
1308impl crate::validate::Validate for GetInstalledCertificateStatusEnum {
1309    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1310        Ok(())
1311    }
1312}
1313/// Log
1314/// urn:x-enexis:ecdm:uid:2:233373
1315/// Generic class for the configuration of logging entries.
1316#[derive(Debug, Clone, PartialEq, Eq)]
1317#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1318pub struct LogParameters<CustomDataType = crate::NoCustomData> {
1319    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1320    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1321    pub custom_data: Option<CustomDataType>,
1322    /// Log. Latest_ Timestamp. Date_ Time
1323    /// urn:x-enexis:ecdm:uid:1:569482
1324    /// This contains the date and time of the latest logging information to include in the diagnostics.
1325    #[cfg_attr(feature = "serde", serde(rename = "latestTimestamp"))]
1326    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1327    pub latest_timestamp: Option<crate::OcppTimestamp>,
1328    /// Log. Oldest_ Timestamp. Date_ Time
1329    /// urn:x-enexis:ecdm:uid:1:569477
1330    /// This contains the date and time of the oldest logging information to include in the diagnostics.
1331    #[cfg_attr(feature = "serde", serde(rename = "oldestTimestamp"))]
1332    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1333    pub oldest_timestamp: Option<crate::OcppTimestamp>,
1334    /// Log. Remote_ Location. URI
1335    /// urn:x-enexis:ecdm:uid:1:569484
1336    /// The URL of the location at the remote system where the log should be stored.
1337    #[cfg_attr(feature = "serde", serde(rename = "remoteLocation"))]
1338    pub remote_location: heapless::String<512usize>,
1339}
1340#[cfg(feature = "validate")]
1341impl<CustomDataType> crate::validate::Validate for LogParameters<CustomDataType> {
1342    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1343        Ok(())
1344    }
1345}
1346/// This contains the type of log file that the Charging Station
1347/// should send.
1348#[derive(Debug, Clone, PartialEq, Eq)]
1349#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1350pub enum LogEnum {
1351    DiagnosticsLog,
1352    SecurityLog,
1353}
1354#[cfg(feature = "validate")]
1355impl crate::validate::Validate for LogEnum {
1356    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1357        Ok(())
1358    }
1359}
1360/// This field indicates whether the Charging Station was able to accept the request.
1361#[derive(Debug, Clone, PartialEq, Eq)]
1362#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1363pub enum LogStatusEnum {
1364    Accepted,
1365    Rejected,
1366    AcceptedCanceled,
1367}
1368#[cfg(feature = "validate")]
1369impl crate::validate::Validate for LogStatusEnum {
1370    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1371        Ok(())
1372    }
1373}
1374/// A physical or logical component
1375#[derive(Debug, Clone, PartialEq, Eq)]
1376#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1377pub struct Component<CustomDataType = crate::NoCustomData> {
1378    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1379    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1380    pub custom_data: Option<CustomDataType>,
1381    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1382    pub evse: Option<EVSE<CustomDataType>>,
1383    /// Name of instance in case the component exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
1384    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1385    pub instance: Option<heapless::String<50usize>>,
1386    /// 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.
1387    pub name: heapless::String<50usize>,
1388}
1389#[cfg(feature = "validate")]
1390impl<CustomDataType> crate::validate::Validate for Component<CustomDataType> {
1391    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1392        if let Some(value) = &self.evse {
1393            crate::validate::Validate::validate(value)
1394                .map_err(|error| error.in_field("evse"))?;
1395        }
1396        Ok(())
1397    }
1398}
1399/// Reference key to a component-variable.
1400#[derive(Debug, Clone, PartialEq, Eq)]
1401#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1402pub struct Variable<CustomDataType = crate::NoCustomData> {
1403    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1404    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1405    pub custom_data: Option<CustomDataType>,
1406    /// Name of instance in case the variable exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
1407    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1408    pub instance: Option<heapless::String<50usize>>,
1409    /// 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.
1410    pub name: heapless::String<50usize>,
1411}
1412#[cfg(feature = "validate")]
1413impl<CustomDataType> crate::validate::Validate for Variable<CustomDataType> {
1414    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1415        Ok(())
1416    }
1417}
1418/// Class to report components, variables and variable attributes and characteristics.
1419#[derive(Debug, Clone, PartialEq, Eq)]
1420#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1421pub struct ComponentVariable<CustomDataType = crate::NoCustomData> {
1422    pub component: Component<CustomDataType>,
1423    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1424    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1425    pub custom_data: Option<CustomDataType>,
1426    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1427    pub variable: Option<Variable<CustomDataType>>,
1428}
1429#[cfg(feature = "validate")]
1430impl<CustomDataType> crate::validate::Validate for ComponentVariable<CustomDataType> {
1431    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1432        crate::validate::Validate::validate(&self.component)
1433            .map_err(|error| error.in_field("component"))?;
1434        if let Some(value) = &self.variable {
1435            crate::validate::Validate::validate(value)
1436                .map_err(|error| error.in_field("variable"))?;
1437        }
1438        Ok(())
1439    }
1440}
1441#[derive(Debug, Clone, PartialEq, Eq)]
1442#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1443pub enum MonitoringCriterionEnum {
1444    ThresholdMonitoring,
1445    DeltaMonitoring,
1446    PeriodicMonitoring,
1447}
1448#[cfg(feature = "validate")]
1449impl crate::validate::Validate for MonitoringCriterionEnum {
1450    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1451        Ok(())
1452    }
1453}
1454#[derive(Debug, Clone, PartialEq, Eq)]
1455#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1456pub enum ComponentCriterionEnum {
1457    Active,
1458    Available,
1459    Enabled,
1460    Problem,
1461}
1462#[cfg(feature = "validate")]
1463impl crate::validate::Validate for ComponentCriterionEnum {
1464    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1465        Ok(())
1466    }
1467}
1468/// Attribute type for which value is requested. When absent, default Actual is assumed.
1469#[derive(Debug, Clone, PartialEq, Eq)]
1470#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1471pub enum AttributeEnum {
1472    Actual,
1473    Target,
1474    MinSet,
1475    MaxSet,
1476}
1477#[cfg(feature = "validate")]
1478impl crate::validate::Validate for AttributeEnum {
1479    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1480        Ok(())
1481    }
1482}
1483/// Class to hold parameters for GetVariables request.
1484#[derive(Debug, Clone, PartialEq, Eq)]
1485#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1486pub struct GetVariableData<CustomDataType = crate::NoCustomData> {
1487    #[cfg_attr(feature = "serde", serde(rename = "attributeType"))]
1488    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1489    pub attribute_type: Option<AttributeEnum>,
1490    pub component: Component<CustomDataType>,
1491    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1492    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1493    pub custom_data: Option<CustomDataType>,
1494    pub variable: Variable<CustomDataType>,
1495}
1496#[cfg(feature = "validate")]
1497impl<CustomDataType> crate::validate::Validate for GetVariableData<CustomDataType> {
1498    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1499        if let Some(value) = &self.attribute_type {
1500            crate::validate::Validate::validate(value)
1501                .map_err(|error| error.in_field("attributeType"))?;
1502        }
1503        crate::validate::Validate::validate(&self.component)
1504            .map_err(|error| error.in_field("component"))?;
1505        crate::validate::Validate::validate(&self.variable)
1506            .map_err(|error| error.in_field("variable"))?;
1507        Ok(())
1508    }
1509}
1510/// Result status of getting the variable.
1511#[derive(Debug, Clone, PartialEq, Eq)]
1512#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1513pub enum GetVariableStatusEnum {
1514    Accepted,
1515    Rejected,
1516    UnknownComponent,
1517    UnknownVariable,
1518    NotSupportedAttributeType,
1519}
1520#[cfg(feature = "validate")]
1521impl crate::validate::Validate for GetVariableStatusEnum {
1522    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1523        Ok(())
1524    }
1525}
1526#[cfg(feature = "alloc")]
1527/// Class to hold results of GetVariables request.
1528#[derive(Debug, Clone, PartialEq, Eq)]
1529#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1530pub struct GetVariableResult<CustomDataType = crate::NoCustomData> {
1531    #[cfg_attr(feature = "serde", serde(rename = "attributeStatus"))]
1532    pub attribute_status: GetVariableStatusEnum,
1533    #[cfg_attr(feature = "serde", serde(rename = "attributeStatusInfo"))]
1534    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1535    pub attribute_status_info: Option<StatusInfo<CustomDataType>>,
1536    #[cfg_attr(feature = "serde", serde(rename = "attributeType"))]
1537    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1538    pub attribute_type: Option<AttributeEnum>,
1539    /// Value of requested attribute type of component-variable. This field can only be empty when the given status is NOT accepted.
1540    ///
1541    /// The Configuration Variable &lt;&lt;configkey-reporting-value-size,ReportingValueSize&gt;&gt; can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
1542    #[cfg_attr(feature = "serde", serde(rename = "attributeValue"))]
1543    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1544    pub attribute_value: Option<alloc::string::String>,
1545    pub component: Component<CustomDataType>,
1546    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1547    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1548    pub custom_data: Option<CustomDataType>,
1549    pub variable: Variable<CustomDataType>,
1550}
1551#[cfg(all(feature = "validate", feature = "alloc"))]
1552impl<CustomDataType> crate::validate::Validate for GetVariableResult<CustomDataType> {
1553    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1554        crate::validate::Validate::validate(&self.attribute_status)
1555            .map_err(|error| error.in_field("attributeStatus"))?;
1556        if let Some(value) = &self.attribute_status_info {
1557            crate::validate::Validate::validate(value)
1558                .map_err(|error| error.in_field("attributeStatusInfo"))?;
1559        }
1560        if let Some(value) = &self.attribute_type {
1561            crate::validate::Validate::validate(value)
1562                .map_err(|error| error.in_field("attributeType"))?;
1563        }
1564        if let Some(value) = &self.attribute_value {
1565            crate::validate::check_max_length(value, 2500usize)
1566                .map_err(|error| error.in_field("attributeValue"))?;
1567        }
1568        crate::validate::Validate::validate(&self.component)
1569            .map_err(|error| error.in_field("component"))?;
1570        crate::validate::Validate::validate(&self.variable)
1571            .map_err(|error| error.in_field("variable"))?;
1572        Ok(())
1573    }
1574}
1575#[cfg(not(feature = "alloc"))]
1576/// Class to hold results of GetVariables request.
1577#[derive(Debug, Clone, PartialEq, Eq)]
1578#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1579pub struct GetVariableResult<
1580    CustomDataType = crate::NoCustomData,
1581    const GET_VARIABLE_RESULT_ATTRIBUTE_VALUE_CAP: usize = 1024usize,
1582> {
1583    #[cfg_attr(feature = "serde", serde(rename = "attributeStatus"))]
1584    pub attribute_status: GetVariableStatusEnum,
1585    #[cfg_attr(feature = "serde", serde(rename = "attributeStatusInfo"))]
1586    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1587    pub attribute_status_info: Option<StatusInfo<CustomDataType>>,
1588    #[cfg_attr(feature = "serde", serde(rename = "attributeType"))]
1589    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1590    pub attribute_type: Option<AttributeEnum>,
1591    /// Value of requested attribute type of component-variable. This field can only be empty when the given status is NOT accepted.
1592    ///
1593    /// The Configuration Variable &lt;&lt;configkey-reporting-value-size,ReportingValueSize&gt;&gt; can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
1594    #[cfg_attr(feature = "serde", serde(rename = "attributeValue"))]
1595    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1596    pub attribute_value: Option<
1597        heapless::String<GET_VARIABLE_RESULT_ATTRIBUTE_VALUE_CAP>,
1598    >,
1599    pub component: Component<CustomDataType>,
1600    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1601    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1602    pub custom_data: Option<CustomDataType>,
1603    pub variable: Variable<CustomDataType>,
1604}
1605#[cfg(all(feature = "validate", not(feature = "alloc")))]
1606impl<
1607    CustomDataType,
1608    const GET_VARIABLE_RESULT_ATTRIBUTE_VALUE_CAP: usize,
1609> crate::validate::Validate
1610for GetVariableResult<CustomDataType, GET_VARIABLE_RESULT_ATTRIBUTE_VALUE_CAP> {
1611    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1612        crate::validate::Validate::validate(&self.attribute_status)
1613            .map_err(|error| error.in_field("attributeStatus"))?;
1614        if let Some(value) = &self.attribute_status_info {
1615            crate::validate::Validate::validate(value)
1616                .map_err(|error| error.in_field("attributeStatusInfo"))?;
1617        }
1618        if let Some(value) = &self.attribute_type {
1619            crate::validate::Validate::validate(value)
1620                .map_err(|error| error.in_field("attributeType"))?;
1621        }
1622        if let Some(value) = &self.attribute_value {
1623            crate::validate::check_max_length(value, 2500usize)
1624                .map_err(|error| error.in_field("attributeValue"))?;
1625        }
1626        crate::validate::Validate::validate(&self.component)
1627            .map_err(|error| error.in_field("component"))?;
1628        crate::validate::Validate::validate(&self.variable)
1629            .map_err(|error| error.in_field("variable"))?;
1630        Ok(())
1631    }
1632}
1633/// Indicates the certificate type that is sent.
1634#[derive(Debug, Clone, PartialEq, Eq)]
1635#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1636pub enum InstallCertificateUseEnum {
1637    V2GRootCertificate,
1638    MORootCertificate,
1639    CSMSRootCertificate,
1640    ManufacturerRootCertificate,
1641}
1642#[cfg(feature = "validate")]
1643impl crate::validate::Validate for InstallCertificateUseEnum {
1644    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1645        Ok(())
1646    }
1647}
1648/// Charging Station indicates if installation was successful.
1649#[derive(Debug, Clone, PartialEq, Eq)]
1650#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1651pub enum InstallCertificateStatusEnum {
1652    Accepted,
1653    Rejected,
1654    Failed,
1655}
1656#[cfg(feature = "validate")]
1657impl crate::validate::Validate for InstallCertificateStatusEnum {
1658    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1659        Ok(())
1660    }
1661}
1662/// This contains the status of the log upload.
1663#[derive(Debug, Clone, PartialEq, Eq)]
1664#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1665pub enum UploadLogStatusEnum {
1666    BadMessage,
1667    Idle,
1668    NotSupportedOperation,
1669    PermissionDenied,
1670    Uploaded,
1671    UploadFailure,
1672    Uploading,
1673    AcceptedCanceled,
1674}
1675#[cfg(feature = "validate")]
1676impl crate::validate::Validate for UploadLogStatusEnum {
1677    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1678        Ok(())
1679    }
1680}
1681/// Sampled_ Value. Context. Reading_ Context_ Code
1682/// urn:x-oca:ocpp:uid:1:569261
1683/// Type of detail value: start, end or sample. Default = "Sample.Periodic"
1684#[derive(Debug, Clone, PartialEq, Eq)]
1685#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1686pub enum ReadingContextEnum {
1687    #[cfg_attr(feature = "serde", serde(rename = "Interruption.Begin"))]
1688    InterruptionBegin,
1689    #[cfg_attr(feature = "serde", serde(rename = "Interruption.End"))]
1690    InterruptionEnd,
1691    Other,
1692    #[cfg_attr(feature = "serde", serde(rename = "Sample.Clock"))]
1693    SampleClock,
1694    #[cfg_attr(feature = "serde", serde(rename = "Sample.Periodic"))]
1695    SamplePeriodic,
1696    #[cfg_attr(feature = "serde", serde(rename = "Transaction.Begin"))]
1697    TransactionBegin,
1698    #[cfg_attr(feature = "serde", serde(rename = "Transaction.End"))]
1699    TransactionEnd,
1700    Trigger,
1701}
1702#[cfg(feature = "validate")]
1703impl crate::validate::Validate for ReadingContextEnum {
1704    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1705        Ok(())
1706    }
1707}
1708/// Sampled_ Value. Location. Location_ Code
1709/// urn:x-oca:ocpp:uid:1:569265
1710/// Indicates where the measured value has been sampled. Default =  "Outlet"
1711#[derive(Debug, Clone, PartialEq, Eq)]
1712#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1713pub enum LocationEnum {
1714    Body,
1715    Cable,
1716    EV,
1717    Inlet,
1718    Outlet,
1719}
1720#[cfg(feature = "validate")]
1721impl crate::validate::Validate for LocationEnum {
1722    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1723        Ok(())
1724    }
1725}
1726/// Sampled_ Value. Measurand. Measurand_ Code
1727/// urn:x-oca:ocpp:uid:1:569263
1728/// Type of measurement. Default = "Energy.Active.Import.Register"
1729#[derive(Debug, Clone, PartialEq, Eq)]
1730#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1731pub enum MeasurandEnum {
1732    #[cfg_attr(feature = "serde", serde(rename = "Current.Export"))]
1733    CurrentExport,
1734    #[cfg_attr(feature = "serde", serde(rename = "Current.Import"))]
1735    CurrentImport,
1736    #[cfg_attr(feature = "serde", serde(rename = "Current.Offered"))]
1737    CurrentOffered,
1738    #[cfg_attr(feature = "serde", serde(rename = "Energy.Active.Export.Register"))]
1739    EnergyActiveExportRegister,
1740    #[cfg_attr(feature = "serde", serde(rename = "Energy.Active.Import.Register"))]
1741    EnergyActiveImportRegister,
1742    #[cfg_attr(feature = "serde", serde(rename = "Energy.Reactive.Export.Register"))]
1743    EnergyReactiveExportRegister,
1744    #[cfg_attr(feature = "serde", serde(rename = "Energy.Reactive.Import.Register"))]
1745    EnergyReactiveImportRegister,
1746    #[cfg_attr(feature = "serde", serde(rename = "Energy.Active.Export.Interval"))]
1747    EnergyActiveExportInterval,
1748    #[cfg_attr(feature = "serde", serde(rename = "Energy.Active.Import.Interval"))]
1749    EnergyActiveImportInterval,
1750    #[cfg_attr(feature = "serde", serde(rename = "Energy.Active.Net"))]
1751    EnergyActiveNet,
1752    #[cfg_attr(feature = "serde", serde(rename = "Energy.Reactive.Export.Interval"))]
1753    EnergyReactiveExportInterval,
1754    #[cfg_attr(feature = "serde", serde(rename = "Energy.Reactive.Import.Interval"))]
1755    EnergyReactiveImportInterval,
1756    #[cfg_attr(feature = "serde", serde(rename = "Energy.Reactive.Net"))]
1757    EnergyReactiveNet,
1758    #[cfg_attr(feature = "serde", serde(rename = "Energy.Apparent.Net"))]
1759    EnergyApparentNet,
1760    #[cfg_attr(feature = "serde", serde(rename = "Energy.Apparent.Import"))]
1761    EnergyApparentImport,
1762    #[cfg_attr(feature = "serde", serde(rename = "Energy.Apparent.Export"))]
1763    EnergyApparentExport,
1764    Frequency,
1765    #[cfg_attr(feature = "serde", serde(rename = "Power.Active.Export"))]
1766    PowerActiveExport,
1767    #[cfg_attr(feature = "serde", serde(rename = "Power.Active.Import"))]
1768    PowerActiveImport,
1769    #[cfg_attr(feature = "serde", serde(rename = "Power.Factor"))]
1770    PowerFactor,
1771    #[cfg_attr(feature = "serde", serde(rename = "Power.Offered"))]
1772    PowerOffered,
1773    #[cfg_attr(feature = "serde", serde(rename = "Power.Reactive.Export"))]
1774    PowerReactiveExport,
1775    #[cfg_attr(feature = "serde", serde(rename = "Power.Reactive.Import"))]
1776    PowerReactiveImport,
1777    SoC,
1778    Voltage,
1779}
1780#[cfg(feature = "validate")]
1781impl crate::validate::Validate for MeasurandEnum {
1782    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1783        Ok(())
1784    }
1785}
1786/// Sampled_ Value. Phase. Phase_ Code
1787/// urn:x-oca:ocpp:uid:1:569264
1788/// Indicates how the measured value is to be interpreted. For instance between L1 and neutral (L1-N) Please note that not all values of phase are applicable to all Measurands. When phase is absent, the measured value is interpreted as an overall value.
1789#[derive(Debug, Clone, PartialEq, Eq)]
1790#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1791pub enum PhaseEnum {
1792    L1,
1793    L2,
1794    L3,
1795    N,
1796    #[cfg_attr(feature = "serde", serde(rename = "L1-N"))]
1797    L1N,
1798    #[cfg_attr(feature = "serde", serde(rename = "L2-N"))]
1799    L2N,
1800    #[cfg_attr(feature = "serde", serde(rename = "L3-N"))]
1801    L3N,
1802    #[cfg_attr(feature = "serde", serde(rename = "L1-L2"))]
1803    L1L2,
1804    #[cfg_attr(feature = "serde", serde(rename = "L2-L3"))]
1805    L2L3,
1806    #[cfg_attr(feature = "serde", serde(rename = "L3-L1"))]
1807    L3L1,
1808}
1809#[cfg(feature = "validate")]
1810impl crate::validate::Validate for PhaseEnum {
1811    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1812        Ok(())
1813    }
1814}
1815#[cfg(feature = "alloc")]
1816/// Represent a signed version of the meter value.
1817#[derive(Debug, Clone, PartialEq, Eq)]
1818#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1819pub struct SignedMeterValue<CustomDataType = crate::NoCustomData> {
1820    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1821    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1822    pub custom_data: Option<CustomDataType>,
1823    /// Method used to encode the meter values before applying the digital signature algorithm.
1824    #[cfg_attr(feature = "serde", serde(rename = "encodingMethod"))]
1825    pub encoding_method: heapless::String<50usize>,
1826    /// Base64 encoded, sending depends on configuration variable _PublicKeyWithSignedMeterValue_.
1827    #[cfg_attr(feature = "serde", serde(rename = "publicKey"))]
1828    pub public_key: alloc::string::String,
1829    /// 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.
1830    #[cfg_attr(feature = "serde", serde(rename = "signedMeterData"))]
1831    pub signed_meter_data: alloc::string::String,
1832    /// Method used to create the digital signature.
1833    #[cfg_attr(feature = "serde", serde(rename = "signingMethod"))]
1834    pub signing_method: heapless::String<50usize>,
1835}
1836#[cfg(all(feature = "validate", feature = "alloc"))]
1837impl<CustomDataType> crate::validate::Validate for SignedMeterValue<CustomDataType> {
1838    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1839        crate::validate::check_max_length(&self.public_key, 2500usize)
1840            .map_err(|error| error.in_field("publicKey"))?;
1841        crate::validate::check_max_length(&self.signed_meter_data, 2500usize)
1842            .map_err(|error| error.in_field("signedMeterData"))?;
1843        Ok(())
1844    }
1845}
1846#[cfg(not(feature = "alloc"))]
1847/// Represent a signed version of the meter value.
1848#[derive(Debug, Clone, PartialEq, Eq)]
1849#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1850pub struct SignedMeterValue<
1851    CustomDataType = crate::NoCustomData,
1852    const SIGNED_METER_VALUE_PUBLIC_KEY_CAP: usize = 1024usize,
1853    const SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP: usize = 1024usize,
1854> {
1855    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1856    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1857    pub custom_data: Option<CustomDataType>,
1858    /// Method used to encode the meter values before applying the digital signature algorithm.
1859    #[cfg_attr(feature = "serde", serde(rename = "encodingMethod"))]
1860    pub encoding_method: heapless::String<50usize>,
1861    /// Base64 encoded, sending depends on configuration variable _PublicKeyWithSignedMeterValue_.
1862    #[cfg_attr(feature = "serde", serde(rename = "publicKey"))]
1863    pub public_key: heapless::String<SIGNED_METER_VALUE_PUBLIC_KEY_CAP>,
1864    /// 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.
1865    #[cfg_attr(feature = "serde", serde(rename = "signedMeterData"))]
1866    pub signed_meter_data: heapless::String<SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP>,
1867    /// Method used to create the digital signature.
1868    #[cfg_attr(feature = "serde", serde(rename = "signingMethod"))]
1869    pub signing_method: heapless::String<50usize>,
1870}
1871#[cfg(all(feature = "validate", not(feature = "alloc")))]
1872impl<
1873    CustomDataType,
1874    const SIGNED_METER_VALUE_PUBLIC_KEY_CAP: usize,
1875    const SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP: usize,
1876> crate::validate::Validate
1877for SignedMeterValue<
1878    CustomDataType,
1879    SIGNED_METER_VALUE_PUBLIC_KEY_CAP,
1880    SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP,
1881> {
1882    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1883        crate::validate::check_max_length(&self.public_key, 2500usize)
1884            .map_err(|error| error.in_field("publicKey"))?;
1885        crate::validate::check_max_length(&self.signed_meter_data, 2500usize)
1886            .map_err(|error| error.in_field("signedMeterData"))?;
1887        Ok(())
1888    }
1889}
1890/// Represents a UnitOfMeasure with a multiplier
1891#[derive(Debug, Clone, PartialEq, Eq)]
1892#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1893pub struct UnitOfMeasure<CustomDataType = crate::NoCustomData> {
1894    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1895    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1896    pub custom_data: Option<CustomDataType>,
1897    /// Multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10 raised to the 3rd power. Default is 0.
1898    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1899    pub multiplier: Option<i64>,
1900    /// Unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type.
1901    /// This field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
1902    /// If an applicable unit is available in that list, otherwise a "custom" unit might be used.
1903    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1904    pub unit: Option<heapless::String<20usize>>,
1905}
1906#[cfg(feature = "validate")]
1907impl<CustomDataType> crate::validate::Validate for UnitOfMeasure<CustomDataType> {
1908    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1909        Ok(())
1910    }
1911}
1912#[cfg(feature = "alloc")]
1913/// Sampled_ Value
1914/// urn:x-oca:ocpp:uid:2:233266
1915/// Single sampled value in MeterValues. Each value can be accompanied by optional fields.
1916///
1917/// 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.
1918#[derive(Debug, Clone, PartialEq)]
1919#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1920pub struct SampledValue<CustomDataType = crate::NoCustomData> {
1921    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1922    pub context: Option<ReadingContextEnum>,
1923    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1924    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1925    pub custom_data: Option<CustomDataType>,
1926    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1927    pub location: Option<LocationEnum>,
1928    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1929    pub measurand: Option<MeasurandEnum>,
1930    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1931    pub phase: Option<PhaseEnum>,
1932    #[cfg_attr(feature = "serde", serde(rename = "signedMeterValue"))]
1933    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1934    pub signed_meter_value: Option<SignedMeterValue<CustomDataType>>,
1935    #[cfg_attr(feature = "serde", serde(rename = "unitOfMeasure"))]
1936    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1937    pub unit_of_measure: Option<UnitOfMeasure<CustomDataType>>,
1938    /// Sampled_ Value. Value. Measure
1939    /// urn:x-oca:ocpp:uid:1:569260
1940    /// Indicates the measured value.
1941    pub value: f64,
1942}
1943#[cfg(all(feature = "validate", feature = "alloc"))]
1944impl<CustomDataType> crate::validate::Validate for SampledValue<CustomDataType> {
1945    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
1946        if let Some(value) = &self.context {
1947            crate::validate::Validate::validate(value)
1948                .map_err(|error| error.in_field("context"))?;
1949        }
1950        if let Some(value) = &self.location {
1951            crate::validate::Validate::validate(value)
1952                .map_err(|error| error.in_field("location"))?;
1953        }
1954        if let Some(value) = &self.measurand {
1955            crate::validate::Validate::validate(value)
1956                .map_err(|error| error.in_field("measurand"))?;
1957        }
1958        if let Some(value) = &self.phase {
1959            crate::validate::Validate::validate(value)
1960                .map_err(|error| error.in_field("phase"))?;
1961        }
1962        if let Some(value) = &self.signed_meter_value {
1963            crate::validate::Validate::validate(value)
1964                .map_err(|error| error.in_field("signedMeterValue"))?;
1965        }
1966        if let Some(value) = &self.unit_of_measure {
1967            crate::validate::Validate::validate(value)
1968                .map_err(|error| error.in_field("unitOfMeasure"))?;
1969        }
1970        Ok(())
1971    }
1972}
1973#[cfg(not(feature = "alloc"))]
1974/// Sampled_ Value
1975/// urn:x-oca:ocpp:uid:2:233266
1976/// Single sampled value in MeterValues. Each value can be accompanied by optional fields.
1977///
1978/// 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.
1979#[derive(Debug, Clone, PartialEq)]
1980#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1981pub struct SampledValue<
1982    CustomDataType = crate::NoCustomData,
1983    const SIGNED_METER_VALUE_PUBLIC_KEY_CAP: usize = 1024usize,
1984    const SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP: usize = 1024usize,
1985> {
1986    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1987    pub context: Option<ReadingContextEnum>,
1988    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
1989    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1990    pub custom_data: Option<CustomDataType>,
1991    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1992    pub location: Option<LocationEnum>,
1993    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1994    pub measurand: Option<MeasurandEnum>,
1995    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1996    pub phase: Option<PhaseEnum>,
1997    #[cfg_attr(feature = "serde", serde(rename = "signedMeterValue"))]
1998    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
1999    pub signed_meter_value: Option<
2000        SignedMeterValue<
2001            CustomDataType,
2002            SIGNED_METER_VALUE_PUBLIC_KEY_CAP,
2003            SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP,
2004        >,
2005    >,
2006    #[cfg_attr(feature = "serde", serde(rename = "unitOfMeasure"))]
2007    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2008    pub unit_of_measure: Option<UnitOfMeasure<CustomDataType>>,
2009    /// Sampled_ Value. Value. Measure
2010    /// urn:x-oca:ocpp:uid:1:569260
2011    /// Indicates the measured value.
2012    pub value: f64,
2013}
2014#[cfg(all(feature = "validate", not(feature = "alloc")))]
2015impl<
2016    CustomDataType,
2017    const SIGNED_METER_VALUE_PUBLIC_KEY_CAP: usize,
2018    const SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP: usize,
2019> crate::validate::Validate
2020for SampledValue<
2021    CustomDataType,
2022    SIGNED_METER_VALUE_PUBLIC_KEY_CAP,
2023    SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP,
2024> {
2025    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2026        if let Some(value) = &self.context {
2027            crate::validate::Validate::validate(value)
2028                .map_err(|error| error.in_field("context"))?;
2029        }
2030        if let Some(value) = &self.location {
2031            crate::validate::Validate::validate(value)
2032                .map_err(|error| error.in_field("location"))?;
2033        }
2034        if let Some(value) = &self.measurand {
2035            crate::validate::Validate::validate(value)
2036                .map_err(|error| error.in_field("measurand"))?;
2037        }
2038        if let Some(value) = &self.phase {
2039            crate::validate::Validate::validate(value)
2040                .map_err(|error| error.in_field("phase"))?;
2041        }
2042        if let Some(value) = &self.signed_meter_value {
2043            crate::validate::Validate::validate(value)
2044                .map_err(|error| error.in_field("signedMeterValue"))?;
2045        }
2046        if let Some(value) = &self.unit_of_measure {
2047            crate::validate::Validate::validate(value)
2048                .map_err(|error| error.in_field("unitOfMeasure"))?;
2049        }
2050        Ok(())
2051    }
2052}
2053#[cfg(feature = "alloc")]
2054/// Meter_ Value
2055/// urn:x-oca:ocpp:uid:2:233265
2056/// 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.
2057#[derive(Debug, Clone, PartialEq)]
2058#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2059pub struct MeterValue<CustomDataType = crate::NoCustomData> {
2060    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2061    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2062    pub custom_data: Option<CustomDataType>,
2063    #[cfg_attr(feature = "serde", serde(rename = "sampledValue"))]
2064    pub sampled_value: alloc::vec::Vec<SampledValue<CustomDataType>>,
2065    /// Meter_ Value. Timestamp. Date_ Time
2066    /// urn:x-oca:ocpp:uid:1:569259
2067    /// Timestamp for measured value(s).
2068    pub timestamp: crate::OcppTimestamp,
2069}
2070#[cfg(all(feature = "validate", feature = "alloc"))]
2071impl<CustomDataType> crate::validate::Validate for MeterValue<CustomDataType> {
2072    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2073        crate::validate::check_min_items(self.sampled_value.len(), 1usize)
2074            .map_err(|error| error.in_field("sampledValue"))?;
2075        for (index, item) in self.sampled_value.iter().enumerate() {
2076            crate::validate::Validate::validate(item)
2077                .map_err(|error| error.in_index(index).in_field("sampledValue"))?;
2078        }
2079        Ok(())
2080    }
2081}
2082#[cfg(not(feature = "alloc"))]
2083/// Meter_ Value
2084/// urn:x-oca:ocpp:uid:2:233265
2085/// 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.
2086#[derive(Debug, Clone, PartialEq)]
2087#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2088pub struct MeterValue<
2089    CustomDataType = crate::NoCustomData,
2090    const METER_VALUE_SAMPLED_VALUE_CAP: usize = 8usize,
2091    const SIGNED_METER_VALUE_PUBLIC_KEY_CAP: usize = 1024usize,
2092    const SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP: usize = 1024usize,
2093> {
2094    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2095    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2096    pub custom_data: Option<CustomDataType>,
2097    #[cfg_attr(feature = "serde", serde(rename = "sampledValue"))]
2098    pub sampled_value: heapless::Vec<
2099        SampledValue<
2100            CustomDataType,
2101            SIGNED_METER_VALUE_PUBLIC_KEY_CAP,
2102            SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP,
2103        >,
2104        METER_VALUE_SAMPLED_VALUE_CAP,
2105    >,
2106    /// Meter_ Value. Timestamp. Date_ Time
2107    /// urn:x-oca:ocpp:uid:1:569259
2108    /// Timestamp for measured value(s).
2109    pub timestamp: crate::OcppTimestamp,
2110}
2111#[cfg(all(feature = "validate", not(feature = "alloc")))]
2112impl<
2113    CustomDataType,
2114    const METER_VALUE_SAMPLED_VALUE_CAP: usize,
2115    const SIGNED_METER_VALUE_PUBLIC_KEY_CAP: usize,
2116    const SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP: usize,
2117> crate::validate::Validate
2118for MeterValue<
2119    CustomDataType,
2120    METER_VALUE_SAMPLED_VALUE_CAP,
2121    SIGNED_METER_VALUE_PUBLIC_KEY_CAP,
2122    SIGNED_METER_VALUE_SIGNED_METER_DATA_CAP,
2123> {
2124    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2125        crate::validate::check_min_items(self.sampled_value.len(), 1usize)
2126            .map_err(|error| error.in_field("sampledValue"))?;
2127        for (index, item) in self.sampled_value.iter().enumerate() {
2128            crate::validate::Validate::validate(item)
2129                .map_err(|error| error.in_index(index).in_field("sampledValue"))?;
2130        }
2131        Ok(())
2132    }
2133}
2134/// Charging_ Limit
2135/// urn:x-enexis:ecdm:uid:2:234489
2136#[derive(Debug, Clone, PartialEq, Eq)]
2137#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2138pub struct ChargingLimit<CustomDataType = crate::NoCustomData> {
2139    #[cfg_attr(feature = "serde", serde(rename = "chargingLimitSource"))]
2140    pub charging_limit_source: ChargingLimitSourceEnum,
2141    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2142    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2143    pub custom_data: Option<CustomDataType>,
2144    /// Charging_ Limit. Is_ Grid_ Critical. Indicator
2145    /// urn:x-enexis:ecdm:uid:1:570847
2146    /// Indicates whether the charging limit is critical for the grid.
2147    #[cfg_attr(feature = "serde", serde(rename = "isGridCritical"))]
2148    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2149    pub is_grid_critical: Option<bool>,
2150}
2151#[cfg(feature = "validate")]
2152impl<CustomDataType> crate::validate::Validate for ChargingLimit<CustomDataType> {
2153    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2154        crate::validate::Validate::validate(&self.charging_limit_source)
2155            .map_err(|error| error.in_field("chargingLimitSource"))?;
2156        Ok(())
2157    }
2158}
2159/// Cost. Cost_ Kind. Cost_ Kind_ Code
2160/// urn:x-oca:ocpp:uid:1:569243
2161/// The kind of cost referred to in the message element amount
2162#[derive(Debug, Clone, PartialEq, Eq)]
2163#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2164pub enum CostKindEnum {
2165    CarbonDioxideEmission,
2166    RelativePricePercentage,
2167    RenewableGenerationPercentage,
2168}
2169#[cfg(feature = "validate")]
2170impl crate::validate::Validate for CostKindEnum {
2171    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2172        Ok(())
2173    }
2174}
2175/// Cost
2176/// urn:x-oca:ocpp:uid:2:233258
2177#[derive(Debug, Clone, PartialEq, Eq)]
2178#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2179pub struct Cost<CustomDataType = crate::NoCustomData> {
2180    /// Cost. Amount. Amount
2181    /// urn:x-oca:ocpp:uid:1:569244
2182    /// The estimated or actual cost per kWh
2183    pub amount: i64,
2184    /// Cost. Amount_ Multiplier. Integer
2185    /// urn:x-oca:ocpp:uid:1:569245
2186    /// Values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value is determined by: amount * 10 ^ amountMultiplier
2187    #[cfg_attr(feature = "serde", serde(rename = "amountMultiplier"))]
2188    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2189    pub amount_multiplier: Option<i64>,
2190    #[cfg_attr(feature = "serde", serde(rename = "costKind"))]
2191    pub cost_kind: CostKindEnum,
2192    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2193    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2194    pub custom_data: Option<CustomDataType>,
2195}
2196#[cfg(feature = "validate")]
2197impl<CustomDataType> crate::validate::Validate for Cost<CustomDataType> {
2198    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2199        crate::validate::Validate::validate(&self.cost_kind)
2200            .map_err(|error| error.in_field("costKind"))?;
2201        Ok(())
2202    }
2203}
2204/// Consumption_ Cost
2205/// urn:x-oca:ocpp:uid:2:233259
2206#[derive(Debug, Clone, PartialEq)]
2207#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2208pub struct ConsumptionCost<CustomDataType = crate::NoCustomData> {
2209    pub cost: heapless::Vec<Cost<CustomDataType>, 3usize>,
2210    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2211    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2212    pub custom_data: Option<CustomDataType>,
2213    /// Consumption_ Cost. Start_ Value. Numeric
2214    /// urn:x-oca:ocpp:uid:1:569246
2215    /// 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.
2216    #[cfg_attr(feature = "serde", serde(rename = "startValue"))]
2217    pub start_value: f64,
2218}
2219#[cfg(feature = "validate")]
2220impl<CustomDataType> crate::validate::Validate for ConsumptionCost<CustomDataType> {
2221    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2222        crate::validate::check_min_items(self.cost.len(), 1usize)
2223            .map_err(|error| error.in_field("cost"))?;
2224        for (index, item) in self.cost.iter().enumerate() {
2225            crate::validate::Validate::validate(item)
2226                .map_err(|error| error.in_index(index).in_field("cost"))?;
2227        }
2228        Ok(())
2229    }
2230}
2231/// Relative_ Timer_ Interval
2232/// urn:x-oca:ocpp:uid:2:233270
2233#[derive(Debug, Clone, PartialEq, Eq)]
2234#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2235pub struct RelativeTimeInterval<CustomDataType = crate::NoCustomData> {
2236    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2237    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2238    pub custom_data: Option<CustomDataType>,
2239    /// Relative_ Timer_ Interval. Duration. Elapsed_ Time
2240    /// urn:x-oca:ocpp:uid:1:569280
2241    /// Duration of the interval, in seconds.
2242    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2243    pub duration: Option<i64>,
2244    /// Relative_ Timer_ Interval. Start. Elapsed_ Time
2245    /// urn:x-oca:ocpp:uid:1:569279
2246    /// Start of the interval, in seconds from NOW.
2247    pub start: i64,
2248}
2249#[cfg(feature = "validate")]
2250impl<CustomDataType> crate::validate::Validate for RelativeTimeInterval<CustomDataType> {
2251    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2252        Ok(())
2253    }
2254}
2255/// Sales_ Tariff_ Entry
2256/// urn:x-oca:ocpp:uid:2:233271
2257#[derive(Debug, Clone, PartialEq)]
2258#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2259pub struct SalesTariffEntry<CustomDataType = crate::NoCustomData> {
2260    #[cfg_attr(feature = "serde", serde(rename = "consumptionCost"))]
2261    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2262    pub consumption_cost: Option<heapless::Vec<ConsumptionCost<CustomDataType>, 3usize>>,
2263    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2264    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2265    pub custom_data: Option<CustomDataType>,
2266    /// Sales_ Tariff_ Entry. E_ Price_ Level. Unsigned_ Integer
2267    /// urn:x-oca:ocpp:uid:1:569281
2268    /// 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.
2269    #[cfg_attr(feature = "serde", serde(rename = "ePriceLevel"))]
2270    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2271    pub e_price_level: Option<i64>,
2272    #[cfg_attr(feature = "serde", serde(rename = "relativeTimeInterval"))]
2273    pub relative_time_interval: RelativeTimeInterval<CustomDataType>,
2274}
2275#[cfg(feature = "validate")]
2276impl<CustomDataType> crate::validate::Validate for SalesTariffEntry<CustomDataType> {
2277    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2278        if let Some(value) = &self.consumption_cost {
2279            crate::validate::check_min_items(value.len(), 1usize)
2280                .map_err(|error| error.in_field("consumptionCost"))?;
2281            for (index, item) in value.iter().enumerate() {
2282                crate::validate::Validate::validate(item)
2283                    .map_err(|error| error.in_index(index).in_field("consumptionCost"))?;
2284            }
2285        }
2286        if let Some(value) = self.e_price_level {
2287            crate::validate::check_min_i64(value, 0i64)
2288                .map_err(|error| error.in_field("ePriceLevel"))?;
2289        }
2290        crate::validate::Validate::validate(&self.relative_time_interval)
2291            .map_err(|error| error.in_field("relativeTimeInterval"))?;
2292        Ok(())
2293    }
2294}
2295#[cfg(feature = "alloc")]
2296/// Sales_ Tariff
2297/// urn:x-oca:ocpp:uid:2:233272
2298/// NOTE: This dataType is based on dataTypes from &lt;&lt;ref-ISOIEC15118-2,ISO 15118-2&gt;&gt;.
2299#[derive(Debug, Clone, PartialEq)]
2300#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2301pub struct SalesTariff<CustomDataType = crate::NoCustomData> {
2302    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2303    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2304    pub custom_data: Option<CustomDataType>,
2305    /// Identified_ Object. MRID. Numeric_ Identifier
2306    /// urn:x-enexis:ecdm:uid:1:569198
2307    /// SalesTariff identifier used to identify one sales tariff. An SAID remains a unique identifier for one schedule throughout a charging session.
2308    pub id: i64,
2309    /// Sales_ Tariff. Num_ E_ Price_ Levels. Counter
2310    /// urn:x-oca:ocpp:uid:1:569284
2311    /// Defines the overall number of distinct price levels used across all provided SalesTariff elements.
2312    #[cfg_attr(feature = "serde", serde(rename = "numEPriceLevels"))]
2313    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2314    pub num_e_price_levels: Option<i64>,
2315    /// Sales_ Tariff. Sales. Tariff_ Description
2316    /// urn:x-oca:ocpp:uid:1:569283
2317    /// A human readable title/short description of the sales tariff e.g. for HMI display purposes.
2318    #[cfg_attr(feature = "serde", serde(rename = "salesTariffDescription"))]
2319    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2320    pub sales_tariff_description: Option<heapless::String<32usize>>,
2321    #[cfg_attr(feature = "serde", serde(rename = "salesTariffEntry"))]
2322    pub sales_tariff_entry: alloc::vec::Vec<SalesTariffEntry<CustomDataType>>,
2323}
2324#[cfg(all(feature = "validate", feature = "alloc"))]
2325impl<CustomDataType> crate::validate::Validate for SalesTariff<CustomDataType> {
2326    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2327        crate::validate::check_min_items(self.sales_tariff_entry.len(), 1usize)
2328            .map_err(|error| error.in_field("salesTariffEntry"))?;
2329        crate::validate::check_max_items(self.sales_tariff_entry.len(), 1024usize)
2330            .map_err(|error| error.in_field("salesTariffEntry"))?;
2331        for (index, item) in self.sales_tariff_entry.iter().enumerate() {
2332            crate::validate::Validate::validate(item)
2333                .map_err(|error| error.in_index(index).in_field("salesTariffEntry"))?;
2334        }
2335        Ok(())
2336    }
2337}
2338#[cfg(not(feature = "alloc"))]
2339/// Sales_ Tariff
2340/// urn:x-oca:ocpp:uid:2:233272
2341/// NOTE: This dataType is based on dataTypes from &lt;&lt;ref-ISOIEC15118-2,ISO 15118-2&gt;&gt;.
2342#[derive(Debug, Clone, PartialEq)]
2343#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2344pub struct SalesTariff<
2345    CustomDataType = crate::NoCustomData,
2346    const SALES_TARIFF_SALES_TARIFF_ENTRY_CAP: usize = 8usize,
2347> {
2348    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2349    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2350    pub custom_data: Option<CustomDataType>,
2351    /// Identified_ Object. MRID. Numeric_ Identifier
2352    /// urn:x-enexis:ecdm:uid:1:569198
2353    /// SalesTariff identifier used to identify one sales tariff. An SAID remains a unique identifier for one schedule throughout a charging session.
2354    pub id: i64,
2355    /// Sales_ Tariff. Num_ E_ Price_ Levels. Counter
2356    /// urn:x-oca:ocpp:uid:1:569284
2357    /// Defines the overall number of distinct price levels used across all provided SalesTariff elements.
2358    #[cfg_attr(feature = "serde", serde(rename = "numEPriceLevels"))]
2359    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2360    pub num_e_price_levels: Option<i64>,
2361    /// Sales_ Tariff. Sales. Tariff_ Description
2362    /// urn:x-oca:ocpp:uid:1:569283
2363    /// A human readable title/short description of the sales tariff e.g. for HMI display purposes.
2364    #[cfg_attr(feature = "serde", serde(rename = "salesTariffDescription"))]
2365    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2366    pub sales_tariff_description: Option<heapless::String<32usize>>,
2367    #[cfg_attr(feature = "serde", serde(rename = "salesTariffEntry"))]
2368    pub sales_tariff_entry: heapless::Vec<
2369        SalesTariffEntry<CustomDataType>,
2370        SALES_TARIFF_SALES_TARIFF_ENTRY_CAP,
2371    >,
2372}
2373#[cfg(all(feature = "validate", not(feature = "alloc")))]
2374impl<
2375    CustomDataType,
2376    const SALES_TARIFF_SALES_TARIFF_ENTRY_CAP: usize,
2377> crate::validate::Validate
2378for SalesTariff<CustomDataType, SALES_TARIFF_SALES_TARIFF_ENTRY_CAP> {
2379    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2380        crate::validate::check_min_items(self.sales_tariff_entry.len(), 1usize)
2381            .map_err(|error| error.in_field("salesTariffEntry"))?;
2382        crate::validate::check_max_items(self.sales_tariff_entry.len(), 1024usize)
2383            .map_err(|error| error.in_field("salesTariffEntry"))?;
2384        for (index, item) in self.sales_tariff_entry.iter().enumerate() {
2385            crate::validate::Validate::validate(item)
2386                .map_err(|error| error.in_index(index).in_field("salesTariffEntry"))?;
2387        }
2388        Ok(())
2389    }
2390}
2391#[cfg(feature = "alloc")]
2392/// Charging_ Schedule
2393/// urn:x-oca:ocpp:uid:2:233256
2394/// Charging schedule structure defines a list of charging periods, as used in: GetCompositeSchedule.conf and ChargingProfile.
2395#[derive(Debug, Clone, PartialEq)]
2396#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2397pub struct ChargingSchedule<CustomDataType = crate::NoCustomData> {
2398    #[cfg_attr(feature = "serde", serde(rename = "chargingRateUnit"))]
2399    pub charging_rate_unit: ChargingRateUnitEnum,
2400    #[cfg_attr(feature = "serde", serde(rename = "chargingSchedulePeriod"))]
2401    pub charging_schedule_period: alloc::vec::Vec<
2402        ChargingSchedulePeriod<CustomDataType>,
2403    >,
2404    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2405    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2406    pub custom_data: Option<CustomDataType>,
2407    /// Charging_ Schedule. Duration. Elapsed_ Time
2408    /// urn:x-oca:ocpp:uid:1:569236
2409    /// 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.
2410    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2411    pub duration: Option<i64>,
2412    /// Identifies the ChargingSchedule.
2413    pub id: i64,
2414    /// Charging_ Schedule. Min_ Charging_ Rate. Numeric
2415    /// urn:x-oca:ocpp:uid:1:569239
2416    /// 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)
2417    #[cfg_attr(feature = "serde", serde(rename = "minChargingRate"))]
2418    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2419    pub min_charging_rate: Option<f64>,
2420    #[cfg_attr(feature = "serde", serde(rename = "salesTariff"))]
2421    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2422    pub sales_tariff: Option<SalesTariff<CustomDataType>>,
2423    /// Charging_ Schedule. Start_ Schedule. Date_ Time
2424    /// urn:x-oca:ocpp:uid:1:569237
2425    /// Starting point of an absolute schedule. If absent the schedule will be relative to start of charging.
2426    #[cfg_attr(feature = "serde", serde(rename = "startSchedule"))]
2427    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2428    pub start_schedule: Option<crate::OcppTimestamp>,
2429}
2430#[cfg(all(feature = "validate", feature = "alloc"))]
2431impl<CustomDataType> crate::validate::Validate for ChargingSchedule<CustomDataType> {
2432    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2433        crate::validate::Validate::validate(&self.charging_rate_unit)
2434            .map_err(|error| error.in_field("chargingRateUnit"))?;
2435        crate::validate::check_min_items(self.charging_schedule_period.len(), 1usize)
2436            .map_err(|error| error.in_field("chargingSchedulePeriod"))?;
2437        crate::validate::check_max_items(self.charging_schedule_period.len(), 1024usize)
2438            .map_err(|error| error.in_field("chargingSchedulePeriod"))?;
2439        for (index, item) in self.charging_schedule_period.iter().enumerate() {
2440            crate::validate::Validate::validate(item)
2441                .map_err(|error| {
2442                    error.in_index(index).in_field("chargingSchedulePeriod")
2443                })?;
2444        }
2445        if let Some(value) = &self.sales_tariff {
2446            crate::validate::Validate::validate(value)
2447                .map_err(|error| error.in_field("salesTariff"))?;
2448        }
2449        Ok(())
2450    }
2451}
2452#[cfg(not(feature = "alloc"))]
2453/// Charging_ Schedule
2454/// urn:x-oca:ocpp:uid:2:233256
2455/// Charging schedule structure defines a list of charging periods, as used in: GetCompositeSchedule.conf and ChargingProfile.
2456#[derive(Debug, Clone, PartialEq)]
2457#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2458pub struct ChargingSchedule<
2459    CustomDataType = crate::NoCustomData,
2460    const CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP: usize = 8usize,
2461    const SALES_TARIFF_SALES_TARIFF_ENTRY_CAP: usize = 8usize,
2462> {
2463    #[cfg_attr(feature = "serde", serde(rename = "chargingRateUnit"))]
2464    pub charging_rate_unit: ChargingRateUnitEnum,
2465    #[cfg_attr(feature = "serde", serde(rename = "chargingSchedulePeriod"))]
2466    pub charging_schedule_period: heapless::Vec<
2467        ChargingSchedulePeriod<CustomDataType>,
2468        CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP,
2469    >,
2470    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2471    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2472    pub custom_data: Option<CustomDataType>,
2473    /// Charging_ Schedule. Duration. Elapsed_ Time
2474    /// urn:x-oca:ocpp:uid:1:569236
2475    /// 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.
2476    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2477    pub duration: Option<i64>,
2478    /// Identifies the ChargingSchedule.
2479    pub id: i64,
2480    /// Charging_ Schedule. Min_ Charging_ Rate. Numeric
2481    /// urn:x-oca:ocpp:uid:1:569239
2482    /// 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)
2483    #[cfg_attr(feature = "serde", serde(rename = "minChargingRate"))]
2484    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2485    pub min_charging_rate: Option<f64>,
2486    #[cfg_attr(feature = "serde", serde(rename = "salesTariff"))]
2487    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2488    pub sales_tariff: Option<
2489        SalesTariff<CustomDataType, SALES_TARIFF_SALES_TARIFF_ENTRY_CAP>,
2490    >,
2491    /// Charging_ Schedule. Start_ Schedule. Date_ Time
2492    /// urn:x-oca:ocpp:uid:1:569237
2493    /// Starting point of an absolute schedule. If absent the schedule will be relative to start of charging.
2494    #[cfg_attr(feature = "serde", serde(rename = "startSchedule"))]
2495    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2496    pub start_schedule: Option<crate::OcppTimestamp>,
2497}
2498#[cfg(all(feature = "validate", not(feature = "alloc")))]
2499impl<
2500    CustomDataType,
2501    const CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP: usize,
2502    const SALES_TARIFF_SALES_TARIFF_ENTRY_CAP: usize,
2503> crate::validate::Validate
2504for ChargingSchedule<
2505    CustomDataType,
2506    CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP,
2507    SALES_TARIFF_SALES_TARIFF_ENTRY_CAP,
2508> {
2509    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2510        crate::validate::Validate::validate(&self.charging_rate_unit)
2511            .map_err(|error| error.in_field("chargingRateUnit"))?;
2512        crate::validate::check_min_items(self.charging_schedule_period.len(), 1usize)
2513            .map_err(|error| error.in_field("chargingSchedulePeriod"))?;
2514        crate::validate::check_max_items(self.charging_schedule_period.len(), 1024usize)
2515            .map_err(|error| error.in_field("chargingSchedulePeriod"))?;
2516        for (index, item) in self.charging_schedule_period.iter().enumerate() {
2517            crate::validate::Validate::validate(item)
2518                .map_err(|error| {
2519                    error.in_index(index).in_field("chargingSchedulePeriod")
2520                })?;
2521        }
2522        if let Some(value) = &self.sales_tariff {
2523            crate::validate::Validate::validate(value)
2524                .map_err(|error| error.in_field("salesTariff"))?;
2525        }
2526        Ok(())
2527    }
2528}
2529/// Message_ Info
2530/// urn:x-enexis:ecdm:uid:2:233264
2531/// Contains message details, for a message to be displayed on a Charging Station.
2532#[derive(Debug, Clone, PartialEq, Eq)]
2533#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2534pub struct MessageInfo<CustomDataType = crate::NoCustomData> {
2535    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2536    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2537    pub custom_data: Option<CustomDataType>,
2538    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2539    pub display: Option<Component<CustomDataType>>,
2540    /// Message_ Info. End. Date_ Time
2541    /// urn:x-enexis:ecdm:uid:1:569257
2542    /// Until what date-time should this message be shown, after this date/time this message SHALL be removed.
2543    #[cfg_attr(feature = "serde", serde(rename = "endDateTime"))]
2544    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2545    pub end_date_time: Option<crate::OcppTimestamp>,
2546    /// Identified_ Object. MRID. Numeric_ Identifier
2547    /// urn:x-enexis:ecdm:uid:1:569198
2548    /// 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).
2549    pub id: i64,
2550    pub message: MessageContent<CustomDataType>,
2551    pub priority: MessagePriorityEnum,
2552    /// Message_ Info. Start. Date_ Time
2553    /// urn:x-enexis:ecdm:uid:1:569256
2554    /// From what date-time should this message be shown. If omitted: directly.
2555    #[cfg_attr(feature = "serde", serde(rename = "startDateTime"))]
2556    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2557    pub start_date_time: Option<crate::OcppTimestamp>,
2558    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2559    pub state: Option<MessageStateEnum>,
2560    /// During which transaction shall this message be shown.
2561    /// Message SHALL be removed by the Charging Station after transaction has
2562    /// ended.
2563    #[cfg_attr(feature = "serde", serde(rename = "transactionId"))]
2564    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2565    pub transaction_id: Option<heapless::String<36usize>>,
2566}
2567#[cfg(feature = "validate")]
2568impl<CustomDataType> crate::validate::Validate for MessageInfo<CustomDataType> {
2569    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2570        if let Some(value) = &self.display {
2571            crate::validate::Validate::validate(value)
2572                .map_err(|error| error.in_field("display"))?;
2573        }
2574        crate::validate::Validate::validate(&self.message)
2575            .map_err(|error| error.in_field("message"))?;
2576        crate::validate::Validate::validate(&self.priority)
2577            .map_err(|error| error.in_field("priority"))?;
2578        if let Some(value) = &self.state {
2579            crate::validate::Validate::validate(value)
2580                .map_err(|error| error.in_field("state"))?;
2581        }
2582        Ok(())
2583    }
2584}
2585/// AC_ Charging_ Parameters
2586/// urn:x-oca:ocpp:uid:2:233250
2587/// EV AC charging parameters.
2588#[derive(Debug, Clone, PartialEq, Eq)]
2589#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2590pub struct ACChargingParameters<CustomDataType = crate::NoCustomData> {
2591    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2592    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2593    pub custom_data: Option<CustomDataType>,
2594    /// AC_ Charging_ Parameters. Energy_ Amount. Energy_ Amount
2595    /// urn:x-oca:ocpp:uid:1:569211
2596    /// Amount of energy requested (in Wh). This includes energy required for preconditioning.
2597    #[cfg_attr(feature = "serde", serde(rename = "energyAmount"))]
2598    pub energy_amount: i64,
2599    /// AC_ Charging_ Parameters. EV_ Max. Current
2600    /// urn:x-oca:ocpp:uid:1:569213
2601    /// Maximum current (amps) supported by the electric vehicle (per phase). Includes cable capacity.
2602    #[cfg_attr(feature = "serde", serde(rename = "evMaxCurrent"))]
2603    pub ev_max_current: i64,
2604    /// AC_ Charging_ Parameters. EV_ Max. Voltage
2605    /// urn:x-oca:ocpp:uid:1:569214
2606    /// Maximum voltage supported by the electric vehicle
2607    #[cfg_attr(feature = "serde", serde(rename = "evMaxVoltage"))]
2608    pub ev_max_voltage: i64,
2609    /// AC_ Charging_ Parameters. EV_ Min. Current
2610    /// urn:x-oca:ocpp:uid:1:569212
2611    /// Minimum current (amps) supported by the electric vehicle (per phase).
2612    #[cfg_attr(feature = "serde", serde(rename = "evMinCurrent"))]
2613    pub ev_min_current: i64,
2614}
2615#[cfg(feature = "validate")]
2616impl<CustomDataType> crate::validate::Validate for ACChargingParameters<CustomDataType> {
2617    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2618        Ok(())
2619    }
2620}
2621/// DC_ Charging_ Parameters
2622/// urn:x-oca:ocpp:uid:2:233251
2623/// EV DC charging parameters
2624#[derive(Debug, Clone, PartialEq, Eq)]
2625#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2626pub struct DCChargingParameters<CustomDataType = crate::NoCustomData> {
2627    /// DC_ Charging_ Parameters. Bulk_ SOC. Percentage
2628    /// urn:x-oca:ocpp:uid:1:569222
2629    /// Percentage of SoC at which the EV considers a fast charging process to end. (possible values: 0 - 100)
2630    #[cfg_attr(feature = "serde", serde(rename = "bulkSoC"))]
2631    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2632    pub bulk_so_c: Option<i64>,
2633    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2634    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2635    pub custom_data: Option<CustomDataType>,
2636    /// DC_ Charging_ Parameters. Energy_ Amount. Energy_ Amount
2637    /// urn:x-oca:ocpp:uid:1:569217
2638    /// Amount of energy requested (in Wh). This inludes energy required for preconditioning.
2639    #[cfg_attr(feature = "serde", serde(rename = "energyAmount"))]
2640    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2641    pub energy_amount: Option<i64>,
2642    /// DC_ Charging_ Parameters. EV_ Energy_ Capacity. Numeric
2643    /// urn:x-oca:ocpp:uid:1:569220
2644    /// Capacity of the electric vehicle battery (in Wh)
2645    #[cfg_attr(feature = "serde", serde(rename = "evEnergyCapacity"))]
2646    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2647    pub ev_energy_capacity: Option<i64>,
2648    /// DC_ Charging_ Parameters. EV_ Max. Current
2649    /// urn:x-oca:ocpp:uid:1:569215
2650    /// Maximum current (amps) supported by the electric vehicle. Includes cable capacity.
2651    #[cfg_attr(feature = "serde", serde(rename = "evMaxCurrent"))]
2652    pub ev_max_current: i64,
2653    /// DC_ Charging_ Parameters. EV_ Max. Power
2654    /// urn:x-oca:ocpp:uid:1:569218
2655    /// Maximum power (in W) supported by the electric vehicle. Required for DC charging.
2656    #[cfg_attr(feature = "serde", serde(rename = "evMaxPower"))]
2657    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2658    pub ev_max_power: Option<i64>,
2659    /// DC_ Charging_ Parameters. EV_ Max. Voltage
2660    /// urn:x-oca:ocpp:uid:1:569216
2661    /// Maximum voltage supported by the electric vehicle
2662    #[cfg_attr(feature = "serde", serde(rename = "evMaxVoltage"))]
2663    pub ev_max_voltage: i64,
2664    /// DC_ Charging_ Parameters. Full_ SOC. Percentage
2665    /// urn:x-oca:ocpp:uid:1:569221
2666    /// Percentage of SoC at which the EV considers the battery fully charged. (possible values: 0 - 100)
2667    #[cfg_attr(feature = "serde", serde(rename = "fullSoC"))]
2668    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2669    pub full_so_c: Option<i64>,
2670    /// DC_ Charging_ Parameters. State_ Of_ Charge. Numeric
2671    /// urn:x-oca:ocpp:uid:1:569219
2672    /// Energy available in the battery (in percent of the battery capacity)
2673    #[cfg_attr(feature = "serde", serde(rename = "stateOfCharge"))]
2674    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2675    pub state_of_charge: Option<i64>,
2676}
2677#[cfg(feature = "validate")]
2678impl<CustomDataType> crate::validate::Validate for DCChargingParameters<CustomDataType> {
2679    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2680        if let Some(value) = self.bulk_so_c {
2681            crate::validate::check_min_i64(value, 0i64)
2682                .map_err(|error| error.in_field("bulkSoC"))?;
2683            crate::validate::check_max_i64(value, 100i64)
2684                .map_err(|error| error.in_field("bulkSoC"))?;
2685        }
2686        if let Some(value) = self.full_so_c {
2687            crate::validate::check_min_i64(value, 0i64)
2688                .map_err(|error| error.in_field("fullSoC"))?;
2689            crate::validate::check_max_i64(value, 100i64)
2690                .map_err(|error| error.in_field("fullSoC"))?;
2691        }
2692        if let Some(value) = self.state_of_charge {
2693            crate::validate::check_min_i64(value, 0i64)
2694                .map_err(|error| error.in_field("stateOfCharge"))?;
2695            crate::validate::check_max_i64(value, 100i64)
2696                .map_err(|error| error.in_field("stateOfCharge"))?;
2697        }
2698        Ok(())
2699    }
2700}
2701/// Charging_ Needs. Requested. Energy_ Transfer_ Mode_ Code
2702/// urn:x-oca:ocpp:uid:1:569209
2703/// Mode of energy transfer requested by the EV.
2704#[derive(Debug, Clone, PartialEq, Eq)]
2705#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2706pub enum EnergyTransferModeEnum {
2707    DC,
2708    #[cfg_attr(feature = "serde", serde(rename = "AC_single_phase"))]
2709    ACsinglephase,
2710    #[cfg_attr(feature = "serde", serde(rename = "AC_two_phase"))]
2711    ACtwophase,
2712    #[cfg_attr(feature = "serde", serde(rename = "AC_three_phase"))]
2713    ACthreephase,
2714}
2715#[cfg(feature = "validate")]
2716impl crate::validate::Validate for EnergyTransferModeEnum {
2717    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2718        Ok(())
2719    }
2720}
2721/// Charging_ Needs
2722/// urn:x-oca:ocpp:uid:2:233249
2723#[derive(Debug, Clone, PartialEq, Eq)]
2724#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2725pub struct ChargingNeeds<CustomDataType = crate::NoCustomData> {
2726    #[cfg_attr(feature = "serde", serde(rename = "acChargingParameters"))]
2727    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2728    pub ac_charging_parameters: Option<ACChargingParameters<CustomDataType>>,
2729    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2730    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2731    pub custom_data: Option<CustomDataType>,
2732    #[cfg_attr(feature = "serde", serde(rename = "dcChargingParameters"))]
2733    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2734    pub dc_charging_parameters: Option<DCChargingParameters<CustomDataType>>,
2735    /// Charging_ Needs. Departure_ Time. Date_ Time
2736    /// urn:x-oca:ocpp:uid:1:569223
2737    /// Estimated departure time of the EV.
2738    #[cfg_attr(feature = "serde", serde(rename = "departureTime"))]
2739    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2740    pub departure_time: Option<crate::OcppTimestamp>,
2741    #[cfg_attr(feature = "serde", serde(rename = "requestedEnergyTransfer"))]
2742    pub requested_energy_transfer: EnergyTransferModeEnum,
2743}
2744#[cfg(feature = "validate")]
2745impl<CustomDataType> crate::validate::Validate for ChargingNeeds<CustomDataType> {
2746    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2747        if let Some(value) = &self.ac_charging_parameters {
2748            crate::validate::Validate::validate(value)
2749                .map_err(|error| error.in_field("acChargingParameters"))?;
2750        }
2751        if let Some(value) = &self.dc_charging_parameters {
2752            crate::validate::Validate::validate(value)
2753                .map_err(|error| error.in_field("dcChargingParameters"))?;
2754        }
2755        crate::validate::Validate::validate(&self.requested_energy_transfer)
2756            .map_err(|error| error.in_field("requestedEnergyTransfer"))?;
2757        Ok(())
2758    }
2759}
2760/// Returns whether the CSMS has been able to process the message successfully. It does not imply that the evChargingNeeds can be met with the current charging profile.
2761#[derive(Debug, Clone, PartialEq, Eq)]
2762#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2763pub enum NotifyEVChargingNeedsStatusEnum {
2764    Accepted,
2765    Rejected,
2766    Processing,
2767}
2768#[cfg(feature = "validate")]
2769impl crate::validate::Validate for NotifyEVChargingNeedsStatusEnum {
2770    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2771        Ok(())
2772    }
2773}
2774/// Specifies the event notification type of the message.
2775#[derive(Debug, Clone, PartialEq, Eq)]
2776#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2777pub enum EventNotificationEnum {
2778    HardWiredNotification,
2779    HardWiredMonitor,
2780    PreconfiguredMonitor,
2781    CustomMonitor,
2782}
2783#[cfg(feature = "validate")]
2784impl crate::validate::Validate for EventNotificationEnum {
2785    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2786        Ok(())
2787    }
2788}
2789/// Type of monitor that triggered this event, e.g. exceeding a threshold value.
2790#[derive(Debug, Clone, PartialEq, Eq)]
2791#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2792pub enum EventTriggerEnum {
2793    Alerting,
2794    Delta,
2795    Periodic,
2796}
2797#[cfg(feature = "validate")]
2798impl crate::validate::Validate for EventTriggerEnum {
2799    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2800        Ok(())
2801    }
2802}
2803#[cfg(feature = "alloc")]
2804/// Class to report an event notification for a component-variable.
2805#[derive(Debug, Clone, PartialEq, Eq)]
2806#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2807pub struct EventData<CustomDataType = crate::NoCustomData> {
2808    /// Actual value (_attributeType_ Actual) of the variable.
2809    ///
2810    /// The Configuration Variable &lt;&lt;configkey-reporting-value-size,ReportingValueSize&gt;&gt; can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
2811    #[cfg_attr(feature = "serde", serde(rename = "actualValue"))]
2812    pub actual_value: alloc::string::String,
2813    /// Refers to the Id of an event that is considered to be the cause for this event.
2814    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2815    pub cause: Option<i64>,
2816    /// _Cleared_ is set to true to report the clearing of a monitored situation, i.e. a 'return to normal'.
2817    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2818    pub cleared: Option<bool>,
2819    pub component: Component<CustomDataType>,
2820    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2821    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2822    pub custom_data: Option<CustomDataType>,
2823    /// Identifies the event. This field can be referred to as a cause by other events.
2824    #[cfg_attr(feature = "serde", serde(rename = "eventId"))]
2825    pub event_id: i64,
2826    #[cfg_attr(feature = "serde", serde(rename = "eventNotificationType"))]
2827    pub event_notification_type: EventNotificationEnum,
2828    /// Technical (error) code as reported by component.
2829    #[cfg_attr(feature = "serde", serde(rename = "techCode"))]
2830    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2831    pub tech_code: Option<heapless::String<50usize>>,
2832    /// Technical detail information as reported by component.
2833    #[cfg_attr(feature = "serde", serde(rename = "techInfo"))]
2834    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2835    pub tech_info: Option<heapless::String<500usize>>,
2836    /// Timestamp of the moment the report was generated.
2837    pub timestamp: crate::OcppTimestamp,
2838    /// If an event notification is linked to a specific transaction, this field can be used to specify its transactionId.
2839    #[cfg_attr(feature = "serde", serde(rename = "transactionId"))]
2840    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2841    pub transaction_id: Option<heapless::String<36usize>>,
2842    pub trigger: EventTriggerEnum,
2843    pub variable: Variable<CustomDataType>,
2844    /// Identifies the VariableMonitoring which triggered the event.
2845    #[cfg_attr(feature = "serde", serde(rename = "variableMonitoringId"))]
2846    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2847    pub variable_monitoring_id: Option<i64>,
2848}
2849#[cfg(all(feature = "validate", feature = "alloc"))]
2850impl<CustomDataType> crate::validate::Validate for EventData<CustomDataType> {
2851    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2852        crate::validate::check_max_length(&self.actual_value, 2500usize)
2853            .map_err(|error| error.in_field("actualValue"))?;
2854        crate::validate::Validate::validate(&self.component)
2855            .map_err(|error| error.in_field("component"))?;
2856        crate::validate::Validate::validate(&self.event_notification_type)
2857            .map_err(|error| error.in_field("eventNotificationType"))?;
2858        crate::validate::Validate::validate(&self.trigger)
2859            .map_err(|error| error.in_field("trigger"))?;
2860        crate::validate::Validate::validate(&self.variable)
2861            .map_err(|error| error.in_field("variable"))?;
2862        Ok(())
2863    }
2864}
2865#[cfg(not(feature = "alloc"))]
2866/// Class to report an event notification for a component-variable.
2867#[derive(Debug, Clone, PartialEq, Eq)]
2868#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2869pub struct EventData<
2870    CustomDataType = crate::NoCustomData,
2871    const EVENT_DATA_ACTUAL_VALUE_CAP: usize = 1024usize,
2872> {
2873    /// Actual value (_attributeType_ Actual) of the variable.
2874    ///
2875    /// The Configuration Variable &lt;&lt;configkey-reporting-value-size,ReportingValueSize&gt;&gt; can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
2876    #[cfg_attr(feature = "serde", serde(rename = "actualValue"))]
2877    pub actual_value: heapless::String<EVENT_DATA_ACTUAL_VALUE_CAP>,
2878    /// Refers to the Id of an event that is considered to be the cause for this event.
2879    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2880    pub cause: Option<i64>,
2881    /// _Cleared_ is set to true to report the clearing of a monitored situation, i.e. a 'return to normal'.
2882    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2883    pub cleared: Option<bool>,
2884    pub component: Component<CustomDataType>,
2885    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2886    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2887    pub custom_data: Option<CustomDataType>,
2888    /// Identifies the event. This field can be referred to as a cause by other events.
2889    #[cfg_attr(feature = "serde", serde(rename = "eventId"))]
2890    pub event_id: i64,
2891    #[cfg_attr(feature = "serde", serde(rename = "eventNotificationType"))]
2892    pub event_notification_type: EventNotificationEnum,
2893    /// Technical (error) code as reported by component.
2894    #[cfg_attr(feature = "serde", serde(rename = "techCode"))]
2895    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2896    pub tech_code: Option<heapless::String<50usize>>,
2897    /// Technical detail information as reported by component.
2898    #[cfg_attr(feature = "serde", serde(rename = "techInfo"))]
2899    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2900    pub tech_info: Option<heapless::String<500usize>>,
2901    /// Timestamp of the moment the report was generated.
2902    pub timestamp: crate::OcppTimestamp,
2903    /// If an event notification is linked to a specific transaction, this field can be used to specify its transactionId.
2904    #[cfg_attr(feature = "serde", serde(rename = "transactionId"))]
2905    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2906    pub transaction_id: Option<heapless::String<36usize>>,
2907    pub trigger: EventTriggerEnum,
2908    pub variable: Variable<CustomDataType>,
2909    /// Identifies the VariableMonitoring which triggered the event.
2910    #[cfg_attr(feature = "serde", serde(rename = "variableMonitoringId"))]
2911    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2912    pub variable_monitoring_id: Option<i64>,
2913}
2914#[cfg(all(feature = "validate", not(feature = "alloc")))]
2915impl<CustomDataType, const EVENT_DATA_ACTUAL_VALUE_CAP: usize> crate::validate::Validate
2916for EventData<CustomDataType, EVENT_DATA_ACTUAL_VALUE_CAP> {
2917    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2918        crate::validate::check_max_length(&self.actual_value, 2500usize)
2919            .map_err(|error| error.in_field("actualValue"))?;
2920        crate::validate::Validate::validate(&self.component)
2921            .map_err(|error| error.in_field("component"))?;
2922        crate::validate::Validate::validate(&self.event_notification_type)
2923            .map_err(|error| error.in_field("eventNotificationType"))?;
2924        crate::validate::Validate::validate(&self.trigger)
2925            .map_err(|error| error.in_field("trigger"))?;
2926        crate::validate::Validate::validate(&self.variable)
2927            .map_err(|error| error.in_field("variable"))?;
2928        Ok(())
2929    }
2930}
2931/// The type of this monitor, e.g. a threshold, delta or periodic monitor.
2932#[derive(Debug, Clone, PartialEq, Eq)]
2933#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2934pub enum MonitorEnum {
2935    UpperThreshold,
2936    LowerThreshold,
2937    Delta,
2938    Periodic,
2939    PeriodicClockAligned,
2940}
2941#[cfg(feature = "validate")]
2942impl crate::validate::Validate for MonitorEnum {
2943    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2944        Ok(())
2945    }
2946}
2947/// A monitoring setting for a variable.
2948#[derive(Debug, Clone, PartialEq)]
2949#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2950pub struct VariableMonitoring<CustomDataType = crate::NoCustomData> {
2951    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
2952    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2953    pub custom_data: Option<CustomDataType>,
2954    /// Identifies the monitor.
2955    pub id: i64,
2956    /// 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.
2957    ///
2958    /// The severity levels have the following meaning: +
2959    /// *0-Danger* +
2960    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
2961    /// *1-Hardware Failure* +
2962    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
2963    /// *2-System Failure* +
2964    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
2965    /// *3-Critical* +
2966    /// Indicates a critical error. Action is required. +
2967    /// *4-Error* +
2968    /// Indicates a non-urgent error. Action is required. +
2969    /// *5-Alert* +
2970    /// Indicates an alert event. Default severity for any type of monitoring event.  +
2971    /// *6-Warning* +
2972    /// Indicates a warning event. Action may be required. +
2973    /// *7-Notice* +
2974    /// Indicates an unusual event. No immediate action is required. +
2975    /// *8-Informational* +
2976    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
2977    /// *9-Debug* +
2978    /// Indicates information useful to developers for debugging, not useful during operations.
2979    pub severity: i64,
2980    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction.
2981    pub transaction: bool,
2982    pub r#type: MonitorEnum,
2983    /// Value for threshold or delta monitoring.
2984    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
2985    pub value: f64,
2986}
2987#[cfg(feature = "validate")]
2988impl<CustomDataType> crate::validate::Validate for VariableMonitoring<CustomDataType> {
2989    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
2990        crate::validate::Validate::validate(&self.r#type)
2991            .map_err(|error| error.in_field("type"))?;
2992        Ok(())
2993    }
2994}
2995#[cfg(feature = "alloc")]
2996/// Class to hold parameters of SetVariableMonitoring request.
2997#[derive(Debug, Clone, PartialEq)]
2998#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2999pub struct MonitoringData<CustomDataType = crate::NoCustomData> {
3000    pub component: Component<CustomDataType>,
3001    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3002    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3003    pub custom_data: Option<CustomDataType>,
3004    pub variable: Variable<CustomDataType>,
3005    #[cfg_attr(feature = "serde", serde(rename = "variableMonitoring"))]
3006    pub variable_monitoring: alloc::vec::Vec<VariableMonitoring<CustomDataType>>,
3007}
3008#[cfg(all(feature = "validate", feature = "alloc"))]
3009impl<CustomDataType> crate::validate::Validate for MonitoringData<CustomDataType> {
3010    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3011        crate::validate::Validate::validate(&self.component)
3012            .map_err(|error| error.in_field("component"))?;
3013        crate::validate::Validate::validate(&self.variable)
3014            .map_err(|error| error.in_field("variable"))?;
3015        crate::validate::check_min_items(self.variable_monitoring.len(), 1usize)
3016            .map_err(|error| error.in_field("variableMonitoring"))?;
3017        for (index, item) in self.variable_monitoring.iter().enumerate() {
3018            crate::validate::Validate::validate(item)
3019                .map_err(|error| error.in_index(index).in_field("variableMonitoring"))?;
3020        }
3021        Ok(())
3022    }
3023}
3024#[cfg(not(feature = "alloc"))]
3025/// Class to hold parameters of SetVariableMonitoring request.
3026#[derive(Debug, Clone, PartialEq)]
3027#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3028pub struct MonitoringData<
3029    CustomDataType = crate::NoCustomData,
3030    const MONITORING_DATA_VARIABLE_MONITORING_CAP: usize = 8usize,
3031> {
3032    pub component: Component<CustomDataType>,
3033    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3034    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3035    pub custom_data: Option<CustomDataType>,
3036    pub variable: Variable<CustomDataType>,
3037    #[cfg_attr(feature = "serde", serde(rename = "variableMonitoring"))]
3038    pub variable_monitoring: heapless::Vec<
3039        VariableMonitoring<CustomDataType>,
3040        MONITORING_DATA_VARIABLE_MONITORING_CAP,
3041    >,
3042}
3043#[cfg(all(feature = "validate", not(feature = "alloc")))]
3044impl<
3045    CustomDataType,
3046    const MONITORING_DATA_VARIABLE_MONITORING_CAP: usize,
3047> crate::validate::Validate
3048for MonitoringData<CustomDataType, MONITORING_DATA_VARIABLE_MONITORING_CAP> {
3049    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3050        crate::validate::Validate::validate(&self.component)
3051            .map_err(|error| error.in_field("component"))?;
3052        crate::validate::Validate::validate(&self.variable)
3053            .map_err(|error| error.in_field("variable"))?;
3054        crate::validate::check_min_items(self.variable_monitoring.len(), 1usize)
3055            .map_err(|error| error.in_field("variableMonitoring"))?;
3056        for (index, item) in self.variable_monitoring.iter().enumerate() {
3057            crate::validate::Validate::validate(item)
3058                .map_err(|error| error.in_index(index).in_field("variableMonitoring"))?;
3059        }
3060        Ok(())
3061    }
3062}
3063/// Defines the mutability of this attribute. Default is ReadWrite when omitted.
3064#[derive(Debug, Clone, PartialEq, Eq)]
3065#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3066pub enum MutabilityEnum {
3067    ReadOnly,
3068    WriteOnly,
3069    ReadWrite,
3070}
3071#[cfg(feature = "validate")]
3072impl crate::validate::Validate for MutabilityEnum {
3073    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3074        Ok(())
3075    }
3076}
3077#[cfg(feature = "alloc")]
3078/// Attribute data of a variable.
3079#[derive(Debug, Clone, PartialEq, Eq)]
3080#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3081pub struct VariableAttribute<CustomDataType = crate::NoCustomData> {
3082    /// If true, value that will never be changed by the Charging Station at runtime. Default when omitted is false.
3083    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3084    pub constant: Option<bool>,
3085    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3086    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3087    pub custom_data: Option<CustomDataType>,
3088    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3089    pub mutability: Option<MutabilityEnum>,
3090    /// If true, value will be persistent across system reboots or power down. Default when omitted is false.
3091    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3092    pub persistent: Option<bool>,
3093    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3094    pub r#type: Option<AttributeEnum>,
3095    /// Value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
3096    ///
3097    /// The Configuration Variable &lt;&lt;configkey-reporting-value-size,ReportingValueSize&gt;&gt; can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
3098    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3099    pub value: Option<alloc::string::String>,
3100}
3101#[cfg(all(feature = "validate", feature = "alloc"))]
3102impl<CustomDataType> crate::validate::Validate for VariableAttribute<CustomDataType> {
3103    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3104        if let Some(value) = &self.mutability {
3105            crate::validate::Validate::validate(value)
3106                .map_err(|error| error.in_field("mutability"))?;
3107        }
3108        if let Some(value) = &self.r#type {
3109            crate::validate::Validate::validate(value)
3110                .map_err(|error| error.in_field("type"))?;
3111        }
3112        if let Some(value) = &self.value {
3113            crate::validate::check_max_length(value, 2500usize)
3114                .map_err(|error| error.in_field("value"))?;
3115        }
3116        Ok(())
3117    }
3118}
3119#[cfg(not(feature = "alloc"))]
3120/// Attribute data of a variable.
3121#[derive(Debug, Clone, PartialEq, Eq)]
3122#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3123pub struct VariableAttribute<
3124    CustomDataType = crate::NoCustomData,
3125    const VARIABLE_ATTRIBUTE_VALUE_CAP: usize = 1024usize,
3126> {
3127    /// If true, value that will never be changed by the Charging Station at runtime. Default when omitted is false.
3128    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3129    pub constant: Option<bool>,
3130    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3131    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3132    pub custom_data: Option<CustomDataType>,
3133    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3134    pub mutability: Option<MutabilityEnum>,
3135    /// If true, value will be persistent across system reboots or power down. Default when omitted is false.
3136    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3137    pub persistent: Option<bool>,
3138    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3139    pub r#type: Option<AttributeEnum>,
3140    /// Value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
3141    ///
3142    /// The Configuration Variable &lt;&lt;configkey-reporting-value-size,ReportingValueSize&gt;&gt; can be used to limit GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max size of these values will always remain equal.
3143    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3144    pub value: Option<heapless::String<VARIABLE_ATTRIBUTE_VALUE_CAP>>,
3145}
3146#[cfg(all(feature = "validate", not(feature = "alloc")))]
3147impl<CustomDataType, const VARIABLE_ATTRIBUTE_VALUE_CAP: usize> crate::validate::Validate
3148for VariableAttribute<CustomDataType, VARIABLE_ATTRIBUTE_VALUE_CAP> {
3149    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3150        if let Some(value) = &self.mutability {
3151            crate::validate::Validate::validate(value)
3152                .map_err(|error| error.in_field("mutability"))?;
3153        }
3154        if let Some(value) = &self.r#type {
3155            crate::validate::Validate::validate(value)
3156                .map_err(|error| error.in_field("type"))?;
3157        }
3158        if let Some(value) = &self.value {
3159            crate::validate::check_max_length(value, 2500usize)
3160                .map_err(|error| error.in_field("value"))?;
3161        }
3162        Ok(())
3163    }
3164}
3165/// Data type of this variable.
3166#[derive(Debug, Clone, PartialEq, Eq)]
3167#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3168pub enum DataEnum {
3169    #[cfg_attr(feature = "serde", serde(rename = "string"))]
3170    String,
3171    #[cfg_attr(feature = "serde", serde(rename = "decimal"))]
3172    Decimal,
3173    #[cfg_attr(feature = "serde", serde(rename = "integer"))]
3174    Integer,
3175    #[cfg_attr(feature = "serde", serde(rename = "dateTime"))]
3176    DateTime,
3177    #[cfg_attr(feature = "serde", serde(rename = "boolean"))]
3178    Boolean,
3179    OptionList,
3180    SequenceList,
3181    MemberList,
3182}
3183#[cfg(feature = "validate")]
3184impl crate::validate::Validate for DataEnum {
3185    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3186        Ok(())
3187    }
3188}
3189#[cfg(feature = "alloc")]
3190/// Fixed read-only parameters of a variable.
3191#[derive(Debug, Clone, PartialEq)]
3192#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3193pub struct VariableCharacteristics<CustomDataType = crate::NoCustomData> {
3194    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3195    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3196    pub custom_data: Option<CustomDataType>,
3197    #[cfg_attr(feature = "serde", serde(rename = "dataType"))]
3198    pub data_type: DataEnum,
3199    /// 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.
3200    #[cfg_attr(feature = "serde", serde(rename = "maxLimit"))]
3201    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3202    pub max_limit: Option<f64>,
3203    /// Minimum possible value of this variable.
3204    #[cfg_attr(feature = "serde", serde(rename = "minLimit"))]
3205    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3206    pub min_limit: Option<f64>,
3207    /// Flag indicating if this variable supports monitoring.
3208    #[cfg_attr(feature = "serde", serde(rename = "supportsMonitoring"))]
3209    pub supports_monitoring: bool,
3210    /// Unit of the variable. When the transmitted value has a unit, this field SHALL be included.
3211    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3212    pub unit: Option<heapless::String<16usize>>,
3213    /// Allowed values when variable is Option/Member/SequenceList.
3214    ///
3215    /// * OptionList: The (Actual) Variable value must be a single value from the reported (CSV) enumeration list.
3216    ///
3217    /// * MemberList: The (Actual) Variable value  may be an (unordered) (sub-)set of the reported (CSV) valid values list.
3218    ///
3219    /// * SequenceList: The (Actual) Variable value  may be an ordered (priority, etc)  (sub-)set of the reported (CSV) valid values.
3220    ///
3221    /// This is a comma separated list.
3222    ///
3223    /// The Configuration Variable &lt;&lt;configkey-configuration-value-size,ConfigurationValueSize&gt;&gt; can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these values will always remain equal.
3224    #[cfg_attr(feature = "serde", serde(rename = "valuesList"))]
3225    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3226    pub values_list: Option<alloc::string::String>,
3227}
3228#[cfg(all(feature = "validate", feature = "alloc"))]
3229impl<CustomDataType> crate::validate::Validate
3230for VariableCharacteristics<CustomDataType> {
3231    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3232        crate::validate::Validate::validate(&self.data_type)
3233            .map_err(|error| error.in_field("dataType"))?;
3234        if let Some(value) = &self.values_list {
3235            crate::validate::check_max_length(value, 1000usize)
3236                .map_err(|error| error.in_field("valuesList"))?;
3237        }
3238        Ok(())
3239    }
3240}
3241#[cfg(not(feature = "alloc"))]
3242/// Fixed read-only parameters of a variable.
3243#[derive(Debug, Clone, PartialEq)]
3244#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3245pub struct VariableCharacteristics<
3246    CustomDataType = crate::NoCustomData,
3247    const VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP: usize = 1000usize,
3248> {
3249    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3250    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3251    pub custom_data: Option<CustomDataType>,
3252    #[cfg_attr(feature = "serde", serde(rename = "dataType"))]
3253    pub data_type: DataEnum,
3254    /// 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.
3255    #[cfg_attr(feature = "serde", serde(rename = "maxLimit"))]
3256    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3257    pub max_limit: Option<f64>,
3258    /// Minimum possible value of this variable.
3259    #[cfg_attr(feature = "serde", serde(rename = "minLimit"))]
3260    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3261    pub min_limit: Option<f64>,
3262    /// Flag indicating if this variable supports monitoring.
3263    #[cfg_attr(feature = "serde", serde(rename = "supportsMonitoring"))]
3264    pub supports_monitoring: bool,
3265    /// Unit of the variable. When the transmitted value has a unit, this field SHALL be included.
3266    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3267    pub unit: Option<heapless::String<16usize>>,
3268    /// Allowed values when variable is Option/Member/SequenceList.
3269    ///
3270    /// * OptionList: The (Actual) Variable value must be a single value from the reported (CSV) enumeration list.
3271    ///
3272    /// * MemberList: The (Actual) Variable value  may be an (unordered) (sub-)set of the reported (CSV) valid values list.
3273    ///
3274    /// * SequenceList: The (Actual) Variable value  may be an ordered (priority, etc)  (sub-)set of the reported (CSV) valid values.
3275    ///
3276    /// This is a comma separated list.
3277    ///
3278    /// The Configuration Variable &lt;&lt;configkey-configuration-value-size,ConfigurationValueSize&gt;&gt; can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these values will always remain equal.
3279    #[cfg_attr(feature = "serde", serde(rename = "valuesList"))]
3280    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3281    pub values_list: Option<heapless::String<VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP>>,
3282}
3283#[cfg(all(feature = "validate", not(feature = "alloc")))]
3284impl<
3285    CustomDataType,
3286    const VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP: usize,
3287> crate::validate::Validate
3288for VariableCharacteristics<CustomDataType, VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP> {
3289    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3290        crate::validate::Validate::validate(&self.data_type)
3291            .map_err(|error| error.in_field("dataType"))?;
3292        if let Some(value) = &self.values_list {
3293            crate::validate::check_max_length(value, 1000usize)
3294                .map_err(|error| error.in_field("valuesList"))?;
3295        }
3296        Ok(())
3297    }
3298}
3299#[cfg(feature = "alloc")]
3300/// Class to report components, variables and variable attributes and characteristics.
3301#[derive(Debug, Clone, PartialEq)]
3302#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3303pub struct ReportData<CustomDataType = crate::NoCustomData> {
3304    pub component: Component<CustomDataType>,
3305    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3306    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3307    pub custom_data: Option<CustomDataType>,
3308    pub variable: Variable<CustomDataType>,
3309    #[cfg_attr(feature = "serde", serde(rename = "variableAttribute"))]
3310    pub variable_attribute: heapless::Vec<VariableAttribute<CustomDataType>, 4usize>,
3311    #[cfg_attr(feature = "serde", serde(rename = "variableCharacteristics"))]
3312    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3313    pub variable_characteristics: Option<VariableCharacteristics<CustomDataType>>,
3314}
3315#[cfg(all(feature = "validate", feature = "alloc"))]
3316impl<CustomDataType> crate::validate::Validate for ReportData<CustomDataType> {
3317    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3318        crate::validate::Validate::validate(&self.component)
3319            .map_err(|error| error.in_field("component"))?;
3320        crate::validate::Validate::validate(&self.variable)
3321            .map_err(|error| error.in_field("variable"))?;
3322        crate::validate::check_min_items(self.variable_attribute.len(), 1usize)
3323            .map_err(|error| error.in_field("variableAttribute"))?;
3324        for (index, item) in self.variable_attribute.iter().enumerate() {
3325            crate::validate::Validate::validate(item)
3326                .map_err(|error| error.in_index(index).in_field("variableAttribute"))?;
3327        }
3328        if let Some(value) = &self.variable_characteristics {
3329            crate::validate::Validate::validate(value)
3330                .map_err(|error| error.in_field("variableCharacteristics"))?;
3331        }
3332        Ok(())
3333    }
3334}
3335#[cfg(not(feature = "alloc"))]
3336/// Class to report components, variables and variable attributes and characteristics.
3337#[derive(Debug, Clone, PartialEq)]
3338#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3339pub struct ReportData<
3340    CustomDataType = crate::NoCustomData,
3341    const VARIABLE_ATTRIBUTE_VALUE_CAP: usize = 1024usize,
3342    const VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP: usize = 1000usize,
3343> {
3344    pub component: Component<CustomDataType>,
3345    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3346    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3347    pub custom_data: Option<CustomDataType>,
3348    pub variable: Variable<CustomDataType>,
3349    #[cfg_attr(feature = "serde", serde(rename = "variableAttribute"))]
3350    pub variable_attribute: heapless::Vec<
3351        VariableAttribute<CustomDataType, VARIABLE_ATTRIBUTE_VALUE_CAP>,
3352        4usize,
3353    >,
3354    #[cfg_attr(feature = "serde", serde(rename = "variableCharacteristics"))]
3355    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3356    pub variable_characteristics: Option<
3357        VariableCharacteristics<CustomDataType, VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP>,
3358    >,
3359}
3360#[cfg(all(feature = "validate", not(feature = "alloc")))]
3361impl<
3362    CustomDataType,
3363    const VARIABLE_ATTRIBUTE_VALUE_CAP: usize,
3364    const VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP: usize,
3365> crate::validate::Validate
3366for ReportData<
3367    CustomDataType,
3368    VARIABLE_ATTRIBUTE_VALUE_CAP,
3369    VARIABLE_CHARACTERISTICS_VALUES_LIST_CAP,
3370> {
3371    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3372        crate::validate::Validate::validate(&self.component)
3373            .map_err(|error| error.in_field("component"))?;
3374        crate::validate::Validate::validate(&self.variable)
3375            .map_err(|error| error.in_field("variable"))?;
3376        crate::validate::check_min_items(self.variable_attribute.len(), 1usize)
3377            .map_err(|error| error.in_field("variableAttribute"))?;
3378        for (index, item) in self.variable_attribute.iter().enumerate() {
3379            crate::validate::Validate::validate(item)
3380                .map_err(|error| error.in_index(index).in_field("variableAttribute"))?;
3381        }
3382        if let Some(value) = &self.variable_characteristics {
3383            crate::validate::Validate::validate(value)
3384                .map_err(|error| error.in_field("variableCharacteristics"))?;
3385        }
3386        Ok(())
3387    }
3388}
3389/// This contains the progress status of the publishfirmware
3390/// installation.
3391#[derive(Debug, Clone, PartialEq, Eq)]
3392#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3393pub enum PublishFirmwareStatusEnum {
3394    Idle,
3395    DownloadScheduled,
3396    Downloading,
3397    Downloaded,
3398    Published,
3399    DownloadFailed,
3400    DownloadPaused,
3401    InvalidChecksum,
3402    ChecksumVerified,
3403    PublishFailed,
3404}
3405#[cfg(feature = "validate")]
3406impl crate::validate::Validate for PublishFirmwareStatusEnum {
3407    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3408        Ok(())
3409    }
3410}
3411/// Charging_ Profile. Charging_ Profile_ Kind. Charging_ Profile_ Kind_ Code
3412/// urn:x-oca:ocpp:uid:1:569232
3413/// Indicates the kind of schedule.
3414#[derive(Debug, Clone, PartialEq, Eq)]
3415#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3416pub enum ChargingProfileKindEnum {
3417    Absolute,
3418    Recurring,
3419    Relative,
3420}
3421#[cfg(feature = "validate")]
3422impl crate::validate::Validate for ChargingProfileKindEnum {
3423    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3424        Ok(())
3425    }
3426}
3427/// Charging_ Profile. Recurrency_ Kind. Recurrency_ Kind_ Code
3428/// urn:x-oca:ocpp:uid:1:569233
3429/// Indicates the start point of a recurrence.
3430#[derive(Debug, Clone, PartialEq, Eq)]
3431#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3432pub enum RecurrencyKindEnum {
3433    Daily,
3434    Weekly,
3435}
3436#[cfg(feature = "validate")]
3437impl crate::validate::Validate for RecurrencyKindEnum {
3438    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3439        Ok(())
3440    }
3441}
3442#[cfg(feature = "alloc")]
3443/// Charging_ Profile
3444/// urn:x-oca:ocpp:uid:2:233255
3445/// A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
3446#[derive(Debug, Clone, PartialEq)]
3447#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3448pub struct ChargingProfile<CustomDataType = crate::NoCustomData> {
3449    #[cfg_attr(feature = "serde", serde(rename = "chargingProfileKind"))]
3450    pub charging_profile_kind: ChargingProfileKindEnum,
3451    #[cfg_attr(feature = "serde", serde(rename = "chargingProfilePurpose"))]
3452    pub charging_profile_purpose: ChargingProfilePurposeEnum,
3453    #[cfg_attr(feature = "serde", serde(rename = "chargingSchedule"))]
3454    pub charging_schedule: heapless::Vec<ChargingSchedule<CustomDataType>, 3usize>,
3455    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3456    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3457    pub custom_data: Option<CustomDataType>,
3458    /// Identified_ Object. MRID. Numeric_ Identifier
3459    /// urn:x-enexis:ecdm:uid:1:569198
3460    /// Id of ChargingProfile.
3461    pub id: i64,
3462    #[cfg_attr(feature = "serde", serde(rename = "recurrencyKind"))]
3463    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3464    pub recurrency_kind: Option<RecurrencyKindEnum>,
3465    /// Charging_ Profile. Stack_ Level. Counter
3466    /// urn:x-oca:ocpp:uid:1:569230
3467    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
3468    #[cfg_attr(feature = "serde", serde(rename = "stackLevel"))]
3469    pub stack_level: i64,
3470    /// SHALL only be included if ChargingProfilePurpose is set to TxProfile. The transactionId is used to match the profile to a specific transaction.
3471    #[cfg_attr(feature = "serde", serde(rename = "transactionId"))]
3472    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3473    pub transaction_id: Option<heapless::String<36usize>>,
3474    /// Charging_ Profile. Valid_ From. Date_ Time
3475    /// urn:x-oca:ocpp:uid:1:569234
3476    /// 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.
3477    #[cfg_attr(feature = "serde", serde(rename = "validFrom"))]
3478    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3479    pub valid_from: Option<crate::OcppTimestamp>,
3480    /// Charging_ Profile. Valid_ To. Date_ Time
3481    /// urn:x-oca:ocpp:uid:1:569235
3482    /// Point in time at which the profile stops to be valid. If absent, the profile is valid until it is replaced by another profile.
3483    #[cfg_attr(feature = "serde", serde(rename = "validTo"))]
3484    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3485    pub valid_to: Option<crate::OcppTimestamp>,
3486}
3487#[cfg(all(feature = "validate", feature = "alloc"))]
3488impl<CustomDataType> crate::validate::Validate for ChargingProfile<CustomDataType> {
3489    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3490        crate::validate::Validate::validate(&self.charging_profile_kind)
3491            .map_err(|error| error.in_field("chargingProfileKind"))?;
3492        crate::validate::Validate::validate(&self.charging_profile_purpose)
3493            .map_err(|error| error.in_field("chargingProfilePurpose"))?;
3494        crate::validate::check_min_items(self.charging_schedule.len(), 1usize)
3495            .map_err(|error| error.in_field("chargingSchedule"))?;
3496        for (index, item) in self.charging_schedule.iter().enumerate() {
3497            crate::validate::Validate::validate(item)
3498                .map_err(|error| error.in_index(index).in_field("chargingSchedule"))?;
3499        }
3500        if let Some(value) = &self.recurrency_kind {
3501            crate::validate::Validate::validate(value)
3502                .map_err(|error| error.in_field("recurrencyKind"))?;
3503        }
3504        Ok(())
3505    }
3506}
3507#[cfg(not(feature = "alloc"))]
3508/// Charging_ Profile
3509/// urn:x-oca:ocpp:uid:2:233255
3510/// A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that can be delivered per time interval.
3511#[derive(Debug, Clone, PartialEq)]
3512#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3513pub struct ChargingProfile<
3514    CustomDataType = crate::NoCustomData,
3515    const CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP: usize = 8usize,
3516    const SALES_TARIFF_SALES_TARIFF_ENTRY_CAP: usize = 8usize,
3517> {
3518    #[cfg_attr(feature = "serde", serde(rename = "chargingProfileKind"))]
3519    pub charging_profile_kind: ChargingProfileKindEnum,
3520    #[cfg_attr(feature = "serde", serde(rename = "chargingProfilePurpose"))]
3521    pub charging_profile_purpose: ChargingProfilePurposeEnum,
3522    #[cfg_attr(feature = "serde", serde(rename = "chargingSchedule"))]
3523    pub charging_schedule: heapless::Vec<
3524        ChargingSchedule<
3525            CustomDataType,
3526            CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP,
3527            SALES_TARIFF_SALES_TARIFF_ENTRY_CAP,
3528        >,
3529        3usize,
3530    >,
3531    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3532    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3533    pub custom_data: Option<CustomDataType>,
3534    /// Identified_ Object. MRID. Numeric_ Identifier
3535    /// urn:x-enexis:ecdm:uid:1:569198
3536    /// Id of ChargingProfile.
3537    pub id: i64,
3538    #[cfg_attr(feature = "serde", serde(rename = "recurrencyKind"))]
3539    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3540    pub recurrency_kind: Option<RecurrencyKindEnum>,
3541    /// Charging_ Profile. Stack_ Level. Counter
3542    /// urn:x-oca:ocpp:uid:1:569230
3543    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
3544    #[cfg_attr(feature = "serde", serde(rename = "stackLevel"))]
3545    pub stack_level: i64,
3546    /// SHALL only be included if ChargingProfilePurpose is set to TxProfile. The transactionId is used to match the profile to a specific transaction.
3547    #[cfg_attr(feature = "serde", serde(rename = "transactionId"))]
3548    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3549    pub transaction_id: Option<heapless::String<36usize>>,
3550    /// Charging_ Profile. Valid_ From. Date_ Time
3551    /// urn:x-oca:ocpp:uid:1:569234
3552    /// 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.
3553    #[cfg_attr(feature = "serde", serde(rename = "validFrom"))]
3554    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3555    pub valid_from: Option<crate::OcppTimestamp>,
3556    /// Charging_ Profile. Valid_ To. Date_ Time
3557    /// urn:x-oca:ocpp:uid:1:569235
3558    /// Point in time at which the profile stops to be valid. If absent, the profile is valid until it is replaced by another profile.
3559    #[cfg_attr(feature = "serde", serde(rename = "validTo"))]
3560    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3561    pub valid_to: Option<crate::OcppTimestamp>,
3562}
3563#[cfg(all(feature = "validate", not(feature = "alloc")))]
3564impl<
3565    CustomDataType,
3566    const CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP: usize,
3567    const SALES_TARIFF_SALES_TARIFF_ENTRY_CAP: usize,
3568> crate::validate::Validate
3569for ChargingProfile<
3570    CustomDataType,
3571    CHARGING_SCHEDULE_CHARGING_SCHEDULE_PERIOD_CAP,
3572    SALES_TARIFF_SALES_TARIFF_ENTRY_CAP,
3573> {
3574    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3575        crate::validate::Validate::validate(&self.charging_profile_kind)
3576            .map_err(|error| error.in_field("chargingProfileKind"))?;
3577        crate::validate::Validate::validate(&self.charging_profile_purpose)
3578            .map_err(|error| error.in_field("chargingProfilePurpose"))?;
3579        crate::validate::check_min_items(self.charging_schedule.len(), 1usize)
3580            .map_err(|error| error.in_field("chargingSchedule"))?;
3581        for (index, item) in self.charging_schedule.iter().enumerate() {
3582            crate::validate::Validate::validate(item)
3583                .map_err(|error| error.in_index(index).in_field("chargingSchedule"))?;
3584        }
3585        if let Some(value) = &self.recurrency_kind {
3586            crate::validate::Validate::validate(value)
3587                .map_err(|error| error.in_field("recurrencyKind"))?;
3588        }
3589        Ok(())
3590    }
3591}
3592/// Status indicating whether the Charging Station accepts the request to start a transaction.
3593#[derive(Debug, Clone, PartialEq, Eq)]
3594#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3595pub enum RequestStartStopStatusEnum {
3596    Accepted,
3597    Rejected,
3598}
3599#[cfg(feature = "validate")]
3600impl crate::validate::Validate for RequestStartStopStatusEnum {
3601    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3602        Ok(())
3603    }
3604}
3605/// The updated reservation status.
3606#[derive(Debug, Clone, PartialEq, Eq)]
3607#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3608pub enum ReservationUpdateStatusEnum {
3609    Expired,
3610    Removed,
3611}
3612#[cfg(feature = "validate")]
3613impl crate::validate::Validate for ReservationUpdateStatusEnum {
3614    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3615        Ok(())
3616    }
3617}
3618/// This field specifies the connector type.
3619#[derive(Debug, Clone, PartialEq, Eq)]
3620#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3621pub enum ConnectorEnum {
3622    #[cfg_attr(feature = "serde", serde(rename = "cCCS1"))]
3623    CCCS1,
3624    #[cfg_attr(feature = "serde", serde(rename = "cCCS2"))]
3625    CCCS2,
3626    #[cfg_attr(feature = "serde", serde(rename = "cG105"))]
3627    CG105,
3628    #[cfg_attr(feature = "serde", serde(rename = "cTesla"))]
3629    CTesla,
3630    #[cfg_attr(feature = "serde", serde(rename = "cType1"))]
3631    CType1,
3632    #[cfg_attr(feature = "serde", serde(rename = "cType2"))]
3633    CType2,
3634    #[cfg_attr(feature = "serde", serde(rename = "s309-1P-16A"))]
3635    S3091P16A,
3636    #[cfg_attr(feature = "serde", serde(rename = "s309-1P-32A"))]
3637    S3091P32A,
3638    #[cfg_attr(feature = "serde", serde(rename = "s309-3P-16A"))]
3639    S3093P16A,
3640    #[cfg_attr(feature = "serde", serde(rename = "s309-3P-32A"))]
3641    S3093P32A,
3642    #[cfg_attr(feature = "serde", serde(rename = "sBS1361"))]
3643    SBS1361,
3644    #[cfg_attr(feature = "serde", serde(rename = "sCEE-7-7"))]
3645    SCEE77,
3646    #[cfg_attr(feature = "serde", serde(rename = "sType2"))]
3647    SType2,
3648    #[cfg_attr(feature = "serde", serde(rename = "sType3"))]
3649    SType3,
3650    Other1PhMax16A,
3651    Other1PhOver16A,
3652    Other3Ph,
3653    Pan,
3654    #[cfg_attr(feature = "serde", serde(rename = "wInductive"))]
3655    WInductive,
3656    #[cfg_attr(feature = "serde", serde(rename = "wResonant"))]
3657    WResonant,
3658    Undetermined,
3659    Unknown,
3660}
3661#[cfg(feature = "validate")]
3662impl crate::validate::Validate for ConnectorEnum {
3663    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3664        Ok(())
3665    }
3666}
3667/// This indicates the success or failure of the reservation.
3668#[derive(Debug, Clone, PartialEq, Eq)]
3669#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3670pub enum ReserveNowStatusEnum {
3671    Accepted,
3672    Faulted,
3673    Occupied,
3674    Rejected,
3675    Unavailable,
3676}
3677#[cfg(feature = "validate")]
3678impl crate::validate::Validate for ReserveNowStatusEnum {
3679    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3680        Ok(())
3681    }
3682}
3683/// This contains the type of reset that the Charging Station or EVSE should perform.
3684#[derive(Debug, Clone, PartialEq, Eq)]
3685#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3686pub enum ResetEnum {
3687    Immediate,
3688    OnIdle,
3689}
3690#[cfg(feature = "validate")]
3691impl crate::validate::Validate for ResetEnum {
3692    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3693        Ok(())
3694    }
3695}
3696/// This indicates whether the Charging Station is able to perform the reset.
3697#[derive(Debug, Clone, PartialEq, Eq)]
3698#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3699pub enum ResetStatusEnum {
3700    Accepted,
3701    Rejected,
3702    Scheduled,
3703}
3704#[cfg(feature = "validate")]
3705impl crate::validate::Validate for ResetStatusEnum {
3706    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3707        Ok(())
3708    }
3709}
3710#[cfg(feature = "alloc")]
3711/// Contains the identifier to use for authorization.
3712#[derive(Debug, Clone, PartialEq, Eq)]
3713#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3714pub struct AuthorizationData<CustomDataType = crate::NoCustomData> {
3715    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3716    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3717    pub custom_data: Option<CustomDataType>,
3718    #[cfg_attr(feature = "serde", serde(rename = "idToken"))]
3719    pub id_token: IdToken<CustomDataType>,
3720    #[cfg_attr(feature = "serde", serde(rename = "idTokenInfo"))]
3721    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3722    pub id_token_info: Option<IdTokenInfo<CustomDataType>>,
3723}
3724#[cfg(all(feature = "validate", feature = "alloc"))]
3725impl<CustomDataType> crate::validate::Validate for AuthorizationData<CustomDataType> {
3726    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3727        crate::validate::Validate::validate(&self.id_token)
3728            .map_err(|error| error.in_field("idToken"))?;
3729        if let Some(value) = &self.id_token_info {
3730            crate::validate::Validate::validate(value)
3731                .map_err(|error| error.in_field("idTokenInfo"))?;
3732        }
3733        Ok(())
3734    }
3735}
3736#[cfg(not(feature = "alloc"))]
3737/// Contains the identifier to use for authorization.
3738#[derive(Debug, Clone, PartialEq, Eq)]
3739#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3740pub struct AuthorizationData<
3741    CustomDataType = crate::NoCustomData,
3742    const ID_TOKEN_ADDITIONAL_INFO_CAP: usize = 8usize,
3743    const ID_TOKEN_INFO_EVSE_ID_CAP: usize = 8usize,
3744> {
3745    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3746    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3747    pub custom_data: Option<CustomDataType>,
3748    #[cfg_attr(feature = "serde", serde(rename = "idToken"))]
3749    pub id_token: IdToken<CustomDataType, ID_TOKEN_ADDITIONAL_INFO_CAP>,
3750    #[cfg_attr(feature = "serde", serde(rename = "idTokenInfo"))]
3751    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3752    pub id_token_info: Option<
3753        IdTokenInfo<
3754            CustomDataType,
3755            ID_TOKEN_INFO_EVSE_ID_CAP,
3756            ID_TOKEN_ADDITIONAL_INFO_CAP,
3757        >,
3758    >,
3759}
3760#[cfg(all(feature = "validate", not(feature = "alloc")))]
3761impl<
3762    CustomDataType,
3763    const ID_TOKEN_ADDITIONAL_INFO_CAP: usize,
3764    const ID_TOKEN_INFO_EVSE_ID_CAP: usize,
3765> crate::validate::Validate
3766for AuthorizationData<
3767    CustomDataType,
3768    ID_TOKEN_ADDITIONAL_INFO_CAP,
3769    ID_TOKEN_INFO_EVSE_ID_CAP,
3770> {
3771    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3772        crate::validate::Validate::validate(&self.id_token)
3773            .map_err(|error| error.in_field("idToken"))?;
3774        if let Some(value) = &self.id_token_info {
3775            crate::validate::Validate::validate(value)
3776                .map_err(|error| error.in_field("idTokenInfo"))?;
3777        }
3778        Ok(())
3779    }
3780}
3781/// This contains the type of update (full or differential) of this request.
3782#[derive(Debug, Clone, PartialEq, Eq)]
3783#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3784pub enum UpdateEnum {
3785    Differential,
3786    Full,
3787}
3788#[cfg(feature = "validate")]
3789impl crate::validate::Validate for UpdateEnum {
3790    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3791        Ok(())
3792    }
3793}
3794/// This indicates whether the Charging Station has successfully received and applied the update of the Local Authorization List.
3795#[derive(Debug, Clone, PartialEq, Eq)]
3796#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3797pub enum SendLocalListStatusEnum {
3798    Accepted,
3799    Failed,
3800    VersionMismatch,
3801}
3802#[cfg(feature = "validate")]
3803impl crate::validate::Validate for SendLocalListStatusEnum {
3804    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3805        Ok(())
3806    }
3807}
3808/// Returns whether the Charging Station has been able to process the message successfully. This does not guarantee the schedule will be followed to the letter. There might be other constraints the Charging Station may need to take into account.
3809#[derive(Debug, Clone, PartialEq, Eq)]
3810#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3811pub enum ChargingProfileStatusEnum {
3812    Accepted,
3813    Rejected,
3814}
3815#[cfg(feature = "validate")]
3816impl crate::validate::Validate for ChargingProfileStatusEnum {
3817    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3818        Ok(())
3819    }
3820}
3821/// This indicates whether the Charging Station is able to display the message.
3822#[derive(Debug, Clone, PartialEq, Eq)]
3823#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3824pub enum DisplayMessageStatusEnum {
3825    Accepted,
3826    NotSupportedMessageFormat,
3827    Rejected,
3828    NotSupportedPriority,
3829    NotSupportedState,
3830    UnknownTransaction,
3831}
3832#[cfg(feature = "validate")]
3833impl crate::validate::Validate for DisplayMessageStatusEnum {
3834    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3835        Ok(())
3836    }
3837}
3838/// Specify which monitoring base will be set
3839#[derive(Debug, Clone, PartialEq, Eq)]
3840#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3841pub enum MonitoringBaseEnum {
3842    All,
3843    FactoryDefault,
3844    HardWiredOnly,
3845}
3846#[cfg(feature = "validate")]
3847impl crate::validate::Validate for MonitoringBaseEnum {
3848    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3849        Ok(())
3850    }
3851}
3852/// APN. APN_ Authentication. APN_ Authentication_ Code
3853/// urn:x-oca:ocpp:uid:1:568828
3854/// Authentication method.
3855#[derive(Debug, Clone, PartialEq, Eq)]
3856#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3857pub enum APNAuthenticationEnum {
3858    CHAP,
3859    NONE,
3860    PAP,
3861    AUTO,
3862}
3863#[cfg(feature = "validate")]
3864impl crate::validate::Validate for APNAuthenticationEnum {
3865    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3866        Ok(())
3867    }
3868}
3869/// APN
3870/// urn:x-oca:ocpp:uid:2:233134
3871/// Collection of configuration data needed to make a data-connection over a cellular network.
3872///
3873/// 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.
3874#[derive(Debug, Clone, PartialEq, Eq)]
3875#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3876pub struct APN<CustomDataType = crate::NoCustomData> {
3877    /// APN. APN. URI
3878    /// urn:x-oca:ocpp:uid:1:568814
3879    /// The Access Point Name as an URL.
3880    pub apn: heapless::String<512usize>,
3881    #[cfg_attr(feature = "serde", serde(rename = "apnAuthentication"))]
3882    pub apn_authentication: APNAuthenticationEnum,
3883    /// APN. APN. Password
3884    /// urn:x-oca:ocpp:uid:1:568819
3885    /// APN Password.
3886    #[cfg_attr(feature = "serde", serde(rename = "apnPassword"))]
3887    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3888    pub apn_password: Option<heapless::String<20usize>>,
3889    /// APN. APN. User_ Name
3890    /// urn:x-oca:ocpp:uid:1:568818
3891    /// APN username.
3892    #[cfg_attr(feature = "serde", serde(rename = "apnUserName"))]
3893    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3894    pub apn_user_name: Option<heapless::String<20usize>>,
3895    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
3896    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3897    pub custom_data: Option<CustomDataType>,
3898    /// APN. Preferred_ Network. Mobile_ Network_ ID
3899    /// urn:x-oca:ocpp:uid:1:568822
3900    /// Preferred network, written as MCC and MNC concatenated. See note.
3901    #[cfg_attr(feature = "serde", serde(rename = "preferredNetwork"))]
3902    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3903    pub preferred_network: Option<heapless::String<6usize>>,
3904    /// APN. SIMPIN. PIN_ Code
3905    /// urn:x-oca:ocpp:uid:1:568821
3906    /// SIM card pin code.
3907    #[cfg_attr(feature = "serde", serde(rename = "simPin"))]
3908    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3909    pub sim_pin: Option<i64>,
3910    /// APN. Use_ Only_ Preferred_ Network. Indicator
3911    /// urn:x-oca:ocpp:uid:1:568824
3912    /// Default: false. Use only the preferred Network, do
3913    /// not dial in when not available. See Note.
3914    #[cfg_attr(feature = "serde", serde(rename = "useOnlyPreferredNetwork"))]
3915    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3916    pub use_only_preferred_network: Option<bool>,
3917}
3918#[cfg(feature = "validate")]
3919impl<CustomDataType> crate::validate::Validate for APN<CustomDataType> {
3920    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3921        crate::validate::Validate::validate(&self.apn_authentication)
3922            .map_err(|error| error.in_field("apnAuthentication"))?;
3923        Ok(())
3924    }
3925}
3926/// Applicable Network Interface.
3927#[derive(Debug, Clone, PartialEq, Eq)]
3928#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3929pub enum OCPPInterfaceEnum {
3930    Wired0,
3931    Wired1,
3932    Wired2,
3933    Wired3,
3934    Wireless0,
3935    Wireless1,
3936    Wireless2,
3937    Wireless3,
3938}
3939#[cfg(feature = "validate")]
3940impl crate::validate::Validate for OCPPInterfaceEnum {
3941    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3942        Ok(())
3943    }
3944}
3945/// Communication_ Function. OCPP_ Transport. OCPP_ Transport_ Code
3946/// urn:x-oca:ocpp:uid:1:569356
3947/// Defines the transport protocol (e.g. SOAP or JSON). Note: SOAP is not supported in OCPP 2.0, but is supported by other versions of OCPP.
3948#[derive(Debug, Clone, PartialEq, Eq)]
3949#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3950pub enum OCPPTransportEnum {
3951    JSON,
3952    SOAP,
3953}
3954#[cfg(feature = "validate")]
3955impl crate::validate::Validate for OCPPTransportEnum {
3956    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3957        Ok(())
3958    }
3959}
3960/// Communication_ Function. OCPP_ Version. OCPP_ Version_ Code
3961/// urn:x-oca:ocpp:uid:1:569355
3962/// Defines the OCPP version used for this communication function.
3963#[derive(Debug, Clone, PartialEq, Eq)]
3964#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3965pub enum OCPPVersionEnum {
3966    OCPP12,
3967    OCPP15,
3968    OCPP16,
3969    OCPP20,
3970}
3971#[cfg(feature = "validate")]
3972impl crate::validate::Validate for OCPPVersionEnum {
3973    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3974        Ok(())
3975    }
3976}
3977/// VPN. Type. VPN_ Code
3978/// urn:x-oca:ocpp:uid:1:569277
3979/// Type of VPN
3980#[derive(Debug, Clone, PartialEq, Eq)]
3981#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3982pub enum VPNEnum {
3983    IKEv2,
3984    IPSec,
3985    L2TP,
3986    PPTP,
3987}
3988#[cfg(feature = "validate")]
3989impl crate::validate::Validate for VPNEnum {
3990    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
3991        Ok(())
3992    }
3993}
3994/// VPN
3995/// urn:x-oca:ocpp:uid:2:233268
3996/// VPN Configuration settings
3997#[derive(Debug, Clone, PartialEq, Eq)]
3998#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3999pub struct VPN<CustomDataType = crate::NoCustomData> {
4000    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4001    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4002    pub custom_data: Option<CustomDataType>,
4003    /// VPN. Group. Group_ Name
4004    /// urn:x-oca:ocpp:uid:1:569274
4005    /// VPN group.
4006    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4007    pub group: Option<heapless::String<20usize>>,
4008    /// VPN. Key. VPN_ Key
4009    /// urn:x-oca:ocpp:uid:1:569276
4010    /// VPN shared secret.
4011    pub key: heapless::String<255usize>,
4012    /// VPN. Password. Password
4013    /// urn:x-oca:ocpp:uid:1:569275
4014    /// VPN Password.
4015    pub password: heapless::String<20usize>,
4016    /// VPN. Server. URI
4017    /// urn:x-oca:ocpp:uid:1:569272
4018    /// VPN Server Address
4019    pub server: heapless::String<512usize>,
4020    pub r#type: VPNEnum,
4021    /// VPN. User. User_ Name
4022    /// urn:x-oca:ocpp:uid:1:569273
4023    /// VPN User
4024    pub user: heapless::String<20usize>,
4025}
4026#[cfg(feature = "validate")]
4027impl<CustomDataType> crate::validate::Validate for VPN<CustomDataType> {
4028    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4029        crate::validate::Validate::validate(&self.r#type)
4030            .map_err(|error| error.in_field("type"))?;
4031        Ok(())
4032    }
4033}
4034/// Communication_ Function
4035/// urn:x-oca:ocpp:uid:2:233304
4036/// The NetworkConnectionProfile defines the functional and technical parameters of a communication link.
4037#[derive(Debug, Clone, PartialEq, Eq)]
4038#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4039pub struct NetworkConnectionProfile<CustomDataType = crate::NoCustomData> {
4040    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4041    pub apn: Option<APN<CustomDataType>>,
4042    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4043    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4044    pub custom_data: Option<CustomDataType>,
4045    /// Duration in seconds before a message send by the Charging Station via this network connection times-out.
4046    /// The best setting depends on the underlying network and response times of the CSMS.
4047    /// If you are looking for a some guideline: use 30 seconds as a starting point.
4048    #[cfg_attr(feature = "serde", serde(rename = "messageTimeout"))]
4049    pub message_timeout: i64,
4050    /// Communication_ Function. OCPP_ Central_ System_ URL. URI
4051    /// urn:x-oca:ocpp:uid:1:569357
4052    /// URL of the CSMS(s) that this Charging Station  communicates with.
4053    #[cfg_attr(feature = "serde", serde(rename = "ocppCsmsUrl"))]
4054    pub ocpp_csms_url: heapless::String<512usize>,
4055    #[cfg_attr(feature = "serde", serde(rename = "ocppInterface"))]
4056    pub ocpp_interface: OCPPInterfaceEnum,
4057    #[cfg_attr(feature = "serde", serde(rename = "ocppTransport"))]
4058    pub ocpp_transport: OCPPTransportEnum,
4059    #[cfg_attr(feature = "serde", serde(rename = "ocppVersion"))]
4060    pub ocpp_version: OCPPVersionEnum,
4061    /// This field specifies the security profile used when connecting to the CSMS with this NetworkConnectionProfile.
4062    #[cfg_attr(feature = "serde", serde(rename = "securityProfile"))]
4063    pub security_profile: i64,
4064    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4065    pub vpn: Option<VPN<CustomDataType>>,
4066}
4067#[cfg(feature = "validate")]
4068impl<CustomDataType> crate::validate::Validate
4069for NetworkConnectionProfile<CustomDataType> {
4070    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4071        if let Some(value) = &self.apn {
4072            crate::validate::Validate::validate(value)
4073                .map_err(|error| error.in_field("apn"))?;
4074        }
4075        crate::validate::Validate::validate(&self.ocpp_interface)
4076            .map_err(|error| error.in_field("ocppInterface"))?;
4077        crate::validate::Validate::validate(&self.ocpp_transport)
4078            .map_err(|error| error.in_field("ocppTransport"))?;
4079        crate::validate::Validate::validate(&self.ocpp_version)
4080            .map_err(|error| error.in_field("ocppVersion"))?;
4081        if let Some(value) = &self.vpn {
4082            crate::validate::Validate::validate(value)
4083                .map_err(|error| error.in_field("vpn"))?;
4084        }
4085        Ok(())
4086    }
4087}
4088/// Result of operation.
4089#[derive(Debug, Clone, PartialEq, Eq)]
4090#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4091pub enum SetNetworkProfileStatusEnum {
4092    Accepted,
4093    Rejected,
4094    Failed,
4095}
4096#[cfg(feature = "validate")]
4097impl crate::validate::Validate for SetNetworkProfileStatusEnum {
4098    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4099        Ok(())
4100    }
4101}
4102/// Class to hold parameters of SetVariableMonitoring request.
4103#[derive(Debug, Clone, PartialEq)]
4104#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4105pub struct SetMonitoringData<CustomDataType = crate::NoCustomData> {
4106    pub component: Component<CustomDataType>,
4107    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4108    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4109    pub custom_data: Option<CustomDataType>,
4110    /// An id SHALL only be given to replace an existing monitor. The Charging Station handles the generation of id's for new monitors.
4111    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4112    pub id: Option<i64>,
4113    /// 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.
4114    ///
4115    /// The severity levels have the following meaning: +
4116    /// *0-Danger* +
4117    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
4118    /// *1-Hardware Failure* +
4119    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
4120    /// *2-System Failure* +
4121    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
4122    /// *3-Critical* +
4123    /// Indicates a critical error. Action is required. +
4124    /// *4-Error* +
4125    /// Indicates a non-urgent error. Action is required. +
4126    /// *5-Alert* +
4127    /// Indicates an alert event. Default severity for any type of monitoring event.  +
4128    /// *6-Warning* +
4129    /// Indicates a warning event. Action may be required. +
4130    /// *7-Notice* +
4131    /// Indicates an unusual event. No immediate action is required. +
4132    /// *8-Informational* +
4133    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
4134    /// *9-Debug* +
4135    /// Indicates information useful to developers for debugging, not useful during operations.
4136    pub severity: i64,
4137    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction. Default = false.
4138    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4139    pub transaction: Option<bool>,
4140    pub r#type: MonitorEnum,
4141    /// Value for threshold or delta monitoring.
4142    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
4143    pub value: f64,
4144    pub variable: Variable<CustomDataType>,
4145}
4146#[cfg(feature = "validate")]
4147impl<CustomDataType> crate::validate::Validate for SetMonitoringData<CustomDataType> {
4148    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4149        crate::validate::Validate::validate(&self.component)
4150            .map_err(|error| error.in_field("component"))?;
4151        crate::validate::Validate::validate(&self.r#type)
4152            .map_err(|error| error.in_field("type"))?;
4153        crate::validate::Validate::validate(&self.variable)
4154            .map_err(|error| error.in_field("variable"))?;
4155        Ok(())
4156    }
4157}
4158/// Status is OK if a value could be returned. Otherwise this will indicate the reason why a value could not be returned.
4159#[derive(Debug, Clone, PartialEq, Eq)]
4160#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4161pub enum SetMonitoringStatusEnum {
4162    Accepted,
4163    UnknownComponent,
4164    UnknownVariable,
4165    UnsupportedMonitorType,
4166    Rejected,
4167    Duplicate,
4168}
4169#[cfg(feature = "validate")]
4170impl crate::validate::Validate for SetMonitoringStatusEnum {
4171    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4172        Ok(())
4173    }
4174}
4175/// Class to hold result of SetVariableMonitoring request.
4176#[derive(Debug, Clone, PartialEq, Eq)]
4177#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4178pub struct SetMonitoringResult<CustomDataType = crate::NoCustomData> {
4179    pub component: Component<CustomDataType>,
4180    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4181    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4182    pub custom_data: Option<CustomDataType>,
4183    /// 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.
4184    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4185    pub id: Option<i64>,
4186    /// 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.
4187    ///
4188    /// The severity levels have the following meaning: +
4189    /// *0-Danger* +
4190    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
4191    /// *1-Hardware Failure* +
4192    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
4193    /// *2-System Failure* +
4194    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
4195    /// *3-Critical* +
4196    /// Indicates a critical error. Action is required. +
4197    /// *4-Error* +
4198    /// Indicates a non-urgent error. Action is required. +
4199    /// *5-Alert* +
4200    /// Indicates an alert event. Default severity for any type of monitoring event.  +
4201    /// *6-Warning* +
4202    /// Indicates a warning event. Action may be required. +
4203    /// *7-Notice* +
4204    /// Indicates an unusual event. No immediate action is required. +
4205    /// *8-Informational* +
4206    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
4207    /// *9-Debug* +
4208    /// Indicates information useful to developers for debugging, not useful during operations.
4209    pub severity: i64,
4210    pub status: SetMonitoringStatusEnum,
4211    #[cfg_attr(feature = "serde", serde(rename = "statusInfo"))]
4212    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4213    pub status_info: Option<StatusInfo<CustomDataType>>,
4214    pub r#type: MonitorEnum,
4215    pub variable: Variable<CustomDataType>,
4216}
4217#[cfg(feature = "validate")]
4218impl<CustomDataType> crate::validate::Validate for SetMonitoringResult<CustomDataType> {
4219    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4220        crate::validate::Validate::validate(&self.component)
4221            .map_err(|error| error.in_field("component"))?;
4222        crate::validate::Validate::validate(&self.status)
4223            .map_err(|error| error.in_field("status"))?;
4224        if let Some(value) = &self.status_info {
4225            crate::validate::Validate::validate(value)
4226                .map_err(|error| error.in_field("statusInfo"))?;
4227        }
4228        crate::validate::Validate::validate(&self.r#type)
4229            .map_err(|error| error.in_field("type"))?;
4230        crate::validate::Validate::validate(&self.variable)
4231            .map_err(|error| error.in_field("variable"))?;
4232        Ok(())
4233    }
4234}
4235#[cfg(feature = "alloc")]
4236#[derive(Debug, Clone, PartialEq, Eq)]
4237#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4238pub struct SetVariableData<CustomDataType = crate::NoCustomData> {
4239    #[cfg_attr(feature = "serde", serde(rename = "attributeType"))]
4240    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4241    pub attribute_type: Option<AttributeEnum>,
4242    /// Value to be assigned to attribute of variable.
4243    ///
4244    /// The Configuration Variable &lt;&lt;configkey-configuration-value-size,ConfigurationValueSize&gt;&gt; can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these values will always remain equal.
4245    #[cfg_attr(feature = "serde", serde(rename = "attributeValue"))]
4246    pub attribute_value: alloc::string::String,
4247    pub component: Component<CustomDataType>,
4248    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4249    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4250    pub custom_data: Option<CustomDataType>,
4251    pub variable: Variable<CustomDataType>,
4252}
4253#[cfg(all(feature = "validate", feature = "alloc"))]
4254impl<CustomDataType> crate::validate::Validate for SetVariableData<CustomDataType> {
4255    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4256        if let Some(value) = &self.attribute_type {
4257            crate::validate::Validate::validate(value)
4258                .map_err(|error| error.in_field("attributeType"))?;
4259        }
4260        crate::validate::check_max_length(&self.attribute_value, 1000usize)
4261            .map_err(|error| error.in_field("attributeValue"))?;
4262        crate::validate::Validate::validate(&self.component)
4263            .map_err(|error| error.in_field("component"))?;
4264        crate::validate::Validate::validate(&self.variable)
4265            .map_err(|error| error.in_field("variable"))?;
4266        Ok(())
4267    }
4268}
4269#[cfg(not(feature = "alloc"))]
4270#[derive(Debug, Clone, PartialEq, Eq)]
4271#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4272pub struct SetVariableData<
4273    CustomDataType = crate::NoCustomData,
4274    const SET_VARIABLE_DATA_ATTRIBUTE_VALUE_CAP: usize = 1000usize,
4275> {
4276    #[cfg_attr(feature = "serde", serde(rename = "attributeType"))]
4277    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4278    pub attribute_type: Option<AttributeEnum>,
4279    /// Value to be assigned to attribute of variable.
4280    ///
4281    /// The Configuration Variable &lt;&lt;configkey-configuration-value-size,ConfigurationValueSize&gt;&gt; can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these values will always remain equal.
4282    #[cfg_attr(feature = "serde", serde(rename = "attributeValue"))]
4283    pub attribute_value: heapless::String<SET_VARIABLE_DATA_ATTRIBUTE_VALUE_CAP>,
4284    pub component: Component<CustomDataType>,
4285    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4286    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4287    pub custom_data: Option<CustomDataType>,
4288    pub variable: Variable<CustomDataType>,
4289}
4290#[cfg(all(feature = "validate", not(feature = "alloc")))]
4291impl<
4292    CustomDataType,
4293    const SET_VARIABLE_DATA_ATTRIBUTE_VALUE_CAP: usize,
4294> crate::validate::Validate
4295for SetVariableData<CustomDataType, SET_VARIABLE_DATA_ATTRIBUTE_VALUE_CAP> {
4296    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4297        if let Some(value) = &self.attribute_type {
4298            crate::validate::Validate::validate(value)
4299                .map_err(|error| error.in_field("attributeType"))?;
4300        }
4301        crate::validate::check_max_length(&self.attribute_value, 1000usize)
4302            .map_err(|error| error.in_field("attributeValue"))?;
4303        crate::validate::Validate::validate(&self.component)
4304            .map_err(|error| error.in_field("component"))?;
4305        crate::validate::Validate::validate(&self.variable)
4306            .map_err(|error| error.in_field("variable"))?;
4307        Ok(())
4308    }
4309}
4310/// Result status of setting the variable.
4311#[derive(Debug, Clone, PartialEq, Eq)]
4312#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4313pub enum SetVariableStatusEnum {
4314    Accepted,
4315    Rejected,
4316    UnknownComponent,
4317    UnknownVariable,
4318    NotSupportedAttributeType,
4319    RebootRequired,
4320}
4321#[cfg(feature = "validate")]
4322impl crate::validate::Validate for SetVariableStatusEnum {
4323    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4324        Ok(())
4325    }
4326}
4327#[derive(Debug, Clone, PartialEq, Eq)]
4328#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4329pub struct SetVariableResult<CustomDataType = crate::NoCustomData> {
4330    #[cfg_attr(feature = "serde", serde(rename = "attributeStatus"))]
4331    pub attribute_status: SetVariableStatusEnum,
4332    #[cfg_attr(feature = "serde", serde(rename = "attributeStatusInfo"))]
4333    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4334    pub attribute_status_info: Option<StatusInfo<CustomDataType>>,
4335    #[cfg_attr(feature = "serde", serde(rename = "attributeType"))]
4336    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4337    pub attribute_type: Option<AttributeEnum>,
4338    pub component: Component<CustomDataType>,
4339    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4340    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4341    pub custom_data: Option<CustomDataType>,
4342    pub variable: Variable<CustomDataType>,
4343}
4344#[cfg(feature = "validate")]
4345impl<CustomDataType> crate::validate::Validate for SetVariableResult<CustomDataType> {
4346    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4347        crate::validate::Validate::validate(&self.attribute_status)
4348            .map_err(|error| error.in_field("attributeStatus"))?;
4349        if let Some(value) = &self.attribute_status_info {
4350            crate::validate::Validate::validate(value)
4351                .map_err(|error| error.in_field("attributeStatusInfo"))?;
4352        }
4353        if let Some(value) = &self.attribute_type {
4354            crate::validate::Validate::validate(value)
4355                .map_err(|error| error.in_field("attributeType"))?;
4356        }
4357        crate::validate::Validate::validate(&self.component)
4358            .map_err(|error| error.in_field("component"))?;
4359        crate::validate::Validate::validate(&self.variable)
4360            .map_err(|error| error.in_field("variable"))?;
4361        Ok(())
4362    }
4363}
4364/// This contains the current status of the Connector.
4365#[derive(Debug, Clone, PartialEq, Eq)]
4366#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4367pub enum ConnectorStatusEnum {
4368    Available,
4369    Occupied,
4370    Reserved,
4371    Unavailable,
4372    Faulted,
4373}
4374#[cfg(feature = "validate")]
4375impl crate::validate::Validate for ConnectorStatusEnum {
4376    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4377        Ok(())
4378    }
4379}
4380/// This contains the type of this event.
4381/// The first TransactionEvent of a transaction SHALL contain: "Started" The last TransactionEvent of a transaction SHALL contain: "Ended" All others SHALL contain: "Updated"
4382#[derive(Debug, Clone, PartialEq, Eq)]
4383#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4384pub enum TransactionEventEnum {
4385    Ended,
4386    Started,
4387    Updated,
4388}
4389#[cfg(feature = "validate")]
4390impl crate::validate::Validate for TransactionEventEnum {
4391    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4392        Ok(())
4393    }
4394}
4395/// Transaction. State. Transaction_ State_ Code
4396/// urn:x-oca:ocpp:uid:1:569419
4397/// Current charging state, is required when state
4398/// has changed.
4399#[derive(Debug, Clone, PartialEq, Eq)]
4400#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4401pub enum ChargingStateEnum {
4402    Charging,
4403    EVConnected,
4404    SuspendedEV,
4405    SuspendedEVSE,
4406    Idle,
4407}
4408#[cfg(feature = "validate")]
4409impl crate::validate::Validate for ChargingStateEnum {
4410    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4411        Ok(())
4412    }
4413}
4414/// Transaction. Stopped_ Reason. EOT_ Reason_ Code
4415/// urn:x-oca:ocpp:uid:1:569413
4416/// This contains the reason why the transaction was stopped. MAY only be omitted when Reason is "Local".
4417#[derive(Debug, Clone, PartialEq, Eq)]
4418#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4419pub enum ReasonEnum {
4420    DeAuthorized,
4421    EmergencyStop,
4422    EnergyLimitReached,
4423    EVDisconnected,
4424    GroundFault,
4425    ImmediateReset,
4426    Local,
4427    LocalOutOfCredit,
4428    MasterPass,
4429    Other,
4430    OvercurrentFault,
4431    PowerLoss,
4432    PowerQuality,
4433    Reboot,
4434    Remote,
4435    SOCLimitReached,
4436    StoppedByEV,
4437    TimeLimitReached,
4438    Timeout,
4439}
4440#[cfg(feature = "validate")]
4441impl crate::validate::Validate for ReasonEnum {
4442    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4443        Ok(())
4444    }
4445}
4446/// Transaction
4447/// urn:x-oca:ocpp:uid:2:233318
4448#[derive(Debug, Clone, PartialEq, Eq)]
4449#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4450pub struct Transaction<CustomDataType = crate::NoCustomData> {
4451    #[cfg_attr(feature = "serde", serde(rename = "chargingState"))]
4452    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4453    pub charging_state: Option<ChargingStateEnum>,
4454    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4455    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4456    pub custom_data: Option<CustomDataType>,
4457    /// The ID given to remote start request (&lt;&lt;requeststarttransactionrequest, RequestStartTransactionRequest&gt;&gt;. This enables to CSMS to match the started transaction to the given start request.
4458    #[cfg_attr(feature = "serde", serde(rename = "remoteStartId"))]
4459    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4460    pub remote_start_id: Option<i64>,
4461    #[cfg_attr(feature = "serde", serde(rename = "stoppedReason"))]
4462    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4463    pub stopped_reason: Option<ReasonEnum>,
4464    /// Transaction. Time_ Spent_ Charging. Elapsed_ Time
4465    /// urn:x-oca:ocpp:uid:1:569415
4466    /// 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.
4467    #[cfg_attr(feature = "serde", serde(rename = "timeSpentCharging"))]
4468    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4469    pub time_spent_charging: Option<i64>,
4470    /// This contains the Id of the transaction.
4471    #[cfg_attr(feature = "serde", serde(rename = "transactionId"))]
4472    pub transaction_id: heapless::String<36usize>,
4473}
4474#[cfg(feature = "validate")]
4475impl<CustomDataType> crate::validate::Validate for Transaction<CustomDataType> {
4476    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4477        if let Some(value) = &self.charging_state {
4478            crate::validate::Validate::validate(value)
4479                .map_err(|error| error.in_field("chargingState"))?;
4480        }
4481        if let Some(value) = &self.stopped_reason {
4482            crate::validate::Validate::validate(value)
4483                .map_err(|error| error.in_field("stoppedReason"))?;
4484        }
4485        Ok(())
4486    }
4487}
4488/// Reason the Charging Station sends this message to the CSMS
4489#[derive(Debug, Clone, PartialEq, Eq)]
4490#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4491pub enum TriggerReasonEnum {
4492    Authorized,
4493    CablePluggedIn,
4494    ChargingRateChanged,
4495    ChargingStateChanged,
4496    Deauthorized,
4497    EnergyLimitReached,
4498    EVCommunicationLost,
4499    EVConnectTimeout,
4500    MeterValueClock,
4501    MeterValuePeriodic,
4502    TimeLimitReached,
4503    Trigger,
4504    UnlockCommand,
4505    StopAuthorized,
4506    EVDeparted,
4507    EVDetected,
4508    RemoteStop,
4509    RemoteStart,
4510    AbnormalCondition,
4511    SignedDataReceived,
4512    ResetCommand,
4513}
4514#[cfg(feature = "validate")]
4515impl crate::validate::Validate for TriggerReasonEnum {
4516    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4517        Ok(())
4518    }
4519}
4520/// Type of message to be triggered.
4521#[derive(Debug, Clone, PartialEq, Eq)]
4522#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4523pub enum MessageTriggerEnum {
4524    BootNotification,
4525    LogStatusNotification,
4526    FirmwareStatusNotification,
4527    Heartbeat,
4528    MeterValues,
4529    SignChargingStationCertificate,
4530    SignV2GCertificate,
4531    StatusNotification,
4532    TransactionEvent,
4533    SignCombinedCertificate,
4534    PublishFirmwareStatusNotification,
4535}
4536#[cfg(feature = "validate")]
4537impl crate::validate::Validate for MessageTriggerEnum {
4538    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4539        Ok(())
4540    }
4541}
4542/// Indicates whether the Charging Station will send the requested notification or not.
4543#[derive(Debug, Clone, PartialEq, Eq)]
4544#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4545pub enum TriggerMessageStatusEnum {
4546    Accepted,
4547    Rejected,
4548    NotImplemented,
4549}
4550#[cfg(feature = "validate")]
4551impl crate::validate::Validate for TriggerMessageStatusEnum {
4552    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4553        Ok(())
4554    }
4555}
4556/// This indicates whether the Charging Station has unlocked the connector.
4557#[derive(Debug, Clone, PartialEq, Eq)]
4558#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4559pub enum UnlockStatusEnum {
4560    Unlocked,
4561    UnlockFailed,
4562    OngoingAuthorizedTransaction,
4563    UnknownConnector,
4564}
4565#[cfg(feature = "validate")]
4566impl crate::validate::Validate for UnlockStatusEnum {
4567    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4568        Ok(())
4569    }
4570}
4571/// Indicates whether the Local Controller succeeded in unpublishing the firmware.
4572#[derive(Debug, Clone, PartialEq, Eq)]
4573#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4574pub enum UnpublishFirmwareStatusEnum {
4575    DownloadOngoing,
4576    NoFirmware,
4577    Unpublished,
4578}
4579#[cfg(feature = "validate")]
4580impl crate::validate::Validate for UnpublishFirmwareStatusEnum {
4581    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4582        Ok(())
4583    }
4584}
4585#[cfg(feature = "alloc")]
4586/// Firmware
4587/// urn:x-enexis:ecdm:uid:2:233291
4588/// Represents a copy of the firmware that can be loaded/updated on the Charging Station.
4589#[derive(Debug, Clone, PartialEq, Eq)]
4590#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4591pub struct Firmware<CustomDataType = crate::NoCustomData> {
4592    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4593    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4594    pub custom_data: Option<CustomDataType>,
4595    /// Firmware. Install. Date_ Time
4596    /// urn:x-enexis:ecdm:uid:1:569462
4597    /// Date and time at which the firmware shall be installed.
4598    #[cfg_attr(feature = "serde", serde(rename = "installDateTime"))]
4599    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4600    pub install_date_time: Option<crate::OcppTimestamp>,
4601    /// Firmware. Location. URI
4602    /// urn:x-enexis:ecdm:uid:1:569460
4603    /// URI defining the origin of the firmware.
4604    pub location: heapless::String<512usize>,
4605    /// Firmware. Retrieve. Date_ Time
4606    /// urn:x-enexis:ecdm:uid:1:569461
4607    /// Date and time at which the firmware shall be retrieved.
4608    #[cfg_attr(feature = "serde", serde(rename = "retrieveDateTime"))]
4609    pub retrieve_date_time: crate::OcppTimestamp,
4610    /// Firmware. Signature. Signature
4611    /// urn:x-enexis:ecdm:uid:1:569464
4612    /// Base64 encoded firmware signature.
4613    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4614    pub signature: Option<alloc::string::String>,
4615    /// Certificate with which the firmware was signed.
4616    /// PEM encoded X.509 certificate.
4617    #[cfg_attr(feature = "serde", serde(rename = "signingCertificate"))]
4618    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4619    pub signing_certificate: Option<alloc::string::String>,
4620}
4621#[cfg(all(feature = "validate", feature = "alloc"))]
4622impl<CustomDataType> crate::validate::Validate for Firmware<CustomDataType> {
4623    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4624        if let Some(value) = &self.signature {
4625            crate::validate::check_max_length(value, 800usize)
4626                .map_err(|error| error.in_field("signature"))?;
4627        }
4628        if let Some(value) = &self.signing_certificate {
4629            crate::validate::check_max_length(value, 5500usize)
4630                .map_err(|error| error.in_field("signingCertificate"))?;
4631        }
4632        Ok(())
4633    }
4634}
4635#[cfg(not(feature = "alloc"))]
4636/// Firmware
4637/// urn:x-enexis:ecdm:uid:2:233291
4638/// Represents a copy of the firmware that can be loaded/updated on the Charging Station.
4639#[derive(Debug, Clone, PartialEq, Eq)]
4640#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4641pub struct Firmware<
4642    CustomDataType = crate::NoCustomData,
4643    const FIRMWARE_SIGNATURE_CAP: usize = 800usize,
4644    const FIRMWARE_SIGNING_CERTIFICATE_CAP: usize = 1024usize,
4645> {
4646    #[cfg_attr(feature = "serde", serde(rename = "customData"))]
4647    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4648    pub custom_data: Option<CustomDataType>,
4649    /// Firmware. Install. Date_ Time
4650    /// urn:x-enexis:ecdm:uid:1:569462
4651    /// Date and time at which the firmware shall be installed.
4652    #[cfg_attr(feature = "serde", serde(rename = "installDateTime"))]
4653    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4654    pub install_date_time: Option<crate::OcppTimestamp>,
4655    /// Firmware. Location. URI
4656    /// urn:x-enexis:ecdm:uid:1:569460
4657    /// URI defining the origin of the firmware.
4658    pub location: heapless::String<512usize>,
4659    /// Firmware. Retrieve. Date_ Time
4660    /// urn:x-enexis:ecdm:uid:1:569461
4661    /// Date and time at which the firmware shall be retrieved.
4662    #[cfg_attr(feature = "serde", serde(rename = "retrieveDateTime"))]
4663    pub retrieve_date_time: crate::OcppTimestamp,
4664    /// Firmware. Signature. Signature
4665    /// urn:x-enexis:ecdm:uid:1:569464
4666    /// Base64 encoded firmware signature.
4667    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4668    pub signature: Option<heapless::String<FIRMWARE_SIGNATURE_CAP>>,
4669    /// Certificate with which the firmware was signed.
4670    /// PEM encoded X.509 certificate.
4671    #[cfg_attr(feature = "serde", serde(rename = "signingCertificate"))]
4672    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
4673    pub signing_certificate: Option<heapless::String<FIRMWARE_SIGNING_CERTIFICATE_CAP>>,
4674}
4675#[cfg(all(feature = "validate", not(feature = "alloc")))]
4676impl<
4677    CustomDataType,
4678    const FIRMWARE_SIGNATURE_CAP: usize,
4679    const FIRMWARE_SIGNING_CERTIFICATE_CAP: usize,
4680> crate::validate::Validate
4681for Firmware<CustomDataType, FIRMWARE_SIGNATURE_CAP, FIRMWARE_SIGNING_CERTIFICATE_CAP> {
4682    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4683        if let Some(value) = &self.signature {
4684            crate::validate::check_max_length(value, 800usize)
4685                .map_err(|error| error.in_field("signature"))?;
4686        }
4687        if let Some(value) = &self.signing_certificate {
4688            crate::validate::check_max_length(value, 5500usize)
4689                .map_err(|error| error.in_field("signingCertificate"))?;
4690        }
4691        Ok(())
4692    }
4693}
4694/// This field indicates whether the Charging Station was able to accept the request.
4695#[derive(Debug, Clone, PartialEq, Eq)]
4696#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4697pub enum UpdateFirmwareStatusEnum {
4698    Accepted,
4699    Rejected,
4700    AcceptedCanceled,
4701    InvalidCertificate,
4702    RevokedCertificate,
4703}
4704#[cfg(feature = "validate")]
4705impl crate::validate::Validate for UpdateFirmwareStatusEnum {
4706    fn validate(&self) -> Result<(), crate::validate::ValidationError> {
4707        Ok(())
4708    }
4709}