Skip to main content

ocpp_kit/v2_1/
types.rs

1// @generated by `cargo xtask codegen` from the vendored OCPP JSON schemas.
2// DO NOT EDIT — re-run the generator instead. CI fails if this file is stale.
3
4//! Data types shared between OCPP 2.1 messages, generated from the official JSON schemas.
5
6#![allow(unused_imports, clippy::doc_markdown, clippy::struct_excessive_bools)]
7#![allow(
8    clippy::too_many_lines,
9    clippy::too_many_arguments,
10    clippy::wildcard_imports
11)]
12#![allow(clippy::match_same_arms, clippy::fn_params_excessive_bools)]
13
14use alloc::string::String;
15use alloc::vec::Vec;
16
17use serde::{Deserialize, Serialize};
18
19use super::enums::*;
20use crate::validate::{self, Validate, ValidationPath, Violations};
21
22/// EV AC charging parameters for ISO 15118-2
23///
24/// The OCPP 2.1 `ACChargingParameters` data type.
25#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
26pub struct ACChargingParameters {
27    /// Amount of energy requested (in Wh). This includes energy required for preconditioning.
28    /// Relates to: +
29    /// *ISO 15118-2*: AC_EVChargeParameterType: EAmount +
30    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVTargetEnergyRequest
31    #[serde(rename = "energyAmount")]
32    pub energy_amount: crate::types::Decimal,
33    /// Minimum current (amps) supported by the electric vehicle (per phase).
34    /// Relates to: +
35    /// *ISO 15118-2*: AC_EVChargeParameterType: EVMinCurrent
36    #[serde(rename = "evMinCurrent")]
37    pub ev_min_current: crate::types::Decimal,
38    /// Maximum current (amps) supported by the electric vehicle (per phase). Includes cable capacity.
39    /// Relates to: +
40    /// *ISO 15118-2*: AC_EVChargeParameterType: EVMaxCurrent
41    #[serde(rename = "evMaxCurrent")]
42    pub ev_max_current: crate::types::Decimal,
43    /// Maximum voltage supported by the electric vehicle.
44    /// Relates to: +
45    /// *ISO 15118-2*: AC_EVChargeParameterType: EVMaxVoltage
46    #[serde(rename = "evMaxVoltage")]
47    pub ev_max_voltage: crate::types::Decimal,
48    /// The `customData` member.
49    #[serde(rename = "customData")]
50    #[serde(default, skip_serializing_if = "Option::is_none")]
51    pub custom_data: Option<crate::types::CustomData>,
52}
53
54impl ACChargingParameters {
55    /// Creates a `ACChargingParameters` from its required fields.
56    #[must_use]
57    pub fn new(
58        energy_amount: impl Into<crate::types::Decimal>,
59        ev_min_current: impl Into<crate::types::Decimal>,
60        ev_max_current: impl Into<crate::types::Decimal>,
61        ev_max_voltage: impl Into<crate::types::Decimal>,
62    ) -> Self {
63        Self {
64            energy_amount: energy_amount.into(),
65            ev_min_current: ev_min_current.into(),
66            ev_max_current: ev_max_current.into(),
67            ev_max_voltage: ev_max_voltage.into(),
68            custom_data: None,
69        }
70    }
71
72    /// Sets the optional `customData` field.
73    #[must_use]
74    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
75        self.custom_data = Some(value);
76        self
77    }
78}
79
80impl Validate for ACChargingParameters {
81    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
82        path.push_key("customData");
83        if let Some(value) = &self.custom_data {
84            Validate::validate_at(value, path, out);
85        }
86        path.pop();
87    }
88}
89
90/// Collection of configuration data needed to make a data-connection over a cellular network.
91///
92/// 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.
93///
94/// The OCPP 2.1 `APN` data type.
95#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
96pub struct APN {
97    /// The Access Point Name as an URL.
98    pub apn: String,
99    /// The `apnAuthentication` member.
100    #[serde(rename = "apnAuthentication")]
101    pub apn_authentication: APNAuthentication,
102    /// APN username.
103    #[serde(rename = "apnUserName")]
104    #[serde(default, skip_serializing_if = "Option::is_none")]
105    pub apn_user_name: Option<String>,
106    /// *(2.1)* APN Password.
107    #[serde(rename = "apnPassword")]
108    #[serde(default, skip_serializing_if = "Option::is_none")]
109    pub apn_password: Option<String>,
110    /// SIM card pin code.
111    #[serde(rename = "simPin")]
112    #[serde(default, skip_serializing_if = "Option::is_none")]
113    pub sim_pin: Option<i32>,
114    /// Preferred network, written as MCC and MNC concatenated. See note.
115    #[serde(rename = "preferredNetwork")]
116    #[serde(default, skip_serializing_if = "Option::is_none")]
117    pub preferred_network: Option<String>,
118    /// Default: false. Use only the preferred Network, do
119    /// not dial in when not available. See Note.
120    /// Schema default: `false`.
121    #[serde(rename = "useOnlyPreferredNetwork")]
122    #[serde(default, skip_serializing_if = "Option::is_none")]
123    pub use_only_preferred_network: Option<bool>,
124    /// The `customData` member.
125    #[serde(rename = "customData")]
126    #[serde(default, skip_serializing_if = "Option::is_none")]
127    pub custom_data: Option<crate::types::CustomData>,
128}
129
130impl APN {
131    /// Creates a `APN` from its required fields.
132    #[must_use]
133    pub fn new(apn: impl Into<String>, apn_authentication: APNAuthentication) -> Self {
134        Self {
135            apn: apn.into(),
136            apn_authentication,
137            apn_user_name: None,
138            apn_password: None,
139            sim_pin: None,
140            preferred_network: None,
141            use_only_preferred_network: None,
142            custom_data: None,
143        }
144    }
145
146    /// Sets the optional `apnUserName` field.
147    #[must_use]
148    pub fn with_apn_user_name(mut self, value: impl Into<String>) -> Self {
149        self.apn_user_name = Some(value.into());
150        self
151    }
152
153    /// Sets the optional `apnPassword` field.
154    #[must_use]
155    pub fn with_apn_password(mut self, value: impl Into<String>) -> Self {
156        self.apn_password = Some(value.into());
157        self
158    }
159
160    /// Sets the optional `simPin` field.
161    #[must_use]
162    pub fn with_sim_pin(mut self, value: i32) -> Self {
163        self.sim_pin = Some(value);
164        self
165    }
166
167    /// Sets the optional `preferredNetwork` field.
168    #[must_use]
169    pub fn with_preferred_network(mut self, value: impl Into<String>) -> Self {
170        self.preferred_network = Some(value.into());
171        self
172    }
173
174    /// Sets the optional `useOnlyPreferredNetwork` field.
175    #[must_use]
176    pub fn with_use_only_preferred_network(mut self, value: bool) -> Self {
177        self.use_only_preferred_network = Some(value);
178        self
179    }
180
181    /// Sets the optional `customData` field.
182    #[must_use]
183    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
184        self.custom_data = Some(value);
185        self
186    }
187}
188
189impl Validate for APN {
190    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
191        path.push_key("apn");
192        validate::string(self.apn.as_str(), None, Some(2000), path, out);
193        path.pop();
194        path.push_key("apnAuthentication");
195        Validate::validate_at(&self.apn_authentication, path, out);
196        path.pop();
197        path.push_key("apnUserName");
198        if let Some(value) = &self.apn_user_name {
199            validate::string(value.as_str(), None, Some(50), path, out);
200        }
201        path.pop();
202        path.push_key("apnPassword");
203        if let Some(value) = &self.apn_password {
204            validate::string(value.as_str(), None, Some(64), path, out);
205        }
206        path.pop();
207        path.push_key("preferredNetwork");
208        if let Some(value) = &self.preferred_network {
209            validate::string(value.as_str(), None, Some(6), path, out);
210        }
211        path.pop();
212        path.push_key("customData");
213        if let Some(value) = &self.custom_data {
214            Validate::validate_at(value, path, out);
215        }
216        path.pop();
217    }
218}
219
220/// The AbsolutePriceScheduleType is modeled after the same type that is defined in ISO 15118-20, such that if it is supplied by an EMSP as a signed EXI message, the conversion from EXI to JSON (in OCPP) and back to EXI (for ISO 15118-20) does not change the digest and therefore does not invalidate the signature.
221///
222/// image::images/AbsolutePriceSchedule-Simple.png\[\]
223///
224/// The OCPP 2.1 `AbsolutePriceSchedule` data type.
225#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
226pub struct AbsolutePriceSchedule {
227    /// Starting point of price schedule.
228    #[serde(rename = "timeAnchor")]
229    pub time_anchor: crate::types::DateTime,
230    /// Unique ID of price schedule
231    #[serde(rename = "priceScheduleID")]
232    pub price_schedule_id: i32,
233    /// Currency according to ISO 4217.
234    pub currency: String,
235    /// String that indicates what language is used for the human readable strings in the price schedule. Based on ISO 639.
236    pub language: String,
237    /// A string in URN notation which shall uniquely identify an algorithm that defines how to compute an energy fee sum for a specific power profile based on the EnergyFee information from the PriceRule elements.
238    #[serde(rename = "priceAlgorithm")]
239    pub price_algorithm: String,
240    /// The `priceRuleStacks` member.
241    #[serde(rename = "priceRuleStacks")]
242    pub price_rule_stacks: Vec<PriceRuleStack>,
243    /// Description of the price schedule.
244    #[serde(rename = "priceScheduleDescription")]
245    #[serde(default, skip_serializing_if = "Option::is_none")]
246    pub price_schedule_description: Option<String>,
247    /// The `minimumCost` member.
248    #[serde(rename = "minimumCost")]
249    #[serde(default, skip_serializing_if = "Option::is_none")]
250    pub minimum_cost: Option<RationalNumber>,
251    /// The `maximumCost` member.
252    #[serde(rename = "maximumCost")]
253    #[serde(default, skip_serializing_if = "Option::is_none")]
254    pub maximum_cost: Option<RationalNumber>,
255    /// The `taxRules` member.
256    #[serde(rename = "taxRules")]
257    #[serde(default, skip_serializing_if = "Option::is_none")]
258    pub tax_rules: Option<Vec<TaxRule>>,
259    /// The `overstayRuleList` member.
260    #[serde(rename = "overstayRuleList")]
261    #[serde(default, skip_serializing_if = "Option::is_none")]
262    pub overstay_rule_list: Option<OverstayRuleList>,
263    /// The `additionalSelectedServices` member.
264    #[serde(rename = "additionalSelectedServices")]
265    #[serde(default, skip_serializing_if = "Option::is_none")]
266    pub additional_selected_services: Option<Vec<AdditionalSelectedServices>>,
267    /// The `customData` member.
268    #[serde(rename = "customData")]
269    #[serde(default, skip_serializing_if = "Option::is_none")]
270    pub custom_data: Option<crate::types::CustomData>,
271}
272
273impl AbsolutePriceSchedule {
274    /// Creates a `AbsolutePriceSchedule` from its required fields.
275    #[must_use]
276    pub fn new(
277        time_anchor: impl Into<crate::types::DateTime>,
278        price_schedule_id: i32,
279        currency: impl Into<String>,
280        language: impl Into<String>,
281        price_algorithm: impl Into<String>,
282        price_rule_stacks: Vec<PriceRuleStack>,
283    ) -> Self {
284        Self {
285            time_anchor: time_anchor.into(),
286            price_schedule_id,
287            currency: currency.into(),
288            language: language.into(),
289            price_algorithm: price_algorithm.into(),
290            price_rule_stacks,
291            price_schedule_description: None,
292            minimum_cost: None,
293            maximum_cost: None,
294            tax_rules: None,
295            overstay_rule_list: None,
296            additional_selected_services: None,
297            custom_data: None,
298        }
299    }
300
301    /// Sets the optional `priceScheduleDescription` field.
302    #[must_use]
303    pub fn with_price_schedule_description(mut self, value: impl Into<String>) -> Self {
304        self.price_schedule_description = Some(value.into());
305        self
306    }
307
308    /// Sets the optional `minimumCost` field.
309    #[must_use]
310    pub fn with_minimum_cost(mut self, value: RationalNumber) -> Self {
311        self.minimum_cost = Some(value);
312        self
313    }
314
315    /// Sets the optional `maximumCost` field.
316    #[must_use]
317    pub fn with_maximum_cost(mut self, value: RationalNumber) -> Self {
318        self.maximum_cost = Some(value);
319        self
320    }
321
322    /// Sets the optional `taxRules` field.
323    #[must_use]
324    pub fn with_tax_rules(mut self, value: Vec<TaxRule>) -> Self {
325        self.tax_rules = Some(value);
326        self
327    }
328
329    /// Sets the optional `overstayRuleList` field.
330    #[must_use]
331    pub fn with_overstay_rule_list(mut self, value: OverstayRuleList) -> Self {
332        self.overstay_rule_list = Some(value);
333        self
334    }
335
336    /// Sets the optional `additionalSelectedServices` field.
337    #[must_use]
338    pub fn with_additional_selected_services(
339        mut self,
340        value: Vec<AdditionalSelectedServices>,
341    ) -> Self {
342        self.additional_selected_services = Some(value);
343        self
344    }
345
346    /// Sets the optional `customData` field.
347    #[must_use]
348    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
349        self.custom_data = Some(value);
350        self
351    }
352}
353
354impl Validate for AbsolutePriceSchedule {
355    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
356        path.push_key("priceScheduleID");
357        validate::int_range(
358            i64::from(self.price_schedule_id),
359            Some(0.0),
360            None,
361            path,
362            out,
363        );
364        path.pop();
365        path.push_key("currency");
366        validate::string(self.currency.as_str(), None, Some(3), path, out);
367        path.pop();
368        path.push_key("language");
369        validate::string(self.language.as_str(), None, Some(8), path, out);
370        path.pop();
371        path.push_key("priceAlgorithm");
372        validate::string(self.price_algorithm.as_str(), None, Some(2000), path, out);
373        path.pop();
374        path.push_key("priceRuleStacks");
375        validate::list_len(self.price_rule_stacks.len(), Some(1), Some(1024), path, out);
376        for (index, item) in self.price_rule_stacks.iter().enumerate() {
377            path.push_index(index);
378            Validate::validate_at(item, path, out);
379            path.pop();
380        }
381        path.pop();
382        path.push_key("priceScheduleDescription");
383        if let Some(value) = &self.price_schedule_description {
384            validate::string(value.as_str(), None, Some(160), path, out);
385        }
386        path.pop();
387        path.push_key("minimumCost");
388        if let Some(value) = &self.minimum_cost {
389            Validate::validate_at(value, path, out);
390        }
391        path.pop();
392        path.push_key("maximumCost");
393        if let Some(value) = &self.maximum_cost {
394            Validate::validate_at(value, path, out);
395        }
396        path.pop();
397        path.push_key("taxRules");
398        if let Some(value) = &self.tax_rules {
399            validate::list_len(value.len(), Some(1), Some(10), path, out);
400            for (index, item) in value.iter().enumerate() {
401                path.push_index(index);
402                Validate::validate_at(item, path, out);
403                path.pop();
404            }
405        }
406        path.pop();
407        path.push_key("overstayRuleList");
408        if let Some(value) = &self.overstay_rule_list {
409            Validate::validate_at(value, path, out);
410        }
411        path.pop();
412        path.push_key("additionalSelectedServices");
413        if let Some(value) = &self.additional_selected_services {
414            validate::list_len(value.len(), Some(1), Some(5), path, out);
415            for (index, item) in value.iter().enumerate() {
416                path.push_index(index);
417                Validate::validate_at(item, path, out);
418                path.pop();
419            }
420        }
421        path.pop();
422        path.push_key("customData");
423        if let Some(value) = &self.custom_data {
424            Validate::validate_at(value, path, out);
425        }
426        path.pop();
427    }
428}
429
430/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
431///
432/// The OCPP 2.1 `AdditionalInfo` data type.
433#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
434pub struct AdditionalInfo {
435    /// *(2.1)* This field specifies the additional IdToken.
436    #[serde(rename = "additionalIdToken")]
437    pub additional_id_token: String,
438    /// _additionalInfo_ can be used to send extra information to CSMS in addition to the regular authorization with _IdToken_. _AdditionalInfo_ contains one or more custom _types_, which need to be agreed upon by all parties involved. When the _type_ is not supported, the CSMS/Charging Station MAY ignore the _additionalInfo_.
439    pub r#type: String,
440    /// The `customData` member.
441    #[serde(rename = "customData")]
442    #[serde(default, skip_serializing_if = "Option::is_none")]
443    pub custom_data: Option<crate::types::CustomData>,
444}
445
446impl AdditionalInfo {
447    /// Creates a `AdditionalInfo` from its required fields.
448    #[must_use]
449    pub fn new(additional_id_token: impl Into<String>, r#type: impl Into<String>) -> Self {
450        Self {
451            additional_id_token: additional_id_token.into(),
452            r#type: r#type.into(),
453            custom_data: None,
454        }
455    }
456
457    /// Sets the optional `customData` field.
458    #[must_use]
459    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
460        self.custom_data = Some(value);
461        self
462    }
463}
464
465impl Validate for AdditionalInfo {
466    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
467        path.push_key("additionalIdToken");
468        validate::string(
469            self.additional_id_token.as_str(),
470            None,
471            Some(255),
472            path,
473            out,
474        );
475        path.pop();
476        path.push_key("type");
477        validate::string(self.r#type.as_str(), None, Some(50), path, out);
478        path.pop();
479        path.push_key("customData");
480        if let Some(value) = &self.custom_data {
481            Validate::validate_at(value, path, out);
482        }
483        path.pop();
484    }
485}
486
487/// Part of ISO 15118-20 price schedule.
488///
489/// The OCPP 2.1 `AdditionalSelectedServices` data type.
490#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
491pub struct AdditionalSelectedServices {
492    /// The `serviceFee` member.
493    #[serde(rename = "serviceFee")]
494    pub service_fee: RationalNumber,
495    /// Human readable string to identify this service.
496    #[serde(rename = "serviceName")]
497    pub service_name: String,
498    /// The `customData` member.
499    #[serde(rename = "customData")]
500    #[serde(default, skip_serializing_if = "Option::is_none")]
501    pub custom_data: Option<crate::types::CustomData>,
502}
503
504impl AdditionalSelectedServices {
505    /// Creates a `AdditionalSelectedServices` from its required fields.
506    #[must_use]
507    pub fn new(service_fee: RationalNumber, service_name: impl Into<String>) -> Self {
508        Self {
509            service_fee,
510            service_name: service_name.into(),
511            custom_data: None,
512        }
513    }
514
515    /// Sets the optional `customData` field.
516    #[must_use]
517    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
518        self.custom_data = Some(value);
519        self
520    }
521}
522
523impl Validate for AdditionalSelectedServices {
524    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
525        path.push_key("serviceFee");
526        Validate::validate_at(&self.service_fee, path, out);
527        path.pop();
528        path.push_key("serviceName");
529        validate::string(self.service_name.as_str(), None, Some(80), path, out);
530        path.pop();
531        path.push_key("customData");
532        if let Some(value) = &self.custom_data {
533            Validate::validate_at(value, path, out);
534        }
535        path.pop();
536    }
537}
538
539/// *(2.1)* A generic address format.
540///
541/// The OCPP 2.1 `Address` data type.
542#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
543pub struct Address {
544    /// Name of person/company
545    pub name: String,
546    /// Address line 1
547    pub address1: String,
548    /// City
549    pub city: String,
550    /// Country name
551    pub country: String,
552    /// Address line 2
553    #[serde(default, skip_serializing_if = "Option::is_none")]
554    pub address2: Option<String>,
555    /// Postal code
556    #[serde(rename = "postalCode")]
557    #[serde(default, skip_serializing_if = "Option::is_none")]
558    pub postal_code: Option<String>,
559    /// The `customData` member.
560    #[serde(rename = "customData")]
561    #[serde(default, skip_serializing_if = "Option::is_none")]
562    pub custom_data: Option<crate::types::CustomData>,
563}
564
565impl Address {
566    /// Creates a `Address` from its required fields.
567    #[must_use]
568    pub fn new(
569        name: impl Into<String>,
570        address1: impl Into<String>,
571        city: impl Into<String>,
572        country: impl Into<String>,
573    ) -> Self {
574        Self {
575            name: name.into(),
576            address1: address1.into(),
577            city: city.into(),
578            country: country.into(),
579            address2: None,
580            postal_code: None,
581            custom_data: None,
582        }
583    }
584
585    /// Sets the optional `address2` field.
586    #[must_use]
587    pub fn with_address2(mut self, value: impl Into<String>) -> Self {
588        self.address2 = Some(value.into());
589        self
590    }
591
592    /// Sets the optional `postalCode` field.
593    #[must_use]
594    pub fn with_postal_code(mut self, value: impl Into<String>) -> Self {
595        self.postal_code = Some(value.into());
596        self
597    }
598
599    /// Sets the optional `customData` field.
600    #[must_use]
601    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
602        self.custom_data = Some(value);
603        self
604    }
605}
606
607impl Validate for Address {
608    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
609        path.push_key("name");
610        validate::string(self.name.as_str(), None, Some(50), path, out);
611        path.pop();
612        path.push_key("address1");
613        validate::string(self.address1.as_str(), None, Some(100), path, out);
614        path.pop();
615        path.push_key("city");
616        validate::string(self.city.as_str(), None, Some(100), path, out);
617        path.pop();
618        path.push_key("country");
619        validate::string(self.country.as_str(), None, Some(50), path, out);
620        path.pop();
621        path.push_key("address2");
622        if let Some(value) = &self.address2 {
623            validate::string(value.as_str(), None, Some(100), path, out);
624        }
625        path.pop();
626        path.push_key("postalCode");
627        if let Some(value) = &self.postal_code {
628            validate::string(value.as_str(), None, Some(20), path, out);
629        }
630        path.pop();
631        path.push_key("customData");
632        if let Some(value) = &self.custom_data {
633            Validate::validate_at(value, path, out);
634        }
635        path.pop();
636    }
637}
638
639/// Contains the identifier to use for authorization.
640///
641/// The OCPP 2.1 `AuthorizationData` data type.
642#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
643pub struct AuthorizationData {
644    /// The `idToken` member.
645    #[serde(rename = "idToken")]
646    pub id_token: IdToken,
647    /// The `idTokenInfo` member.
648    #[serde(rename = "idTokenInfo")]
649    #[serde(default, skip_serializing_if = "Option::is_none")]
650    pub id_token_info: Option<IdTokenInfo>,
651    /// The `customData` member.
652    #[serde(rename = "customData")]
653    #[serde(default, skip_serializing_if = "Option::is_none")]
654    pub custom_data: Option<crate::types::CustomData>,
655}
656
657impl AuthorizationData {
658    /// Creates a `AuthorizationData` from its required fields.
659    #[must_use]
660    pub fn new(id_token: IdToken) -> Self {
661        Self {
662            id_token,
663            id_token_info: None,
664            custom_data: None,
665        }
666    }
667
668    /// Sets the optional `idTokenInfo` field.
669    #[must_use]
670    pub fn with_id_token_info(mut self, value: IdTokenInfo) -> Self {
671        self.id_token_info = Some(value);
672        self
673    }
674
675    /// Sets the optional `customData` field.
676    #[must_use]
677    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
678        self.custom_data = Some(value);
679        self
680    }
681}
682
683impl Validate for AuthorizationData {
684    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
685        path.push_key("idToken");
686        Validate::validate_at(&self.id_token, path, out);
687        path.pop();
688        path.push_key("idTokenInfo");
689        if let Some(value) = &self.id_token_info {
690            Validate::validate_at(value, path, out);
691        }
692        path.pop();
693        path.push_key("customData");
694        if let Some(value) = &self.custom_data {
695            Validate::validate_at(value, path, out);
696        }
697        path.pop();
698    }
699}
700
701/// The OCPP 2.1 `BatteryData` data type.
702#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
703pub struct BatteryData {
704    /// Slot number where battery is inserted or removed.
705    #[serde(rename = "evseId")]
706    pub evse_id: i32,
707    /// Serial number of battery.
708    #[serde(rename = "serialNumber")]
709    pub serial_number: String,
710    /// State of charge
711    #[serde(rename = "soC")]
712    pub so_c: crate::types::Decimal,
713    /// State of health
714    #[serde(rename = "soH")]
715    pub so_h: crate::types::Decimal,
716    /// Production date of battery.
717    #[serde(rename = "productionDate")]
718    #[serde(default, skip_serializing_if = "Option::is_none")]
719    pub production_date: Option<crate::types::DateTime>,
720    /// Vendor-specific info from battery in undefined format.
721    #[serde(rename = "vendorInfo")]
722    #[serde(default, skip_serializing_if = "Option::is_none")]
723    pub vendor_info: Option<String>,
724    /// The `customData` member.
725    #[serde(rename = "customData")]
726    #[serde(default, skip_serializing_if = "Option::is_none")]
727    pub custom_data: Option<crate::types::CustomData>,
728}
729
730impl BatteryData {
731    /// Creates a `BatteryData` from its required fields.
732    #[must_use]
733    pub fn new(
734        evse_id: i32,
735        serial_number: impl Into<String>,
736        so_c: impl Into<crate::types::Decimal>,
737        so_h: impl Into<crate::types::Decimal>,
738    ) -> Self {
739        Self {
740            evse_id,
741            serial_number: serial_number.into(),
742            so_c: so_c.into(),
743            so_h: so_h.into(),
744            production_date: None,
745            vendor_info: None,
746            custom_data: None,
747        }
748    }
749
750    /// Sets the optional `productionDate` field.
751    #[must_use]
752    pub fn with_production_date(mut self, value: impl Into<crate::types::DateTime>) -> Self {
753        self.production_date = Some(value.into());
754        self
755    }
756
757    /// Sets the optional `vendorInfo` field.
758    #[must_use]
759    pub fn with_vendor_info(mut self, value: impl Into<String>) -> Self {
760        self.vendor_info = Some(value.into());
761        self
762    }
763
764    /// Sets the optional `customData` field.
765    #[must_use]
766    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
767        self.custom_data = Some(value);
768        self
769    }
770}
771
772impl Validate for BatteryData {
773    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
774        path.push_key("evseId");
775        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
776        path.pop();
777        path.push_key("serialNumber");
778        validate::string(self.serial_number.as_str(), None, Some(50), path, out);
779        path.pop();
780        path.push_key("soC");
781        validate::range(self.so_c.get(), Some(0.0), Some(100.0), path, out);
782        path.pop();
783        path.push_key("soH");
784        validate::range(self.so_h.get(), Some(0.0), Some(100.0), path, out);
785        path.pop();
786        path.push_key("vendorInfo");
787        if let Some(value) = &self.vendor_info {
788            validate::string(value.as_str(), None, Some(500), path, out);
789        }
790        path.pop();
791        path.push_key("customData");
792        if let Some(value) = &self.custom_data {
793            Validate::validate_at(value, path, out);
794        }
795        path.pop();
796    }
797}
798
799/// The OCPP 2.1 `CertificateHashData` data type.
800#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
801pub struct CertificateHashData {
802    /// The `hashAlgorithm` member.
803    #[serde(rename = "hashAlgorithm")]
804    pub hash_algorithm: HashAlgorithm,
805    /// The hash of the issuer’s distinguished
806    /// name (DN), that must be calculated over the DER
807    /// encoding of the issuer’s name field in the certificate
808    /// being checked.
809    #[serde(rename = "issuerNameHash")]
810    pub issuer_name_hash: String,
811    /// The hash of the DER encoded public key:
812    /// the value (excluding tag and length) of the subject
813    /// public key field in the issuer’s certificate.
814    #[serde(rename = "issuerKeyHash")]
815    pub issuer_key_hash: String,
816    /// The string representation of the
817    /// hexadecimal value of the serial number without the
818    /// prefix "0x" and without leading zeroes.
819    #[serde(rename = "serialNumber")]
820    pub serial_number: String,
821    /// The `customData` member.
822    #[serde(rename = "customData")]
823    #[serde(default, skip_serializing_if = "Option::is_none")]
824    pub custom_data: Option<crate::types::CustomData>,
825}
826
827impl CertificateHashData {
828    /// Creates a `CertificateHashData` from its required fields.
829    #[must_use]
830    pub fn new(
831        hash_algorithm: HashAlgorithm,
832        issuer_name_hash: impl Into<String>,
833        issuer_key_hash: impl Into<String>,
834        serial_number: impl Into<String>,
835    ) -> Self {
836        Self {
837            hash_algorithm,
838            issuer_name_hash: issuer_name_hash.into(),
839            issuer_key_hash: issuer_key_hash.into(),
840            serial_number: serial_number.into(),
841            custom_data: None,
842        }
843    }
844
845    /// Sets the optional `customData` field.
846    #[must_use]
847    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
848        self.custom_data = Some(value);
849        self
850    }
851}
852
853impl Validate for CertificateHashData {
854    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
855        path.push_key("hashAlgorithm");
856        Validate::validate_at(&self.hash_algorithm, path, out);
857        path.pop();
858        path.push_key("issuerNameHash");
859        validate::string(self.issuer_name_hash.as_str(), None, Some(128), path, out);
860        path.pop();
861        path.push_key("issuerKeyHash");
862        validate::string(self.issuer_key_hash.as_str(), None, Some(128), path, out);
863        path.pop();
864        path.push_key("serialNumber");
865        validate::string(self.serial_number.as_str(), None, Some(40), path, out);
866        path.pop();
867        path.push_key("customData");
868        if let Some(value) = &self.custom_data {
869            Validate::validate_at(value, path, out);
870        }
871        path.pop();
872    }
873}
874
875/// The OCPP 2.1 `CertificateHashDataChain` data type.
876#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
877pub struct CertificateHashDataChain {
878    /// The `certificateHashData` member.
879    #[serde(rename = "certificateHashData")]
880    pub certificate_hash_data: CertificateHashData,
881    /// The `certificateType` member.
882    #[serde(rename = "certificateType")]
883    pub certificate_type: GetCertificateIdUse,
884    /// The `childCertificateHashData` member.
885    #[serde(rename = "childCertificateHashData")]
886    #[serde(default, skip_serializing_if = "Option::is_none")]
887    pub child_certificate_hash_data: Option<Vec<CertificateHashData>>,
888    /// The `customData` member.
889    #[serde(rename = "customData")]
890    #[serde(default, skip_serializing_if = "Option::is_none")]
891    pub custom_data: Option<crate::types::CustomData>,
892}
893
894impl CertificateHashDataChain {
895    /// Creates a `CertificateHashDataChain` from its required fields.
896    #[must_use]
897    pub fn new(
898        certificate_hash_data: CertificateHashData,
899        certificate_type: GetCertificateIdUse,
900    ) -> Self {
901        Self {
902            certificate_hash_data,
903            certificate_type,
904            child_certificate_hash_data: None,
905            custom_data: None,
906        }
907    }
908
909    /// Sets the optional `childCertificateHashData` field.
910    #[must_use]
911    pub fn with_child_certificate_hash_data(mut self, value: Vec<CertificateHashData>) -> Self {
912        self.child_certificate_hash_data = Some(value);
913        self
914    }
915
916    /// Sets the optional `customData` field.
917    #[must_use]
918    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
919        self.custom_data = Some(value);
920        self
921    }
922}
923
924impl Validate for CertificateHashDataChain {
925    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
926        path.push_key("certificateHashData");
927        Validate::validate_at(&self.certificate_hash_data, path, out);
928        path.pop();
929        path.push_key("certificateType");
930        Validate::validate_at(&self.certificate_type, path, out);
931        path.pop();
932        path.push_key("childCertificateHashData");
933        if let Some(value) = &self.child_certificate_hash_data {
934            validate::list_len(value.len(), Some(1), Some(4), path, out);
935            for (index, item) in value.iter().enumerate() {
936                path.push_index(index);
937                Validate::validate_at(item, path, out);
938                path.pop();
939            }
940        }
941        path.pop();
942        path.push_key("customData");
943        if let Some(value) = &self.custom_data {
944            Validate::validate_at(value, path, out);
945        }
946        path.pop();
947    }
948}
949
950/// Revocation status of certificate
951///
952/// The OCPP 2.1 `CertificateStatus` data type.
953#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
954pub struct CertificateStatus {
955    /// The `certificateHashData` member.
956    #[serde(rename = "certificateHashData")]
957    pub certificate_hash_data: CertificateHashData,
958    /// The `source` member.
959    pub source: CertificateStatusSource,
960    /// The `status` member.
961    pub status: CertificateStatusEnum,
962    /// The `nextUpdate` member.
963    #[serde(rename = "nextUpdate")]
964    pub next_update: crate::types::DateTime,
965    /// The `customData` member.
966    #[serde(rename = "customData")]
967    #[serde(default, skip_serializing_if = "Option::is_none")]
968    pub custom_data: Option<crate::types::CustomData>,
969}
970
971impl CertificateStatus {
972    /// Creates a `CertificateStatus` from its required fields.
973    #[must_use]
974    pub fn new(
975        certificate_hash_data: CertificateHashData,
976        source: CertificateStatusSource,
977        status: CertificateStatusEnum,
978        next_update: impl Into<crate::types::DateTime>,
979    ) -> Self {
980        Self {
981            certificate_hash_data,
982            source,
983            status,
984            next_update: next_update.into(),
985            custom_data: None,
986        }
987    }
988
989    /// Sets the optional `customData` field.
990    #[must_use]
991    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
992        self.custom_data = Some(value);
993        self
994    }
995}
996
997impl Validate for CertificateStatus {
998    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
999        path.push_key("certificateHashData");
1000        Validate::validate_at(&self.certificate_hash_data, path, out);
1001        path.pop();
1002        path.push_key("source");
1003        Validate::validate_at(&self.source, path, out);
1004        path.pop();
1005        path.push_key("status");
1006        Validate::validate_at(&self.status, path, out);
1007        path.pop();
1008        path.push_key("customData");
1009        if let Some(value) = &self.custom_data {
1010            Validate::validate_at(value, path, out);
1011        }
1012        path.pop();
1013    }
1014}
1015
1016/// Data necessary to request the revocation status of a certificate.
1017///
1018/// The OCPP 2.1 `CertificateStatusRequestInfo` data type.
1019#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1020pub struct CertificateStatusRequestInfo {
1021    /// The `certificateHashData` member.
1022    #[serde(rename = "certificateHashData")]
1023    pub certificate_hash_data: CertificateHashData,
1024    /// The `source` member.
1025    pub source: CertificateStatusSource,
1026    /// URL(s) of _source_.
1027    pub urls: Vec<String>,
1028    /// The `customData` member.
1029    #[serde(rename = "customData")]
1030    #[serde(default, skip_serializing_if = "Option::is_none")]
1031    pub custom_data: Option<crate::types::CustomData>,
1032}
1033
1034impl CertificateStatusRequestInfo {
1035    /// Creates a `CertificateStatusRequestInfo` from its required fields.
1036    #[must_use]
1037    pub fn new(
1038        certificate_hash_data: CertificateHashData,
1039        source: CertificateStatusSource,
1040        urls: impl IntoIterator<Item = impl Into<String>>,
1041    ) -> Self {
1042        Self {
1043            certificate_hash_data,
1044            source,
1045            urls: urls.into_iter().map(Into::into).collect(),
1046            custom_data: None,
1047        }
1048    }
1049
1050    /// Sets the optional `customData` field.
1051    #[must_use]
1052    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1053        self.custom_data = Some(value);
1054        self
1055    }
1056}
1057
1058impl Validate for CertificateStatusRequestInfo {
1059    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1060        path.push_key("certificateHashData");
1061        Validate::validate_at(&self.certificate_hash_data, path, out);
1062        path.pop();
1063        path.push_key("source");
1064        Validate::validate_at(&self.source, path, out);
1065        path.pop();
1066        path.push_key("urls");
1067        validate::list_len(self.urls.len(), Some(1), Some(5), path, out);
1068        for (index, item) in self.urls.iter().enumerate() {
1069            path.push_index(index);
1070            validate::string(item.as_str(), None, Some(2000), path, out);
1071            path.pop();
1072        }
1073        path.pop();
1074        path.push_key("customData");
1075        if let Some(value) = &self.custom_data {
1076            Validate::validate_at(value, path, out);
1077        }
1078        path.pop();
1079    }
1080}
1081
1082/// The OCPP 2.1 `ChargingLimit` data type.
1083#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1084pub struct ChargingLimit {
1085    /// Represents the source of the charging limit. Values defined in appendix as ChargingLimitSourceEnumStringType.
1086    #[serde(rename = "chargingLimitSource")]
1087    pub charging_limit_source: String,
1088    /// *(2.1)* True when the reported limit concerns local generation that is providing extra capacity, instead of a limitation.
1089    #[serde(rename = "isLocalGeneration")]
1090    #[serde(default, skip_serializing_if = "Option::is_none")]
1091    pub is_local_generation: Option<bool>,
1092    /// Indicates whether the charging limit is critical for the grid.
1093    #[serde(rename = "isGridCritical")]
1094    #[serde(default, skip_serializing_if = "Option::is_none")]
1095    pub is_grid_critical: Option<bool>,
1096    /// The `customData` member.
1097    #[serde(rename = "customData")]
1098    #[serde(default, skip_serializing_if = "Option::is_none")]
1099    pub custom_data: Option<crate::types::CustomData>,
1100}
1101
1102impl ChargingLimit {
1103    /// Creates a `ChargingLimit` from its required fields.
1104    #[must_use]
1105    pub fn new(charging_limit_source: impl Into<String>) -> Self {
1106        Self {
1107            charging_limit_source: charging_limit_source.into(),
1108            is_local_generation: None,
1109            is_grid_critical: None,
1110            custom_data: None,
1111        }
1112    }
1113
1114    /// Sets the optional `isLocalGeneration` field.
1115    #[must_use]
1116    pub fn with_is_local_generation(mut self, value: bool) -> Self {
1117        self.is_local_generation = Some(value);
1118        self
1119    }
1120
1121    /// Sets the optional `isGridCritical` field.
1122    #[must_use]
1123    pub fn with_is_grid_critical(mut self, value: bool) -> Self {
1124        self.is_grid_critical = Some(value);
1125        self
1126    }
1127
1128    /// Sets the optional `customData` field.
1129    #[must_use]
1130    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1131        self.custom_data = Some(value);
1132        self
1133    }
1134}
1135
1136impl Validate for ChargingLimit {
1137    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1138        path.push_key("chargingLimitSource");
1139        validate::string(
1140            self.charging_limit_source.as_str(),
1141            None,
1142            Some(20),
1143            path,
1144            out,
1145        );
1146        path.pop();
1147        path.push_key("customData");
1148        if let Some(value) = &self.custom_data {
1149            Validate::validate_at(value, path, out);
1150        }
1151        path.pop();
1152    }
1153}
1154
1155/// The OCPP 2.1 `ChargingNeeds` data type.
1156#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1157pub struct ChargingNeeds {
1158    /// The `requestedEnergyTransfer` member.
1159    #[serde(rename = "requestedEnergyTransfer")]
1160    pub requested_energy_transfer: EnergyTransferMode,
1161    /// The `acChargingParameters` member.
1162    #[serde(rename = "acChargingParameters")]
1163    #[serde(default, skip_serializing_if = "Option::is_none")]
1164    pub ac_charging_parameters: Option<ACChargingParameters>,
1165    /// The `derChargingParameters` member.
1166    #[serde(rename = "derChargingParameters")]
1167    #[serde(default, skip_serializing_if = "Option::is_none")]
1168    pub der_charging_parameters: Option<DERChargingParameters>,
1169    /// The `evEnergyOffer` member.
1170    #[serde(rename = "evEnergyOffer")]
1171    #[serde(default, skip_serializing_if = "Option::is_none")]
1172    pub ev_energy_offer: Option<EVEnergyOffer>,
1173    /// The `dcChargingParameters` member.
1174    #[serde(rename = "dcChargingParameters")]
1175    #[serde(default, skip_serializing_if = "Option::is_none")]
1176    pub dc_charging_parameters: Option<DCChargingParameters>,
1177    /// The `v2xChargingParameters` member.
1178    #[serde(rename = "v2xChargingParameters")]
1179    #[serde(default, skip_serializing_if = "Option::is_none")]
1180    pub v2x_charging_parameters: Option<V2XChargingParameters>,
1181    /// *(2.1)* Modes of energy transfer that are marked as available by EV.
1182    #[serde(rename = "availableEnergyTransfer")]
1183    #[serde(default, skip_serializing_if = "Option::is_none")]
1184    pub available_energy_transfer: Option<Vec<EnergyTransferMode>>,
1185    /// The `controlMode` member.
1186    #[serde(rename = "controlMode")]
1187    #[serde(default, skip_serializing_if = "Option::is_none")]
1188    pub control_mode: Option<ControlMode>,
1189    /// The `mobilityNeedsMode` member.
1190    #[serde(rename = "mobilityNeedsMode")]
1191    #[serde(default, skip_serializing_if = "Option::is_none")]
1192    pub mobility_needs_mode: Option<MobilityNeedsMode>,
1193    /// Estimated departure time of the EV. +
1194    /// *ISO 15118-2:* AC/DC_EVChargeParameterType: DepartureTime +
1195    /// *ISO 15118-20:* Dynamic/Scheduled_SEReqControlModeType: DepartureTIme
1196    #[serde(rename = "departureTime")]
1197    #[serde(default, skip_serializing_if = "Option::is_none")]
1198    pub departure_time: Option<crate::types::DateTime>,
1199    /// The `customData` member.
1200    #[serde(rename = "customData")]
1201    #[serde(default, skip_serializing_if = "Option::is_none")]
1202    pub custom_data: Option<crate::types::CustomData>,
1203}
1204
1205impl ChargingNeeds {
1206    /// Creates a `ChargingNeeds` from its required fields.
1207    #[must_use]
1208    pub fn new(requested_energy_transfer: EnergyTransferMode) -> Self {
1209        Self {
1210            requested_energy_transfer,
1211            ac_charging_parameters: None,
1212            der_charging_parameters: None,
1213            ev_energy_offer: None,
1214            dc_charging_parameters: None,
1215            v2x_charging_parameters: None,
1216            available_energy_transfer: None,
1217            control_mode: None,
1218            mobility_needs_mode: None,
1219            departure_time: None,
1220            custom_data: None,
1221        }
1222    }
1223
1224    /// Sets the optional `acChargingParameters` field.
1225    #[must_use]
1226    pub fn with_ac_charging_parameters(mut self, value: ACChargingParameters) -> Self {
1227        self.ac_charging_parameters = Some(value);
1228        self
1229    }
1230
1231    /// Sets the optional `derChargingParameters` field.
1232    #[must_use]
1233    pub fn with_der_charging_parameters(mut self, value: DERChargingParameters) -> Self {
1234        self.der_charging_parameters = Some(value);
1235        self
1236    }
1237
1238    /// Sets the optional `evEnergyOffer` field.
1239    #[must_use]
1240    pub fn with_ev_energy_offer(mut self, value: EVEnergyOffer) -> Self {
1241        self.ev_energy_offer = Some(value);
1242        self
1243    }
1244
1245    /// Sets the optional `dcChargingParameters` field.
1246    #[must_use]
1247    pub fn with_dc_charging_parameters(mut self, value: DCChargingParameters) -> Self {
1248        self.dc_charging_parameters = Some(value);
1249        self
1250    }
1251
1252    /// Sets the optional `v2xChargingParameters` field.
1253    #[must_use]
1254    pub fn with_v2x_charging_parameters(mut self, value: V2XChargingParameters) -> Self {
1255        self.v2x_charging_parameters = Some(value);
1256        self
1257    }
1258
1259    /// Sets the optional `availableEnergyTransfer` field.
1260    #[must_use]
1261    pub fn with_available_energy_transfer(mut self, value: Vec<EnergyTransferMode>) -> Self {
1262        self.available_energy_transfer = Some(value);
1263        self
1264    }
1265
1266    /// Sets the optional `controlMode` field.
1267    #[must_use]
1268    pub fn with_control_mode(mut self, value: ControlMode) -> Self {
1269        self.control_mode = Some(value);
1270        self
1271    }
1272
1273    /// Sets the optional `mobilityNeedsMode` field.
1274    #[must_use]
1275    pub fn with_mobility_needs_mode(mut self, value: MobilityNeedsMode) -> Self {
1276        self.mobility_needs_mode = Some(value);
1277        self
1278    }
1279
1280    /// Sets the optional `departureTime` field.
1281    #[must_use]
1282    pub fn with_departure_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1283        self.departure_time = Some(value.into());
1284        self
1285    }
1286
1287    /// Sets the optional `customData` field.
1288    #[must_use]
1289    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1290        self.custom_data = Some(value);
1291        self
1292    }
1293}
1294
1295impl Validate for ChargingNeeds {
1296    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1297        path.push_key("requestedEnergyTransfer");
1298        Validate::validate_at(&self.requested_energy_transfer, path, out);
1299        path.pop();
1300        path.push_key("acChargingParameters");
1301        if let Some(value) = &self.ac_charging_parameters {
1302            Validate::validate_at(value, path, out);
1303        }
1304        path.pop();
1305        path.push_key("derChargingParameters");
1306        if let Some(value) = &self.der_charging_parameters {
1307            Validate::validate_at(value, path, out);
1308        }
1309        path.pop();
1310        path.push_key("evEnergyOffer");
1311        if let Some(value) = &self.ev_energy_offer {
1312            Validate::validate_at(value, path, out);
1313        }
1314        path.pop();
1315        path.push_key("dcChargingParameters");
1316        if let Some(value) = &self.dc_charging_parameters {
1317            Validate::validate_at(value, path, out);
1318        }
1319        path.pop();
1320        path.push_key("v2xChargingParameters");
1321        if let Some(value) = &self.v2x_charging_parameters {
1322            Validate::validate_at(value, path, out);
1323        }
1324        path.pop();
1325        path.push_key("availableEnergyTransfer");
1326        if let Some(value) = &self.available_energy_transfer {
1327            validate::list_len(value.len(), Some(1), None, path, out);
1328            for (index, item) in value.iter().enumerate() {
1329                path.push_index(index);
1330                Validate::validate_at(item, path, out);
1331                path.pop();
1332            }
1333        }
1334        path.pop();
1335        path.push_key("controlMode");
1336        if let Some(value) = &self.control_mode {
1337            Validate::validate_at(value, path, out);
1338        }
1339        path.pop();
1340        path.push_key("mobilityNeedsMode");
1341        if let Some(value) = &self.mobility_needs_mode {
1342            Validate::validate_at(value, path, out);
1343        }
1344        path.pop();
1345        path.push_key("customData");
1346        if let Some(value) = &self.custom_data {
1347            Validate::validate_at(value, path, out);
1348        }
1349        path.pop();
1350    }
1351}
1352
1353/// A ChargingPeriodType consists of a start time, and a list of possible values that influence this period, for example: amount of energy charged this period, maximum current during this period etc.
1354///
1355/// The OCPP 2.1 `ChargingPeriod` data type.
1356#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1357pub struct ChargingPeriod {
1358    /// Start timestamp of charging period. A period ends when the next period starts. The last period ends when the session ends.
1359    #[serde(rename = "startPeriod")]
1360    pub start_period: crate::types::DateTime,
1361    /// The `dimensions` member.
1362    #[serde(default, skip_serializing_if = "Option::is_none")]
1363    pub dimensions: Option<Vec<CostDimension>>,
1364    /// Unique identifier of the Tariff that was used to calculate cost. If not provided, then cost was calculated by some other means.
1365    #[serde(rename = "tariffId")]
1366    #[serde(default, skip_serializing_if = "Option::is_none")]
1367    pub tariff_id: Option<String>,
1368    /// The `customData` member.
1369    #[serde(rename = "customData")]
1370    #[serde(default, skip_serializing_if = "Option::is_none")]
1371    pub custom_data: Option<crate::types::CustomData>,
1372}
1373
1374impl ChargingPeriod {
1375    /// Creates a `ChargingPeriod` from its required fields.
1376    #[must_use]
1377    pub fn new(start_period: impl Into<crate::types::DateTime>) -> Self {
1378        Self {
1379            start_period: start_period.into(),
1380            dimensions: None,
1381            tariff_id: None,
1382            custom_data: None,
1383        }
1384    }
1385
1386    /// Sets the optional `dimensions` field.
1387    #[must_use]
1388    pub fn with_dimensions(mut self, value: Vec<CostDimension>) -> Self {
1389        self.dimensions = Some(value);
1390        self
1391    }
1392
1393    /// Sets the optional `tariffId` field.
1394    #[must_use]
1395    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
1396        self.tariff_id = Some(value.into());
1397        self
1398    }
1399
1400    /// Sets the optional `customData` field.
1401    #[must_use]
1402    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1403        self.custom_data = Some(value);
1404        self
1405    }
1406}
1407
1408impl Validate for ChargingPeriod {
1409    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1410        path.push_key("dimensions");
1411        if let Some(value) = &self.dimensions {
1412            validate::list_len(value.len(), Some(1), None, path, out);
1413            for (index, item) in value.iter().enumerate() {
1414                path.push_index(index);
1415                Validate::validate_at(item, path, out);
1416                path.pop();
1417            }
1418        }
1419        path.pop();
1420        path.push_key("tariffId");
1421        if let Some(value) = &self.tariff_id {
1422            validate::string(value.as_str(), None, Some(60), path, out);
1423        }
1424        path.pop();
1425        path.push_key("customData");
1426        if let Some(value) = &self.custom_data {
1427            Validate::validate_at(value, path, out);
1428        }
1429        path.pop();
1430    }
1431}
1432
1433/// A ChargingProfile consists of 1 to 3 ChargingSchedules with a list of ChargingSchedulePeriods, describing the amount of power or current that can be delivered per time interval.
1434///
1435/// image::images/ChargingProfile-Simple.png\[\]
1436///
1437/// The OCPP 2.1 `ChargingProfile` data type.
1438#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1439pub struct ChargingProfile {
1440    /// Id of ChargingProfile. Unique within charging station. Id can have a negative value. This is useful to distinguish charging profiles from an external actor (external constraints) from charging profiles received from CSMS.
1441    pub id: i32,
1442    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
1443    #[serde(rename = "stackLevel")]
1444    pub stack_level: i32,
1445    /// The `chargingProfilePurpose` member.
1446    #[serde(rename = "chargingProfilePurpose")]
1447    pub charging_profile_purpose: ChargingProfilePurpose,
1448    /// The `chargingProfileKind` member.
1449    #[serde(rename = "chargingProfileKind")]
1450    pub charging_profile_kind: ChargingProfileKind,
1451    /// The `chargingSchedule` member.
1452    #[serde(rename = "chargingSchedule")]
1453    pub charging_schedule: Vec<ChargingSchedule>,
1454    /// The `recurrencyKind` member.
1455    #[serde(rename = "recurrencyKind")]
1456    #[serde(default, skip_serializing_if = "Option::is_none")]
1457    pub recurrency_kind: Option<RecurrencyKind>,
1458    /// 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.
1459    #[serde(rename = "validFrom")]
1460    #[serde(default, skip_serializing_if = "Option::is_none")]
1461    pub valid_from: Option<crate::types::DateTime>,
1462    /// Point in time at which the profile stops to be valid. If absent, the profile is valid until it is replaced by another profile.
1463    #[serde(rename = "validTo")]
1464    #[serde(default, skip_serializing_if = "Option::is_none")]
1465    pub valid_to: Option<crate::types::DateTime>,
1466    /// SHALL only be included if ChargingProfilePurpose is set to TxProfile in a SetChargingProfileRequest. The transactionId is used to match the profile to a specific transaction.
1467    #[serde(rename = "transactionId")]
1468    #[serde(default, skip_serializing_if = "Option::is_none")]
1469    pub transaction_id: Option<String>,
1470    /// *(2.1)* Period in seconds that this charging profile remains valid after the Charging Station has gone offline. After this period the charging profile becomes invalid for as long as it is offline and the Charging Station reverts back to a valid profile with a lower stack level.
1471    /// If _invalidAfterOfflineDuration_ is true, then this charging profile will become permanently invalid.
1472    /// A value of 0 means that the charging profile is immediately invalid while offline. When the field is absent, then  no timeout applies and the charging profile remains valid when offline.
1473    #[serde(rename = "maxOfflineDuration")]
1474    #[serde(default, skip_serializing_if = "Option::is_none")]
1475    pub max_offline_duration: Option<i32>,
1476    /// *(2.1)* When set to true this charging profile will not be valid anymore after being offline for more than _maxOfflineDuration_. +
1477    ///     When absent defaults to false.
1478    #[serde(rename = "invalidAfterOfflineDuration")]
1479    #[serde(default, skip_serializing_if = "Option::is_none")]
1480    pub invalid_after_offline_duration: Option<bool>,
1481    /// *(2.1)*  Interval in seconds after receipt of last update, when to request a profile update by sending a PullDynamicScheduleUpdateRequest message.
1482    ///     A value of 0 or no value means that no update interval applies. +
1483    ///     Only relevant in a dynamic charging profile.
1484    #[serde(rename = "dynUpdateInterval")]
1485    #[serde(default, skip_serializing_if = "Option::is_none")]
1486    pub dyn_update_interval: Option<i32>,
1487    /// *(2.1)* Time at which limits or setpoints in this charging profile were last updated by a PullDynamicScheduleUpdateRequest or UpdateDynamicScheduleRequest or by an external actor. +
1488    ///     Only relevant in a dynamic charging profile.
1489    #[serde(rename = "dynUpdateTime")]
1490    #[serde(default, skip_serializing_if = "Option::is_none")]
1491    pub dyn_update_time: Option<crate::types::DateTime>,
1492    /// *(2.1)* ISO 15118-20 signature for all price schedules in _chargingSchedules_. +
1493    /// Note: for 256-bit elliptic curves (like secp256k1) the ECDSA signature is 512 bits (64 bytes) and for 521-bit curves (like secp521r1) the signature is 1042 bits. This equals 131 bytes, which can be encoded as base64 in 176 bytes.
1494    #[serde(rename = "priceScheduleSignature")]
1495    #[serde(default, skip_serializing_if = "Option::is_none")]
1496    pub price_schedule_signature: Option<String>,
1497    /// The `customData` member.
1498    #[serde(rename = "customData")]
1499    #[serde(default, skip_serializing_if = "Option::is_none")]
1500    pub custom_data: Option<crate::types::CustomData>,
1501}
1502
1503impl ChargingProfile {
1504    /// Creates a `ChargingProfile` from its required fields.
1505    #[must_use]
1506    pub fn new(
1507        id: i32,
1508        stack_level: i32,
1509        charging_profile_purpose: ChargingProfilePurpose,
1510        charging_profile_kind: ChargingProfileKind,
1511        charging_schedule: Vec<ChargingSchedule>,
1512    ) -> Self {
1513        Self {
1514            id,
1515            stack_level,
1516            charging_profile_purpose,
1517            charging_profile_kind,
1518            charging_schedule,
1519            recurrency_kind: None,
1520            valid_from: None,
1521            valid_to: None,
1522            transaction_id: None,
1523            max_offline_duration: None,
1524            invalid_after_offline_duration: None,
1525            dyn_update_interval: None,
1526            dyn_update_time: None,
1527            price_schedule_signature: None,
1528            custom_data: None,
1529        }
1530    }
1531
1532    /// Sets the optional `recurrencyKind` field.
1533    #[must_use]
1534    pub fn with_recurrency_kind(mut self, value: RecurrencyKind) -> Self {
1535        self.recurrency_kind = Some(value);
1536        self
1537    }
1538
1539    /// Sets the optional `validFrom` field.
1540    #[must_use]
1541    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1542        self.valid_from = Some(value.into());
1543        self
1544    }
1545
1546    /// Sets the optional `validTo` field.
1547    #[must_use]
1548    pub fn with_valid_to(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1549        self.valid_to = Some(value.into());
1550        self
1551    }
1552
1553    /// Sets the optional `transactionId` field.
1554    #[must_use]
1555    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
1556        self.transaction_id = Some(value.into());
1557        self
1558    }
1559
1560    /// Sets the optional `maxOfflineDuration` field.
1561    #[must_use]
1562    pub fn with_max_offline_duration(mut self, value: i32) -> Self {
1563        self.max_offline_duration = Some(value);
1564        self
1565    }
1566
1567    /// Sets the optional `invalidAfterOfflineDuration` field.
1568    #[must_use]
1569    pub fn with_invalid_after_offline_duration(mut self, value: bool) -> Self {
1570        self.invalid_after_offline_duration = Some(value);
1571        self
1572    }
1573
1574    /// Sets the optional `dynUpdateInterval` field.
1575    #[must_use]
1576    pub fn with_dyn_update_interval(mut self, value: i32) -> Self {
1577        self.dyn_update_interval = Some(value);
1578        self
1579    }
1580
1581    /// Sets the optional `dynUpdateTime` field.
1582    #[must_use]
1583    pub fn with_dyn_update_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1584        self.dyn_update_time = Some(value.into());
1585        self
1586    }
1587
1588    /// Sets the optional `priceScheduleSignature` field.
1589    #[must_use]
1590    pub fn with_price_schedule_signature(mut self, value: impl Into<String>) -> Self {
1591        self.price_schedule_signature = Some(value.into());
1592        self
1593    }
1594
1595    /// Sets the optional `customData` field.
1596    #[must_use]
1597    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1598        self.custom_data = Some(value);
1599        self
1600    }
1601}
1602
1603impl Validate for ChargingProfile {
1604    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1605        path.push_key("stackLevel");
1606        validate::int_range(i64::from(self.stack_level), Some(0.0), None, path, out);
1607        path.pop();
1608        path.push_key("chargingProfilePurpose");
1609        Validate::validate_at(&self.charging_profile_purpose, path, out);
1610        path.pop();
1611        path.push_key("chargingProfileKind");
1612        Validate::validate_at(&self.charging_profile_kind, path, out);
1613        path.pop();
1614        path.push_key("chargingSchedule");
1615        validate::list_len(self.charging_schedule.len(), Some(1), Some(3), path, out);
1616        for (index, item) in self.charging_schedule.iter().enumerate() {
1617            path.push_index(index);
1618            Validate::validate_at(item, path, out);
1619            path.pop();
1620        }
1621        path.pop();
1622        path.push_key("recurrencyKind");
1623        if let Some(value) = &self.recurrency_kind {
1624            Validate::validate_at(value, path, out);
1625        }
1626        path.pop();
1627        path.push_key("transactionId");
1628        if let Some(value) = &self.transaction_id {
1629            validate::string(value.as_str(), None, Some(36), path, out);
1630        }
1631        path.pop();
1632        path.push_key("priceScheduleSignature");
1633        if let Some(value) = &self.price_schedule_signature {
1634            validate::string(value.as_str(), None, Some(256), path, out);
1635        }
1636        path.pop();
1637        path.push_key("customData");
1638        if let Some(value) = &self.custom_data {
1639            Validate::validate_at(value, path, out);
1640        }
1641        path.pop();
1642    }
1643}
1644
1645/// A ChargingProfileCriterionType is a filter for charging profiles to be selected by a GetChargingProfilesRequest.
1646///
1647/// The OCPP 2.1 `ChargingProfileCriterion` data type.
1648#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1649pub struct ChargingProfileCriterion {
1650    /// The `chargingProfilePurpose` member.
1651    #[serde(rename = "chargingProfilePurpose")]
1652    #[serde(default, skip_serializing_if = "Option::is_none")]
1653    pub charging_profile_purpose: Option<ChargingProfilePurpose>,
1654    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
1655    #[serde(rename = "stackLevel")]
1656    #[serde(default, skip_serializing_if = "Option::is_none")]
1657    pub stack_level: Option<i32>,
1658    /// 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;
1659    #[serde(rename = "chargingProfileId")]
1660    #[serde(default, skip_serializing_if = "Option::is_none")]
1661    pub charging_profile_id: Option<Vec<i32>>,
1662    /// For which charging limit sources, charging profiles SHALL be reported. If omitted, the Charging Station SHALL not filter on chargingLimitSource. Values defined in Appendix as ChargingLimitSourceEnumStringType.
1663    #[serde(rename = "chargingLimitSource")]
1664    #[serde(default, skip_serializing_if = "Option::is_none")]
1665    pub charging_limit_source: Option<Vec<String>>,
1666    /// The `customData` member.
1667    #[serde(rename = "customData")]
1668    #[serde(default, skip_serializing_if = "Option::is_none")]
1669    pub custom_data: Option<crate::types::CustomData>,
1670}
1671
1672impl ChargingProfileCriterion {
1673    /// Creates an empty `ChargingProfileCriterion`. Every field of this type is optional.
1674    #[must_use]
1675    pub fn new() -> Self {
1676        Self::default()
1677    }
1678
1679    /// Sets the optional `chargingProfilePurpose` field.
1680    #[must_use]
1681    pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
1682        self.charging_profile_purpose = Some(value);
1683        self
1684    }
1685
1686    /// Sets the optional `stackLevel` field.
1687    #[must_use]
1688    pub fn with_stack_level(mut self, value: i32) -> Self {
1689        self.stack_level = Some(value);
1690        self
1691    }
1692
1693    /// Sets the optional `chargingProfileId` field.
1694    #[must_use]
1695    pub fn with_charging_profile_id(mut self, value: Vec<i32>) -> Self {
1696        self.charging_profile_id = Some(value);
1697        self
1698    }
1699
1700    /// Sets the optional `chargingLimitSource` field.
1701    #[must_use]
1702    pub fn with_charging_limit_source(
1703        mut self,
1704        value: impl IntoIterator<Item = impl Into<String>>,
1705    ) -> Self {
1706        self.charging_limit_source = Some(value.into_iter().map(Into::into).collect());
1707        self
1708    }
1709
1710    /// Sets the optional `customData` field.
1711    #[must_use]
1712    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1713        self.custom_data = Some(value);
1714        self
1715    }
1716}
1717
1718impl Validate for ChargingProfileCriterion {
1719    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1720        path.push_key("chargingProfilePurpose");
1721        if let Some(value) = &self.charging_profile_purpose {
1722            Validate::validate_at(value, path, out);
1723        }
1724        path.pop();
1725        path.push_key("stackLevel");
1726        if let Some(value) = &self.stack_level {
1727            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
1728        }
1729        path.pop();
1730        path.push_key("chargingProfileId");
1731        if let Some(value) = &self.charging_profile_id {
1732            validate::list_len(value.len(), Some(1), None, path, out);
1733        }
1734        path.pop();
1735        path.push_key("chargingLimitSource");
1736        if let Some(value) = &self.charging_limit_source {
1737            validate::list_len(value.len(), Some(1), Some(4), path, out);
1738            for (index, item) in value.iter().enumerate() {
1739                path.push_index(index);
1740                validate::string(item.as_str(), None, Some(20), path, out);
1741                path.pop();
1742            }
1743        }
1744        path.pop();
1745        path.push_key("customData");
1746        if let Some(value) = &self.custom_data {
1747            Validate::validate_at(value, path, out);
1748        }
1749        path.pop();
1750    }
1751}
1752
1753/// Charging schedule structure defines a list of charging periods, as used in: NotifyEVChargingScheduleRequest and ChargingProfileType. When used in a NotifyEVChargingScheduleRequest only _duration_ and _chargingSchedulePeriod_ are relevant and _chargingRateUnit_ must be 'W'. +
1754/// An ISO 15118-20 session may provide either an _absolutePriceSchedule_ or a _priceLevelSchedule_. An ISO 15118-2 session can only provide a_salesTariff_ element. The field _digestValue_ is used when price schedule or sales tariff are signed.
1755///
1756/// image::images/ChargingSchedule-Simple.png\[\]
1757///
1758/// The OCPP 2.1 `ChargingSchedule` data type.
1759#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1760pub struct ChargingSchedule {
1761    /// The `id` member.
1762    pub id: i32,
1763    /// The `chargingRateUnit` member.
1764    #[serde(rename = "chargingRateUnit")]
1765    pub charging_rate_unit: ChargingRateUnit,
1766    /// The `chargingSchedulePeriod` member.
1767    #[serde(rename = "chargingSchedulePeriod")]
1768    pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
1769    /// The `limitAtSoC` member.
1770    #[serde(rename = "limitAtSoC")]
1771    #[serde(default, skip_serializing_if = "Option::is_none")]
1772    pub limit_at_so_c: Option<LimitAtSoC>,
1773    /// Starting point of an absolute schedule or recurring schedule.
1774    #[serde(rename = "startSchedule")]
1775    #[serde(default, skip_serializing_if = "Option::is_none")]
1776    pub start_schedule: Option<crate::types::DateTime>,
1777    /// 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 in case startSchedule is absent.
1778    #[serde(default, skip_serializing_if = "Option::is_none")]
1779    pub duration: Option<i32>,
1780    /// 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.
1781    #[serde(rename = "minChargingRate")]
1782    #[serde(default, skip_serializing_if = "Option::is_none")]
1783    pub min_charging_rate: Option<crate::types::Decimal>,
1784    /// *(2.1)* Power tolerance when following EVPowerProfile.
1785    #[serde(rename = "powerTolerance")]
1786    #[serde(default, skip_serializing_if = "Option::is_none")]
1787    pub power_tolerance: Option<crate::types::Decimal>,
1788    /// *(2.1)* Id of this element for referencing in a signature.
1789    #[serde(rename = "signatureId")]
1790    #[serde(default, skip_serializing_if = "Option::is_none")]
1791    pub signature_id: Option<i32>,
1792    /// *(2.1)* Base64 encoded hash (SHA256 for ISO 15118-2, SHA512 for ISO 15118-20) of the EXI price schedule element. Used in signature.
1793    #[serde(rename = "digestValue")]
1794    #[serde(default, skip_serializing_if = "Option::is_none")]
1795    pub digest_value: Option<String>,
1796    /// *(2.1)* Defaults to false. When true, disregard time zone offset in dateTime fields of  _ChargingScheduleType_ and use unqualified local time at Charging Station instead.
1797    ///  This allows the same `Absolute` or `Recurring` charging profile to be used in both summer and winter time.
1798    #[serde(rename = "useLocalTime")]
1799    #[serde(default, skip_serializing_if = "Option::is_none")]
1800    pub use_local_time: Option<bool>,
1801    /// *(2.1)* Defaults to 0. When _randomizedDelay_ not equals zero, then the start of each &lt;&lt;cmn_chargingscheduleperiodtype,ChargingSchedulePeriodType&gt;&gt; is delayed by a randomly chosen number of seconds between 0 and _randomizedDelay_.  Only allowed for TxProfile and TxDefaultProfile.
1802    #[serde(rename = "randomizedDelay")]
1803    #[serde(default, skip_serializing_if = "Option::is_none")]
1804    pub randomized_delay: Option<i32>,
1805    /// The `salesTariff` member.
1806    #[serde(rename = "salesTariff")]
1807    #[serde(default, skip_serializing_if = "Option::is_none")]
1808    pub sales_tariff: Option<SalesTariff>,
1809    /// The `absolutePriceSchedule` member.
1810    #[serde(rename = "absolutePriceSchedule")]
1811    #[serde(default, skip_serializing_if = "Option::is_none")]
1812    pub absolute_price_schedule: Option<AbsolutePriceSchedule>,
1813    /// The `priceLevelSchedule` member.
1814    #[serde(rename = "priceLevelSchedule")]
1815    #[serde(default, skip_serializing_if = "Option::is_none")]
1816    pub price_level_schedule: Option<PriceLevelSchedule>,
1817    /// The `customData` member.
1818    #[serde(rename = "customData")]
1819    #[serde(default, skip_serializing_if = "Option::is_none")]
1820    pub custom_data: Option<crate::types::CustomData>,
1821}
1822
1823impl ChargingSchedule {
1824    /// Creates a `ChargingSchedule` from its required fields.
1825    #[must_use]
1826    pub fn new(
1827        id: i32,
1828        charging_rate_unit: ChargingRateUnit,
1829        charging_schedule_period: Vec<ChargingSchedulePeriod>,
1830    ) -> Self {
1831        Self {
1832            id,
1833            charging_rate_unit,
1834            charging_schedule_period,
1835            limit_at_so_c: None,
1836            start_schedule: None,
1837            duration: None,
1838            min_charging_rate: None,
1839            power_tolerance: None,
1840            signature_id: None,
1841            digest_value: None,
1842            use_local_time: None,
1843            randomized_delay: None,
1844            sales_tariff: None,
1845            absolute_price_schedule: None,
1846            price_level_schedule: None,
1847            custom_data: None,
1848        }
1849    }
1850
1851    /// Sets the optional `limitAtSoC` field.
1852    #[must_use]
1853    pub fn with_limit_at_so_c(mut self, value: LimitAtSoC) -> Self {
1854        self.limit_at_so_c = Some(value);
1855        self
1856    }
1857
1858    /// Sets the optional `startSchedule` field.
1859    #[must_use]
1860    pub fn with_start_schedule(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1861        self.start_schedule = Some(value.into());
1862        self
1863    }
1864
1865    /// Sets the optional `duration` field.
1866    #[must_use]
1867    pub fn with_duration(mut self, value: i32) -> Self {
1868        self.duration = Some(value);
1869        self
1870    }
1871
1872    /// Sets the optional `minChargingRate` field.
1873    #[must_use]
1874    pub fn with_min_charging_rate(mut self, value: impl Into<crate::types::Decimal>) -> Self {
1875        self.min_charging_rate = Some(value.into());
1876        self
1877    }
1878
1879    /// Sets the optional `powerTolerance` field.
1880    #[must_use]
1881    pub fn with_power_tolerance(mut self, value: impl Into<crate::types::Decimal>) -> Self {
1882        self.power_tolerance = Some(value.into());
1883        self
1884    }
1885
1886    /// Sets the optional `signatureId` field.
1887    #[must_use]
1888    pub fn with_signature_id(mut self, value: i32) -> Self {
1889        self.signature_id = Some(value);
1890        self
1891    }
1892
1893    /// Sets the optional `digestValue` field.
1894    #[must_use]
1895    pub fn with_digest_value(mut self, value: impl Into<String>) -> Self {
1896        self.digest_value = Some(value.into());
1897        self
1898    }
1899
1900    /// Sets the optional `useLocalTime` field.
1901    #[must_use]
1902    pub fn with_use_local_time(mut self, value: bool) -> Self {
1903        self.use_local_time = Some(value);
1904        self
1905    }
1906
1907    /// Sets the optional `randomizedDelay` field.
1908    #[must_use]
1909    pub fn with_randomized_delay(mut self, value: i32) -> Self {
1910        self.randomized_delay = Some(value);
1911        self
1912    }
1913
1914    /// Sets the optional `salesTariff` field.
1915    #[must_use]
1916    pub fn with_sales_tariff(mut self, value: SalesTariff) -> Self {
1917        self.sales_tariff = Some(value);
1918        self
1919    }
1920
1921    /// Sets the optional `absolutePriceSchedule` field.
1922    #[must_use]
1923    pub fn with_absolute_price_schedule(mut self, value: AbsolutePriceSchedule) -> Self {
1924        self.absolute_price_schedule = Some(value);
1925        self
1926    }
1927
1928    /// Sets the optional `priceLevelSchedule` field.
1929    #[must_use]
1930    pub fn with_price_level_schedule(mut self, value: PriceLevelSchedule) -> Self {
1931        self.price_level_schedule = Some(value);
1932        self
1933    }
1934
1935    /// Sets the optional `customData` field.
1936    #[must_use]
1937    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1938        self.custom_data = Some(value);
1939        self
1940    }
1941}
1942
1943impl Validate for ChargingSchedule {
1944    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1945        path.push_key("chargingRateUnit");
1946        Validate::validate_at(&self.charging_rate_unit, path, out);
1947        path.pop();
1948        path.push_key("chargingSchedulePeriod");
1949        validate::list_len(
1950            self.charging_schedule_period.len(),
1951            Some(1),
1952            Some(1024),
1953            path,
1954            out,
1955        );
1956        for (index, item) in self.charging_schedule_period.iter().enumerate() {
1957            path.push_index(index);
1958            Validate::validate_at(item, path, out);
1959            path.pop();
1960        }
1961        path.pop();
1962        path.push_key("limitAtSoC");
1963        if let Some(value) = &self.limit_at_so_c {
1964            Validate::validate_at(value, path, out);
1965        }
1966        path.pop();
1967        path.push_key("signatureId");
1968        if let Some(value) = &self.signature_id {
1969            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
1970        }
1971        path.pop();
1972        path.push_key("digestValue");
1973        if let Some(value) = &self.digest_value {
1974            validate::string(value.as_str(), None, Some(88), path, out);
1975        }
1976        path.pop();
1977        path.push_key("randomizedDelay");
1978        if let Some(value) = &self.randomized_delay {
1979            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
1980        }
1981        path.pop();
1982        path.push_key("salesTariff");
1983        if let Some(value) = &self.sales_tariff {
1984            Validate::validate_at(value, path, out);
1985        }
1986        path.pop();
1987        path.push_key("absolutePriceSchedule");
1988        if let Some(value) = &self.absolute_price_schedule {
1989            Validate::validate_at(value, path, out);
1990        }
1991        path.pop();
1992        path.push_key("priceLevelSchedule");
1993        if let Some(value) = &self.price_level_schedule {
1994            Validate::validate_at(value, path, out);
1995        }
1996        path.pop();
1997        path.push_key("customData");
1998        if let Some(value) = &self.custom_data {
1999            Validate::validate_at(value, path, out);
2000        }
2001        path.pop();
2002    }
2003}
2004
2005/// Charging schedule period structure defines a time period in a charging schedule. It is used in: CompositeScheduleType and in ChargingScheduleType. When used in a NotifyEVChargingScheduleRequest only _startPeriod_, _limit_, _limit_L2_, _limit_L3_ are relevant.
2006///
2007/// The OCPP 2.1 `ChargingSchedulePeriod` data type.
2008#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2009pub struct ChargingSchedulePeriod {
2010    /// Start of the period, in seconds from the start of schedule. The value of StartPeriod also defines the stop time of the previous period.
2011    #[serde(rename = "startPeriod")]
2012    pub start_period: i32,
2013    /// Optional only when not required by the _operationMode_, as in CentralSetpoint, ExternalSetpoint, ExternalLimits, LocalFrequency,  LocalLoadBalancing. +
2014    /// Charging rate limit during the schedule period, in the applicable _chargingRateUnit_.
2015    /// This SHOULD be a non-negative value; a negative value is only supported for backwards compatibility with older systems that use a negative value to specify a discharging limit.
2016    /// When using _chargingRateUnit_ = `W`, this field represents the sum of the power of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2017    #[serde(default, skip_serializing_if = "Option::is_none")]
2018    pub limit: Option<crate::types::Decimal>,
2019    /// *(2.1)* Charging rate limit on phase L2  in the applicable _chargingRateUnit_.
2020    #[serde(rename = "limit_L2")]
2021    #[serde(default, skip_serializing_if = "Option::is_none")]
2022    pub limit_l2: Option<crate::types::Decimal>,
2023    /// *(2.1)* Charging rate limit on phase L3  in the applicable _chargingRateUnit_.
2024    #[serde(rename = "limit_L3")]
2025    #[serde(default, skip_serializing_if = "Option::is_none")]
2026    pub limit_l3: Option<crate::types::Decimal>,
2027    /// The number of phases that can be used for charging. +
2028    /// For a DC EVSE this field should be omitted. +
2029    /// For an AC EVSE a default value of _numberPhases_ = 3 will be assumed if the field is absent.
2030    #[serde(rename = "numberPhases")]
2031    #[serde(default, skip_serializing_if = "Option::is_none")]
2032    pub number_phases: Option<i32>,
2033    /// 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.
2034    #[serde(rename = "phaseToUse")]
2035    #[serde(default, skip_serializing_if = "Option::is_none")]
2036    pub phase_to_use: Option<i32>,
2037    /// *(2.1)* Limit in _chargingRateUnit_ that the EV is allowed to discharge with. Note, these are negative values in order to be consistent with _setpoint_, which can be positive and negative.  +
2038    /// For AC this field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2039    #[serde(rename = "dischargeLimit")]
2040    #[serde(default, skip_serializing_if = "Option::is_none")]
2041    pub discharge_limit: Option<crate::types::Decimal>,
2042    /// *(2.1)* Limit in _chargingRateUnit_ on phase L2 that the EV is allowed to discharge with.
2043    #[serde(rename = "dischargeLimit_L2")]
2044    #[serde(default, skip_serializing_if = "Option::is_none")]
2045    pub discharge_limit_l2: Option<crate::types::Decimal>,
2046    /// *(2.1)* Limit in _chargingRateUnit_ on phase L3 that the EV is allowed to discharge with.
2047    #[serde(rename = "dischargeLimit_L3")]
2048    #[serde(default, skip_serializing_if = "Option::is_none")]
2049    pub discharge_limit_l3: Option<crate::types::Decimal>,
2050    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow as close as possible. Use negative values for discharging. +
2051    /// When a limit and/or _dischargeLimit_ are given the overshoot when following _setpoint_ must remain within these values.
2052    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2053    #[serde(default, skip_serializing_if = "Option::is_none")]
2054    pub setpoint: Option<crate::types::Decimal>,
2055    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L2 as close as possible.
2056    #[serde(rename = "setpoint_L2")]
2057    #[serde(default, skip_serializing_if = "Option::is_none")]
2058    pub setpoint_l2: Option<crate::types::Decimal>,
2059    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L3 as close as possible.
2060    #[serde(rename = "setpoint_L3")]
2061    #[serde(default, skip_serializing_if = "Option::is_none")]
2062    pub setpoint_l3: Option<crate::types::Decimal>,
2063    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow as closely as possible. Positive values for inductive, negative for capacitive reactive power or current.  +
2064    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2065    #[serde(rename = "setpointReactive")]
2066    #[serde(default, skip_serializing_if = "Option::is_none")]
2067    pub setpoint_reactive: Option<crate::types::Decimal>,
2068    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L2 as closely as possible.
2069    #[serde(rename = "setpointReactive_L2")]
2070    #[serde(default, skip_serializing_if = "Option::is_none")]
2071    pub setpoint_reactive_l2: Option<crate::types::Decimal>,
2072    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L3 as closely as possible.
2073    #[serde(rename = "setpointReactive_L3")]
2074    #[serde(default, skip_serializing_if = "Option::is_none")]
2075    pub setpoint_reactive_l3: Option<crate::types::Decimal>,
2076    /// *(2.1)* If  true, the EV should attempt to keep the BMS preconditioned for this time interval.
2077    #[serde(rename = "preconditioningRequest")]
2078    #[serde(default, skip_serializing_if = "Option::is_none")]
2079    pub preconditioning_request: Option<bool>,
2080    /// *(2.1)* If true, the EVSE must turn off power electronics/modules associated with this transaction. Default value when absent is false.
2081    #[serde(rename = "evseSleep")]
2082    #[serde(default, skip_serializing_if = "Option::is_none")]
2083    pub evse_sleep: Option<bool>,
2084    /// *(2.1)* Power value that, when present, is used as a baseline on top of which values from _v2xFreqWattCurve_ and _v2xSignalWattCurve_ are added.
2085    #[serde(rename = "v2xBaseline")]
2086    #[serde(default, skip_serializing_if = "Option::is_none")]
2087    pub v2x_baseline: Option<crate::types::Decimal>,
2088    /// The `operationMode` member.
2089    #[serde(rename = "operationMode")]
2090    #[serde(default, skip_serializing_if = "Option::is_none")]
2091    pub operation_mode: Option<OperationMode>,
2092    /// The `v2xFreqWattCurve` member.
2093    #[serde(rename = "v2xFreqWattCurve")]
2094    #[serde(default, skip_serializing_if = "Option::is_none")]
2095    pub v2x_freq_watt_curve: Option<Vec<V2XFreqWattPoint>>,
2096    /// The `v2xSignalWattCurve` member.
2097    #[serde(rename = "v2xSignalWattCurve")]
2098    #[serde(default, skip_serializing_if = "Option::is_none")]
2099    pub v2x_signal_watt_curve: Option<Vec<V2XSignalWattPoint>>,
2100    /// The `customData` member.
2101    #[serde(rename = "customData")]
2102    #[serde(default, skip_serializing_if = "Option::is_none")]
2103    pub custom_data: Option<crate::types::CustomData>,
2104}
2105
2106impl ChargingSchedulePeriod {
2107    /// Creates a `ChargingSchedulePeriod` from its required fields.
2108    #[must_use]
2109    pub fn new(start_period: i32) -> Self {
2110        Self {
2111            start_period,
2112            limit: None,
2113            limit_l2: None,
2114            limit_l3: None,
2115            number_phases: None,
2116            phase_to_use: None,
2117            discharge_limit: None,
2118            discharge_limit_l2: None,
2119            discharge_limit_l3: None,
2120            setpoint: None,
2121            setpoint_l2: None,
2122            setpoint_l3: None,
2123            setpoint_reactive: None,
2124            setpoint_reactive_l2: None,
2125            setpoint_reactive_l3: None,
2126            preconditioning_request: None,
2127            evse_sleep: None,
2128            v2x_baseline: None,
2129            operation_mode: None,
2130            v2x_freq_watt_curve: None,
2131            v2x_signal_watt_curve: None,
2132            custom_data: None,
2133        }
2134    }
2135
2136    /// Sets the optional `limit` field.
2137    #[must_use]
2138    pub fn with_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2139        self.limit = Some(value.into());
2140        self
2141    }
2142
2143    /// Sets the optional `limit_L2` field.
2144    #[must_use]
2145    pub fn with_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2146        self.limit_l2 = Some(value.into());
2147        self
2148    }
2149
2150    /// Sets the optional `limit_L3` field.
2151    #[must_use]
2152    pub fn with_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2153        self.limit_l3 = Some(value.into());
2154        self
2155    }
2156
2157    /// Sets the optional `numberPhases` field.
2158    #[must_use]
2159    pub fn with_number_phases(mut self, value: i32) -> Self {
2160        self.number_phases = Some(value);
2161        self
2162    }
2163
2164    /// Sets the optional `phaseToUse` field.
2165    #[must_use]
2166    pub fn with_phase_to_use(mut self, value: i32) -> Self {
2167        self.phase_to_use = Some(value);
2168        self
2169    }
2170
2171    /// Sets the optional `dischargeLimit` field.
2172    #[must_use]
2173    pub fn with_discharge_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2174        self.discharge_limit = Some(value.into());
2175        self
2176    }
2177
2178    /// Sets the optional `dischargeLimit_L2` field.
2179    #[must_use]
2180    pub fn with_discharge_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2181        self.discharge_limit_l2 = Some(value.into());
2182        self
2183    }
2184
2185    /// Sets the optional `dischargeLimit_L3` field.
2186    #[must_use]
2187    pub fn with_discharge_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2188        self.discharge_limit_l3 = Some(value.into());
2189        self
2190    }
2191
2192    /// Sets the optional `setpoint` field.
2193    #[must_use]
2194    pub fn with_setpoint(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2195        self.setpoint = Some(value.into());
2196        self
2197    }
2198
2199    /// Sets the optional `setpoint_L2` field.
2200    #[must_use]
2201    pub fn with_setpoint_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2202        self.setpoint_l2 = Some(value.into());
2203        self
2204    }
2205
2206    /// Sets the optional `setpoint_L3` field.
2207    #[must_use]
2208    pub fn with_setpoint_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2209        self.setpoint_l3 = Some(value.into());
2210        self
2211    }
2212
2213    /// Sets the optional `setpointReactive` field.
2214    #[must_use]
2215    pub fn with_setpoint_reactive(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2216        self.setpoint_reactive = Some(value.into());
2217        self
2218    }
2219
2220    /// Sets the optional `setpointReactive_L2` field.
2221    #[must_use]
2222    pub fn with_setpoint_reactive_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2223        self.setpoint_reactive_l2 = Some(value.into());
2224        self
2225    }
2226
2227    /// Sets the optional `setpointReactive_L3` field.
2228    #[must_use]
2229    pub fn with_setpoint_reactive_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2230        self.setpoint_reactive_l3 = Some(value.into());
2231        self
2232    }
2233
2234    /// Sets the optional `preconditioningRequest` field.
2235    #[must_use]
2236    pub fn with_preconditioning_request(mut self, value: bool) -> Self {
2237        self.preconditioning_request = Some(value);
2238        self
2239    }
2240
2241    /// Sets the optional `evseSleep` field.
2242    #[must_use]
2243    pub fn with_evse_sleep(mut self, value: bool) -> Self {
2244        self.evse_sleep = Some(value);
2245        self
2246    }
2247
2248    /// Sets the optional `v2xBaseline` field.
2249    #[must_use]
2250    pub fn with_v2x_baseline(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2251        self.v2x_baseline = Some(value.into());
2252        self
2253    }
2254
2255    /// Sets the optional `operationMode` field.
2256    #[must_use]
2257    pub fn with_operation_mode(mut self, value: OperationMode) -> Self {
2258        self.operation_mode = Some(value);
2259        self
2260    }
2261
2262    /// Sets the optional `v2xFreqWattCurve` field.
2263    #[must_use]
2264    pub fn with_v2x_freq_watt_curve(mut self, value: Vec<V2XFreqWattPoint>) -> Self {
2265        self.v2x_freq_watt_curve = Some(value);
2266        self
2267    }
2268
2269    /// Sets the optional `v2xSignalWattCurve` field.
2270    #[must_use]
2271    pub fn with_v2x_signal_watt_curve(mut self, value: Vec<V2XSignalWattPoint>) -> Self {
2272        self.v2x_signal_watt_curve = Some(value);
2273        self
2274    }
2275
2276    /// Sets the optional `customData` field.
2277    #[must_use]
2278    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2279        self.custom_data = Some(value);
2280        self
2281    }
2282}
2283
2284impl Validate for ChargingSchedulePeriod {
2285    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2286        path.push_key("numberPhases");
2287        if let Some(value) = &self.number_phases {
2288            validate::int_range(i64::from(*value), Some(0.0), Some(3.0), path, out);
2289        }
2290        path.pop();
2291        path.push_key("phaseToUse");
2292        if let Some(value) = &self.phase_to_use {
2293            validate::int_range(i64::from(*value), Some(0.0), Some(3.0), path, out);
2294        }
2295        path.pop();
2296        path.push_key("dischargeLimit");
2297        if let Some(value) = &self.discharge_limit {
2298            validate::range(value.get(), None, Some(0.0), path, out);
2299        }
2300        path.pop();
2301        path.push_key("dischargeLimit_L2");
2302        if let Some(value) = &self.discharge_limit_l2 {
2303            validate::range(value.get(), None, Some(0.0), path, out);
2304        }
2305        path.pop();
2306        path.push_key("dischargeLimit_L3");
2307        if let Some(value) = &self.discharge_limit_l3 {
2308            validate::range(value.get(), None, Some(0.0), path, out);
2309        }
2310        path.pop();
2311        path.push_key("operationMode");
2312        if let Some(value) = &self.operation_mode {
2313            Validate::validate_at(value, path, out);
2314        }
2315        path.pop();
2316        path.push_key("v2xFreqWattCurve");
2317        if let Some(value) = &self.v2x_freq_watt_curve {
2318            validate::list_len(value.len(), Some(1), Some(20), path, out);
2319            for (index, item) in value.iter().enumerate() {
2320                path.push_index(index);
2321                Validate::validate_at(item, path, out);
2322                path.pop();
2323            }
2324        }
2325        path.pop();
2326        path.push_key("v2xSignalWattCurve");
2327        if let Some(value) = &self.v2x_signal_watt_curve {
2328            validate::list_len(value.len(), Some(1), Some(20), path, out);
2329            for (index, item) in value.iter().enumerate() {
2330                path.push_index(index);
2331                Validate::validate_at(item, path, out);
2332                path.pop();
2333            }
2334        }
2335        path.pop();
2336        path.push_key("customData");
2337        if let Some(value) = &self.custom_data {
2338            Validate::validate_at(value, path, out);
2339        }
2340        path.pop();
2341    }
2342}
2343
2344/// Updates to a ChargingSchedulePeriodType for dynamic charging profiles.
2345///
2346/// The OCPP 2.1 `ChargingScheduleUpdate` data type.
2347#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2348pub struct ChargingScheduleUpdate {
2349    /// Optional only when not required by the _operationMode_, as in CentralSetpoint, ExternalSetpoint, ExternalLimits, LocalFrequency,  LocalLoadBalancing. +
2350    /// Charging rate limit during the schedule period, in the applicable _chargingRateUnit_.
2351    /// This SHOULD be a non-negative value; a negative value is only supported for backwards compatibility with older systems that use a negative value to specify a discharging limit.
2352    /// For AC this field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2353    #[serde(default, skip_serializing_if = "Option::is_none")]
2354    pub limit: Option<crate::types::Decimal>,
2355    /// *(2.1)* Charging rate limit on phase L2  in the applicable _chargingRateUnit_.
2356    #[serde(rename = "limit_L2")]
2357    #[serde(default, skip_serializing_if = "Option::is_none")]
2358    pub limit_l2: Option<crate::types::Decimal>,
2359    /// *(2.1)* Charging rate limit on phase L3  in the applicable _chargingRateUnit_.
2360    #[serde(rename = "limit_L3")]
2361    #[serde(default, skip_serializing_if = "Option::is_none")]
2362    pub limit_l3: Option<crate::types::Decimal>,
2363    /// *(2.1)* Limit in _chargingRateUnit_ that the EV is allowed to discharge with. Note, these are negative values in order to be consistent with _setpoint_, which can be positive and negative.  +
2364    /// For AC this field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2365    #[serde(rename = "dischargeLimit")]
2366    #[serde(default, skip_serializing_if = "Option::is_none")]
2367    pub discharge_limit: Option<crate::types::Decimal>,
2368    /// *(2.1)* Limit in _chargingRateUnit_ on phase L2 that the EV is allowed to discharge with.
2369    #[serde(rename = "dischargeLimit_L2")]
2370    #[serde(default, skip_serializing_if = "Option::is_none")]
2371    pub discharge_limit_l2: Option<crate::types::Decimal>,
2372    /// *(2.1)* Limit in _chargingRateUnit_ on phase L3 that the EV is allowed to discharge with.
2373    #[serde(rename = "dischargeLimit_L3")]
2374    #[serde(default, skip_serializing_if = "Option::is_none")]
2375    pub discharge_limit_l3: Option<crate::types::Decimal>,
2376    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow as close as possible. Use negative values for discharging. +
2377    /// When a limit and/or _dischargeLimit_ are given the overshoot when following _setpoint_ must remain within these values.
2378    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2379    #[serde(default, skip_serializing_if = "Option::is_none")]
2380    pub setpoint: Option<crate::types::Decimal>,
2381    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L2 as close as possible.
2382    #[serde(rename = "setpoint_L2")]
2383    #[serde(default, skip_serializing_if = "Option::is_none")]
2384    pub setpoint_l2: Option<crate::types::Decimal>,
2385    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L3 as close as possible.
2386    #[serde(rename = "setpoint_L3")]
2387    #[serde(default, skip_serializing_if = "Option::is_none")]
2388    pub setpoint_l3: Option<crate::types::Decimal>,
2389    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow as closely as possible. Positive values for inductive, negative for capacitive reactive power or current.  +
2390    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2391    #[serde(rename = "setpointReactive")]
2392    #[serde(default, skip_serializing_if = "Option::is_none")]
2393    pub setpoint_reactive: Option<crate::types::Decimal>,
2394    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L2 as closely as possible.
2395    #[serde(rename = "setpointReactive_L2")]
2396    #[serde(default, skip_serializing_if = "Option::is_none")]
2397    pub setpoint_reactive_l2: Option<crate::types::Decimal>,
2398    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L3 as closely as possible.
2399    #[serde(rename = "setpointReactive_L3")]
2400    #[serde(default, skip_serializing_if = "Option::is_none")]
2401    pub setpoint_reactive_l3: Option<crate::types::Decimal>,
2402    /// The `customData` member.
2403    #[serde(rename = "customData")]
2404    #[serde(default, skip_serializing_if = "Option::is_none")]
2405    pub custom_data: Option<crate::types::CustomData>,
2406}
2407
2408impl ChargingScheduleUpdate {
2409    /// Creates an empty `ChargingScheduleUpdate`. Every field of this type is optional.
2410    #[must_use]
2411    pub fn new() -> Self {
2412        Self::default()
2413    }
2414
2415    /// Sets the optional `limit` field.
2416    #[must_use]
2417    pub fn with_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2418        self.limit = Some(value.into());
2419        self
2420    }
2421
2422    /// Sets the optional `limit_L2` field.
2423    #[must_use]
2424    pub fn with_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2425        self.limit_l2 = Some(value.into());
2426        self
2427    }
2428
2429    /// Sets the optional `limit_L3` field.
2430    #[must_use]
2431    pub fn with_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2432        self.limit_l3 = Some(value.into());
2433        self
2434    }
2435
2436    /// Sets the optional `dischargeLimit` field.
2437    #[must_use]
2438    pub fn with_discharge_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2439        self.discharge_limit = Some(value.into());
2440        self
2441    }
2442
2443    /// Sets the optional `dischargeLimit_L2` field.
2444    #[must_use]
2445    pub fn with_discharge_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2446        self.discharge_limit_l2 = Some(value.into());
2447        self
2448    }
2449
2450    /// Sets the optional `dischargeLimit_L3` field.
2451    #[must_use]
2452    pub fn with_discharge_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2453        self.discharge_limit_l3 = Some(value.into());
2454        self
2455    }
2456
2457    /// Sets the optional `setpoint` field.
2458    #[must_use]
2459    pub fn with_setpoint(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2460        self.setpoint = Some(value.into());
2461        self
2462    }
2463
2464    /// Sets the optional `setpoint_L2` field.
2465    #[must_use]
2466    pub fn with_setpoint_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2467        self.setpoint_l2 = Some(value.into());
2468        self
2469    }
2470
2471    /// Sets the optional `setpoint_L3` field.
2472    #[must_use]
2473    pub fn with_setpoint_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2474        self.setpoint_l3 = Some(value.into());
2475        self
2476    }
2477
2478    /// Sets the optional `setpointReactive` field.
2479    #[must_use]
2480    pub fn with_setpoint_reactive(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2481        self.setpoint_reactive = Some(value.into());
2482        self
2483    }
2484
2485    /// Sets the optional `setpointReactive_L2` field.
2486    #[must_use]
2487    pub fn with_setpoint_reactive_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2488        self.setpoint_reactive_l2 = Some(value.into());
2489        self
2490    }
2491
2492    /// Sets the optional `setpointReactive_L3` field.
2493    #[must_use]
2494    pub fn with_setpoint_reactive_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2495        self.setpoint_reactive_l3 = Some(value.into());
2496        self
2497    }
2498
2499    /// Sets the optional `customData` field.
2500    #[must_use]
2501    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2502        self.custom_data = Some(value);
2503        self
2504    }
2505}
2506
2507impl Validate for ChargingScheduleUpdate {
2508    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2509        path.push_key("dischargeLimit");
2510        if let Some(value) = &self.discharge_limit {
2511            validate::range(value.get(), None, Some(0.0), path, out);
2512        }
2513        path.pop();
2514        path.push_key("dischargeLimit_L2");
2515        if let Some(value) = &self.discharge_limit_l2 {
2516            validate::range(value.get(), None, Some(0.0), path, out);
2517        }
2518        path.pop();
2519        path.push_key("dischargeLimit_L3");
2520        if let Some(value) = &self.discharge_limit_l3 {
2521            validate::range(value.get(), None, Some(0.0), path, out);
2522        }
2523        path.pop();
2524        path.push_key("customData");
2525        if let Some(value) = &self.custom_data {
2526            Validate::validate_at(value, path, out);
2527        }
2528        path.pop();
2529    }
2530}
2531
2532/// The physical system where an Electrical Vehicle (EV) can be charged.
2533///
2534/// The OCPP 2.1 `ChargingStation` data type.
2535#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2536pub struct ChargingStation {
2537    /// Defines the model of the device.
2538    pub model: String,
2539    /// Identifies the vendor (not necessarily in a unique manner).
2540    #[serde(rename = "vendorName")]
2541    pub vendor_name: String,
2542    /// Vendor-specific device identifier.
2543    #[serde(rename = "serialNumber")]
2544    #[serde(default, skip_serializing_if = "Option::is_none")]
2545    pub serial_number: Option<String>,
2546    /// The `modem` member.
2547    #[serde(default, skip_serializing_if = "Option::is_none")]
2548    pub modem: Option<Modem>,
2549    /// This contains the firmware version of the Charging Station.
2550    #[serde(rename = "firmwareVersion")]
2551    #[serde(default, skip_serializing_if = "Option::is_none")]
2552    pub firmware_version: Option<String>,
2553    /// The `customData` member.
2554    #[serde(rename = "customData")]
2555    #[serde(default, skip_serializing_if = "Option::is_none")]
2556    pub custom_data: Option<crate::types::CustomData>,
2557}
2558
2559impl ChargingStation {
2560    /// Creates a `ChargingStation` from its required fields.
2561    #[must_use]
2562    pub fn new(model: impl Into<String>, vendor_name: impl Into<String>) -> Self {
2563        Self {
2564            model: model.into(),
2565            vendor_name: vendor_name.into(),
2566            serial_number: None,
2567            modem: None,
2568            firmware_version: None,
2569            custom_data: None,
2570        }
2571    }
2572
2573    /// Sets the optional `serialNumber` field.
2574    #[must_use]
2575    pub fn with_serial_number(mut self, value: impl Into<String>) -> Self {
2576        self.serial_number = Some(value.into());
2577        self
2578    }
2579
2580    /// Sets the optional `modem` field.
2581    #[must_use]
2582    pub fn with_modem(mut self, value: Modem) -> Self {
2583        self.modem = Some(value);
2584        self
2585    }
2586
2587    /// Sets the optional `firmwareVersion` field.
2588    #[must_use]
2589    pub fn with_firmware_version(mut self, value: impl Into<String>) -> Self {
2590        self.firmware_version = Some(value.into());
2591        self
2592    }
2593
2594    /// Sets the optional `customData` field.
2595    #[must_use]
2596    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2597        self.custom_data = Some(value);
2598        self
2599    }
2600}
2601
2602impl Validate for ChargingStation {
2603    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2604        path.push_key("model");
2605        validate::string(self.model.as_str(), None, Some(20), path, out);
2606        path.pop();
2607        path.push_key("vendorName");
2608        validate::string(self.vendor_name.as_str(), None, Some(50), path, out);
2609        path.pop();
2610        path.push_key("serialNumber");
2611        if let Some(value) = &self.serial_number {
2612            validate::string(value.as_str(), None, Some(25), path, out);
2613        }
2614        path.pop();
2615        path.push_key("modem");
2616        if let Some(value) = &self.modem {
2617            Validate::validate_at(value, path, out);
2618        }
2619        path.pop();
2620        path.push_key("firmwareVersion");
2621        if let Some(value) = &self.firmware_version {
2622            validate::string(value.as_str(), None, Some(50), path, out);
2623        }
2624        path.pop();
2625        path.push_key("customData");
2626        if let Some(value) = &self.custom_data {
2627            Validate::validate_at(value, path, out);
2628        }
2629        path.pop();
2630    }
2631}
2632
2633/// A ClearChargingProfileType is a filter for charging profiles to be cleared by ClearChargingProfileRequest.
2634///
2635/// The OCPP 2.1 `ClearChargingProfile` data type.
2636#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2637pub struct ClearChargingProfile {
2638    /// 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.
2639    #[serde(rename = "evseId")]
2640    #[serde(default, skip_serializing_if = "Option::is_none")]
2641    pub evse_id: Option<i32>,
2642    /// The `chargingProfilePurpose` member.
2643    #[serde(rename = "chargingProfilePurpose")]
2644    #[serde(default, skip_serializing_if = "Option::is_none")]
2645    pub charging_profile_purpose: Option<ChargingProfilePurpose>,
2646    /// Specifies the stackLevel for which charging profiles will be cleared, if they meet the other criteria in the request.
2647    #[serde(rename = "stackLevel")]
2648    #[serde(default, skip_serializing_if = "Option::is_none")]
2649    pub stack_level: Option<i32>,
2650    /// The `customData` member.
2651    #[serde(rename = "customData")]
2652    #[serde(default, skip_serializing_if = "Option::is_none")]
2653    pub custom_data: Option<crate::types::CustomData>,
2654}
2655
2656impl ClearChargingProfile {
2657    /// Creates an empty `ClearChargingProfile`. Every field of this type is optional.
2658    #[must_use]
2659    pub fn new() -> Self {
2660        Self::default()
2661    }
2662
2663    /// Sets the optional `evseId` field.
2664    #[must_use]
2665    pub fn with_evse_id(mut self, value: i32) -> Self {
2666        self.evse_id = Some(value);
2667        self
2668    }
2669
2670    /// Sets the optional `chargingProfilePurpose` field.
2671    #[must_use]
2672    pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
2673        self.charging_profile_purpose = Some(value);
2674        self
2675    }
2676
2677    /// Sets the optional `stackLevel` field.
2678    #[must_use]
2679    pub fn with_stack_level(mut self, value: i32) -> Self {
2680        self.stack_level = Some(value);
2681        self
2682    }
2683
2684    /// Sets the optional `customData` field.
2685    #[must_use]
2686    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2687        self.custom_data = Some(value);
2688        self
2689    }
2690}
2691
2692impl Validate for ClearChargingProfile {
2693    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2694        path.push_key("evseId");
2695        if let Some(value) = &self.evse_id {
2696            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
2697        }
2698        path.pop();
2699        path.push_key("chargingProfilePurpose");
2700        if let Some(value) = &self.charging_profile_purpose {
2701            Validate::validate_at(value, path, out);
2702        }
2703        path.pop();
2704        path.push_key("stackLevel");
2705        if let Some(value) = &self.stack_level {
2706            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
2707        }
2708        path.pop();
2709        path.push_key("customData");
2710        if let Some(value) = &self.custom_data {
2711            Validate::validate_at(value, path, out);
2712        }
2713        path.pop();
2714    }
2715}
2716
2717/// The OCPP 2.1 `ClearMonitoringResult` data type.
2718#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2719pub struct ClearMonitoringResult {
2720    /// The `status` member.
2721    pub status: ClearMonitoringStatus,
2722    /// Id of the monitor of which a clear was requested.
2723    pub id: i32,
2724    /// The `statusInfo` member.
2725    #[serde(rename = "statusInfo")]
2726    #[serde(default, skip_serializing_if = "Option::is_none")]
2727    pub status_info: Option<StatusInfo>,
2728    /// The `customData` member.
2729    #[serde(rename = "customData")]
2730    #[serde(default, skip_serializing_if = "Option::is_none")]
2731    pub custom_data: Option<crate::types::CustomData>,
2732}
2733
2734impl ClearMonitoringResult {
2735    /// Creates a `ClearMonitoringResult` from its required fields.
2736    #[must_use]
2737    pub fn new(status: ClearMonitoringStatus, id: i32) -> Self {
2738        Self {
2739            status,
2740            id,
2741            status_info: None,
2742            custom_data: None,
2743        }
2744    }
2745
2746    /// Sets the optional `statusInfo` field.
2747    #[must_use]
2748    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2749        self.status_info = Some(value);
2750        self
2751    }
2752
2753    /// Sets the optional `customData` field.
2754    #[must_use]
2755    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2756        self.custom_data = Some(value);
2757        self
2758    }
2759}
2760
2761impl Validate for ClearMonitoringResult {
2762    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2763        path.push_key("status");
2764        Validate::validate_at(&self.status, path, out);
2765        path.pop();
2766        path.push_key("id");
2767        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
2768        path.pop();
2769        path.push_key("statusInfo");
2770        if let Some(value) = &self.status_info {
2771            Validate::validate_at(value, path, out);
2772        }
2773        path.pop();
2774        path.push_key("customData");
2775        if let Some(value) = &self.custom_data {
2776            Validate::validate_at(value, path, out);
2777        }
2778        path.pop();
2779    }
2780}
2781
2782/// The OCPP 2.1 `ClearTariffsResult` data type.
2783#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2784pub struct ClearTariffsResult {
2785    /// The `status` member.
2786    pub status: TariffClearStatus,
2787    /// The `statusInfo` member.
2788    #[serde(rename = "statusInfo")]
2789    #[serde(default, skip_serializing_if = "Option::is_none")]
2790    pub status_info: Option<StatusInfo>,
2791    /// Id of tariff for which _status_ is reported. If no tariffs were found, then this field is absent, and _status_ will be `NoTariff`.
2792    #[serde(rename = "tariffId")]
2793    #[serde(default, skip_serializing_if = "Option::is_none")]
2794    pub tariff_id: Option<String>,
2795    /// The `customData` member.
2796    #[serde(rename = "customData")]
2797    #[serde(default, skip_serializing_if = "Option::is_none")]
2798    pub custom_data: Option<crate::types::CustomData>,
2799}
2800
2801impl ClearTariffsResult {
2802    /// Creates a `ClearTariffsResult` from its required fields.
2803    #[must_use]
2804    pub fn new(status: TariffClearStatus) -> Self {
2805        Self {
2806            status,
2807            status_info: None,
2808            tariff_id: None,
2809            custom_data: None,
2810        }
2811    }
2812
2813    /// Sets the optional `statusInfo` field.
2814    #[must_use]
2815    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2816        self.status_info = Some(value);
2817        self
2818    }
2819
2820    /// Sets the optional `tariffId` field.
2821    #[must_use]
2822    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
2823        self.tariff_id = Some(value.into());
2824        self
2825    }
2826
2827    /// Sets the optional `customData` field.
2828    #[must_use]
2829    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2830        self.custom_data = Some(value);
2831        self
2832    }
2833}
2834
2835impl Validate for ClearTariffsResult {
2836    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2837        path.push_key("status");
2838        Validate::validate_at(&self.status, path, out);
2839        path.pop();
2840        path.push_key("statusInfo");
2841        if let Some(value) = &self.status_info {
2842            Validate::validate_at(value, path, out);
2843        }
2844        path.pop();
2845        path.push_key("tariffId");
2846        if let Some(value) = &self.tariff_id {
2847            validate::string(value.as_str(), None, Some(60), path, out);
2848        }
2849        path.pop();
2850        path.push_key("customData");
2851        if let Some(value) = &self.custom_data {
2852            Validate::validate_at(value, path, out);
2853        }
2854        path.pop();
2855    }
2856}
2857
2858/// A physical or logical component
2859///
2860/// The OCPP 2.1 `Component` data type.
2861#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2862pub struct Component {
2863    /// 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.
2864    pub name: String,
2865    /// The `evse` member.
2866    #[serde(default, skip_serializing_if = "Option::is_none")]
2867    pub evse: Option<EVSE>,
2868    /// Name of instance in case the component exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
2869    #[serde(default, skip_serializing_if = "Option::is_none")]
2870    pub instance: Option<String>,
2871    /// The `customData` member.
2872    #[serde(rename = "customData")]
2873    #[serde(default, skip_serializing_if = "Option::is_none")]
2874    pub custom_data: Option<crate::types::CustomData>,
2875}
2876
2877impl Component {
2878    /// Creates a `Component` from its required fields.
2879    #[must_use]
2880    pub fn new(name: impl Into<String>) -> Self {
2881        Self {
2882            name: name.into(),
2883            evse: None,
2884            instance: None,
2885            custom_data: None,
2886        }
2887    }
2888
2889    /// Sets the optional `evse` field.
2890    #[must_use]
2891    pub fn with_evse(mut self, value: EVSE) -> Self {
2892        self.evse = Some(value);
2893        self
2894    }
2895
2896    /// Sets the optional `instance` field.
2897    #[must_use]
2898    pub fn with_instance(mut self, value: impl Into<String>) -> Self {
2899        self.instance = Some(value.into());
2900        self
2901    }
2902
2903    /// Sets the optional `customData` field.
2904    #[must_use]
2905    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2906        self.custom_data = Some(value);
2907        self
2908    }
2909}
2910
2911impl Validate for Component {
2912    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2913        path.push_key("name");
2914        validate::string(self.name.as_str(), None, Some(50), path, out);
2915        path.pop();
2916        path.push_key("evse");
2917        if let Some(value) = &self.evse {
2918            Validate::validate_at(value, path, out);
2919        }
2920        path.pop();
2921        path.push_key("instance");
2922        if let Some(value) = &self.instance {
2923            validate::string(value.as_str(), None, Some(50), path, out);
2924        }
2925        path.pop();
2926        path.push_key("customData");
2927        if let Some(value) = &self.custom_data {
2928            Validate::validate_at(value, path, out);
2929        }
2930        path.pop();
2931    }
2932}
2933
2934/// Class to report components, variables and variable attributes and characteristics.
2935///
2936/// The OCPP 2.1 `ComponentVariable` data type.
2937#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2938pub struct ComponentVariable {
2939    /// The `component` member.
2940    pub component: Component,
2941    /// The `variable` member.
2942    #[serde(default, skip_serializing_if = "Option::is_none")]
2943    pub variable: Option<Variable>,
2944    /// The `customData` member.
2945    #[serde(rename = "customData")]
2946    #[serde(default, skip_serializing_if = "Option::is_none")]
2947    pub custom_data: Option<crate::types::CustomData>,
2948}
2949
2950impl ComponentVariable {
2951    /// Creates a `ComponentVariable` from its required fields.
2952    #[must_use]
2953    pub fn new(component: Component) -> Self {
2954        Self {
2955            component,
2956            variable: None,
2957            custom_data: None,
2958        }
2959    }
2960
2961    /// Sets the optional `variable` field.
2962    #[must_use]
2963    pub fn with_variable(mut self, value: Variable) -> Self {
2964        self.variable = Some(value);
2965        self
2966    }
2967
2968    /// Sets the optional `customData` field.
2969    #[must_use]
2970    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2971        self.custom_data = Some(value);
2972        self
2973    }
2974}
2975
2976impl Validate for ComponentVariable {
2977    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2978        path.push_key("component");
2979        Validate::validate_at(&self.component, path, out);
2980        path.pop();
2981        path.push_key("variable");
2982        if let Some(value) = &self.variable {
2983            Validate::validate_at(value, path, out);
2984        }
2985        path.pop();
2986        path.push_key("customData");
2987        if let Some(value) = &self.custom_data {
2988            Validate::validate_at(value, path, out);
2989        }
2990        path.pop();
2991    }
2992}
2993
2994/// The OCPP 2.1 `CompositeSchedule` data type.
2995#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2996pub struct CompositeSchedule {
2997    /// The `evseId` member.
2998    #[serde(rename = "evseId")]
2999    pub evse_id: i32,
3000    /// The `duration` member.
3001    pub duration: i32,
3002    /// The `scheduleStart` member.
3003    #[serde(rename = "scheduleStart")]
3004    pub schedule_start: crate::types::DateTime,
3005    /// The `chargingRateUnit` member.
3006    #[serde(rename = "chargingRateUnit")]
3007    pub charging_rate_unit: ChargingRateUnit,
3008    /// The `chargingSchedulePeriod` member.
3009    #[serde(rename = "chargingSchedulePeriod")]
3010    pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
3011    /// The `customData` member.
3012    #[serde(rename = "customData")]
3013    #[serde(default, skip_serializing_if = "Option::is_none")]
3014    pub custom_data: Option<crate::types::CustomData>,
3015}
3016
3017impl CompositeSchedule {
3018    /// Creates a `CompositeSchedule` from its required fields.
3019    #[must_use]
3020    pub fn new(
3021        evse_id: i32,
3022        duration: i32,
3023        schedule_start: impl Into<crate::types::DateTime>,
3024        charging_rate_unit: ChargingRateUnit,
3025        charging_schedule_period: Vec<ChargingSchedulePeriod>,
3026    ) -> Self {
3027        Self {
3028            evse_id,
3029            duration,
3030            schedule_start: schedule_start.into(),
3031            charging_rate_unit,
3032            charging_schedule_period,
3033            custom_data: None,
3034        }
3035    }
3036
3037    /// Sets the optional `customData` field.
3038    #[must_use]
3039    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3040        self.custom_data = Some(value);
3041        self
3042    }
3043}
3044
3045impl Validate for CompositeSchedule {
3046    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3047        path.push_key("evseId");
3048        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
3049        path.pop();
3050        path.push_key("chargingRateUnit");
3051        Validate::validate_at(&self.charging_rate_unit, path, out);
3052        path.pop();
3053        path.push_key("chargingSchedulePeriod");
3054        validate::list_len(
3055            self.charging_schedule_period.len(),
3056            Some(1),
3057            None,
3058            path,
3059            out,
3060        );
3061        for (index, item) in self.charging_schedule_period.iter().enumerate() {
3062            path.push_index(index);
3063            Validate::validate_at(item, path, out);
3064            path.pop();
3065        }
3066        path.pop();
3067        path.push_key("customData");
3068        if let Some(value) = &self.custom_data {
3069            Validate::validate_at(value, path, out);
3070        }
3071        path.pop();
3072    }
3073}
3074
3075/// The OCPP 2.1 `ConstantStreamData` data type.
3076#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3077pub struct ConstantStreamData {
3078    /// Uniquely identifies the stream
3079    pub id: i32,
3080    /// The `params` member.
3081    pub params: PeriodicEventStreamParams,
3082    /// Id of monitor used to report his event. It can be a preconfigured or hardwired monitor.
3083    #[serde(rename = "variableMonitoringId")]
3084    pub variable_monitoring_id: i32,
3085    /// The `customData` member.
3086    #[serde(rename = "customData")]
3087    #[serde(default, skip_serializing_if = "Option::is_none")]
3088    pub custom_data: Option<crate::types::CustomData>,
3089}
3090
3091impl ConstantStreamData {
3092    /// Creates a `ConstantStreamData` from its required fields.
3093    #[must_use]
3094    pub fn new(id: i32, params: PeriodicEventStreamParams, variable_monitoring_id: i32) -> Self {
3095        Self {
3096            id,
3097            params,
3098            variable_monitoring_id,
3099            custom_data: None,
3100        }
3101    }
3102
3103    /// Sets the optional `customData` field.
3104    #[must_use]
3105    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3106        self.custom_data = Some(value);
3107        self
3108    }
3109}
3110
3111impl Validate for ConstantStreamData {
3112    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3113        path.push_key("id");
3114        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
3115        path.pop();
3116        path.push_key("params");
3117        Validate::validate_at(&self.params, path, out);
3118        path.pop();
3119        path.push_key("variableMonitoringId");
3120        validate::int_range(
3121            i64::from(self.variable_monitoring_id),
3122            Some(0.0),
3123            None,
3124            path,
3125            out,
3126        );
3127        path.pop();
3128        path.push_key("customData");
3129        if let Some(value) = &self.custom_data {
3130            Validate::validate_at(value, path, out);
3131        }
3132        path.pop();
3133    }
3134}
3135
3136/// The OCPP 2.1 `ConsumptionCost` data type.
3137#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3138pub struct ConsumptionCost {
3139    /// 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.
3140    #[serde(rename = "startValue")]
3141    pub start_value: crate::types::Decimal,
3142    /// The `cost` member.
3143    pub cost: Vec<Cost>,
3144    /// The `customData` member.
3145    #[serde(rename = "customData")]
3146    #[serde(default, skip_serializing_if = "Option::is_none")]
3147    pub custom_data: Option<crate::types::CustomData>,
3148}
3149
3150impl ConsumptionCost {
3151    /// Creates a `ConsumptionCost` from its required fields.
3152    #[must_use]
3153    pub fn new(start_value: impl Into<crate::types::Decimal>, cost: Vec<Cost>) -> Self {
3154        Self {
3155            start_value: start_value.into(),
3156            cost,
3157            custom_data: None,
3158        }
3159    }
3160
3161    /// Sets the optional `customData` field.
3162    #[must_use]
3163    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3164        self.custom_data = Some(value);
3165        self
3166    }
3167}
3168
3169impl Validate for ConsumptionCost {
3170    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3171        path.push_key("cost");
3172        validate::list_len(self.cost.len(), Some(1), Some(3), path, out);
3173        for (index, item) in self.cost.iter().enumerate() {
3174            path.push_index(index);
3175            Validate::validate_at(item, path, out);
3176            path.pop();
3177        }
3178        path.pop();
3179        path.push_key("customData");
3180        if let Some(value) = &self.custom_data {
3181            Validate::validate_at(value, path, out);
3182        }
3183        path.pop();
3184    }
3185}
3186
3187/// The OCPP 2.1 `Cost` data type.
3188#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3189pub struct Cost {
3190    /// The `costKind` member.
3191    #[serde(rename = "costKind")]
3192    pub cost_kind: CostKind,
3193    /// The estimated or actual cost per kWh
3194    pub amount: i32,
3195    /// Values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value is determined by: amount * 10 ^ amountMultiplier
3196    #[serde(rename = "amountMultiplier")]
3197    #[serde(default, skip_serializing_if = "Option::is_none")]
3198    pub amount_multiplier: Option<i32>,
3199    /// The `customData` member.
3200    #[serde(rename = "customData")]
3201    #[serde(default, skip_serializing_if = "Option::is_none")]
3202    pub custom_data: Option<crate::types::CustomData>,
3203}
3204
3205impl Cost {
3206    /// Creates a `Cost` from its required fields.
3207    #[must_use]
3208    pub fn new(cost_kind: CostKind, amount: i32) -> Self {
3209        Self {
3210            cost_kind,
3211            amount,
3212            amount_multiplier: None,
3213            custom_data: None,
3214        }
3215    }
3216
3217    /// Sets the optional `amountMultiplier` field.
3218    #[must_use]
3219    pub fn with_amount_multiplier(mut self, value: i32) -> Self {
3220        self.amount_multiplier = Some(value);
3221        self
3222    }
3223
3224    /// Sets the optional `customData` field.
3225    #[must_use]
3226    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3227        self.custom_data = Some(value);
3228        self
3229    }
3230}
3231
3232impl Validate for Cost {
3233    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3234        path.push_key("costKind");
3235        Validate::validate_at(&self.cost_kind, path, out);
3236        path.pop();
3237        path.push_key("customData");
3238        if let Some(value) = &self.custom_data {
3239            Validate::validate_at(value, path, out);
3240        }
3241        path.pop();
3242    }
3243}
3244
3245/// CostDetailsType contains the cost as calculated by Charging Station based on provided TariffType.
3246///
3247/// NOTE: Reservation is not shown as a _chargingPeriod_, because it took place outside of the transaction.
3248///
3249/// The OCPP 2.1 `CostDetails` data type.
3250#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3251pub struct CostDetails {
3252    /// The `totalCost` member.
3253    #[serde(rename = "totalCost")]
3254    pub total_cost: TotalCost,
3255    /// The `totalUsage` member.
3256    #[serde(rename = "totalUsage")]
3257    pub total_usage: TotalUsage,
3258    /// The `chargingPeriods` member.
3259    #[serde(rename = "chargingPeriods")]
3260    #[serde(default, skip_serializing_if = "Option::is_none")]
3261    pub charging_periods: Option<Vec<ChargingPeriod>>,
3262    /// If set to true, then Charging Station has failed to calculate the cost.
3263    #[serde(rename = "failureToCalculate")]
3264    #[serde(default, skip_serializing_if = "Option::is_none")]
3265    pub failure_to_calculate: Option<bool>,
3266    /// Optional human-readable reason text in case of failure to calculate.
3267    #[serde(rename = "failureReason")]
3268    #[serde(default, skip_serializing_if = "Option::is_none")]
3269    pub failure_reason: Option<String>,
3270    /// The `customData` member.
3271    #[serde(rename = "customData")]
3272    #[serde(default, skip_serializing_if = "Option::is_none")]
3273    pub custom_data: Option<crate::types::CustomData>,
3274}
3275
3276impl CostDetails {
3277    /// Creates a `CostDetails` from its required fields.
3278    #[must_use]
3279    pub fn new(total_cost: TotalCost, total_usage: TotalUsage) -> Self {
3280        Self {
3281            total_cost,
3282            total_usage,
3283            charging_periods: None,
3284            failure_to_calculate: None,
3285            failure_reason: None,
3286            custom_data: None,
3287        }
3288    }
3289
3290    /// Sets the optional `chargingPeriods` field.
3291    #[must_use]
3292    pub fn with_charging_periods(mut self, value: Vec<ChargingPeriod>) -> Self {
3293        self.charging_periods = Some(value);
3294        self
3295    }
3296
3297    /// Sets the optional `failureToCalculate` field.
3298    #[must_use]
3299    pub fn with_failure_to_calculate(mut self, value: bool) -> Self {
3300        self.failure_to_calculate = Some(value);
3301        self
3302    }
3303
3304    /// Sets the optional `failureReason` field.
3305    #[must_use]
3306    pub fn with_failure_reason(mut self, value: impl Into<String>) -> Self {
3307        self.failure_reason = Some(value.into());
3308        self
3309    }
3310
3311    /// Sets the optional `customData` field.
3312    #[must_use]
3313    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3314        self.custom_data = Some(value);
3315        self
3316    }
3317}
3318
3319impl Validate for CostDetails {
3320    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3321        path.push_key("totalCost");
3322        Validate::validate_at(&self.total_cost, path, out);
3323        path.pop();
3324        path.push_key("totalUsage");
3325        Validate::validate_at(&self.total_usage, path, out);
3326        path.pop();
3327        path.push_key("chargingPeriods");
3328        if let Some(value) = &self.charging_periods {
3329            validate::list_len(value.len(), Some(1), None, path, out);
3330            for (index, item) in value.iter().enumerate() {
3331                path.push_index(index);
3332                Validate::validate_at(item, path, out);
3333                path.pop();
3334            }
3335        }
3336        path.pop();
3337        path.push_key("failureReason");
3338        if let Some(value) = &self.failure_reason {
3339            validate::string(value.as_str(), None, Some(500), path, out);
3340        }
3341        path.pop();
3342        path.push_key("customData");
3343        if let Some(value) = &self.custom_data {
3344            Validate::validate_at(value, path, out);
3345        }
3346        path.pop();
3347    }
3348}
3349
3350/// Volume consumed of cost dimension.
3351///
3352/// The OCPP 2.1 `CostDimension` data type.
3353#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3354pub struct CostDimension {
3355    /// The `type` member.
3356    pub r#type: CostDimensionEnum,
3357    /// Volume of the dimension consumed, measured according to the dimension type.
3358    pub volume: crate::types::Decimal,
3359    /// The `customData` member.
3360    #[serde(rename = "customData")]
3361    #[serde(default, skip_serializing_if = "Option::is_none")]
3362    pub custom_data: Option<crate::types::CustomData>,
3363}
3364
3365impl CostDimension {
3366    /// Creates a `CostDimension` from its required fields.
3367    #[must_use]
3368    pub fn new(r#type: CostDimensionEnum, volume: impl Into<crate::types::Decimal>) -> Self {
3369        Self {
3370            r#type,
3371            volume: volume.into(),
3372            custom_data: None,
3373        }
3374    }
3375
3376    /// Sets the optional `customData` field.
3377    #[must_use]
3378    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3379        self.custom_data = Some(value);
3380        self
3381    }
3382}
3383
3384impl Validate for CostDimension {
3385    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3386        path.push_key("type");
3387        Validate::validate_at(&self.r#type, path, out);
3388        path.pop();
3389        path.push_key("customData");
3390        if let Some(value) = &self.custom_data {
3391            Validate::validate_at(value, path, out);
3392        }
3393        path.pop();
3394    }
3395}
3396
3397/// EV DC charging parameters for ISO 15118-2
3398///
3399/// The OCPP 2.1 `DCChargingParameters` data type.
3400#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3401pub struct DCChargingParameters {
3402    /// Maximum current (in A) supported by the electric vehicle. Includes cable capacity.
3403    /// Relates to: +
3404    /// *ISO 15118-2*: DC_EVChargeParameterType:EVMaximumCurrentLimit
3405    #[serde(rename = "evMaxCurrent")]
3406    pub ev_max_current: crate::types::Decimal,
3407    /// Maximum voltage supported by the electric vehicle.
3408    /// Relates to: +
3409    /// *ISO 15118-2*: DC_EVChargeParameterType: EVMaximumVoltageLimit
3410    #[serde(rename = "evMaxVoltage")]
3411    pub ev_max_voltage: crate::types::Decimal,
3412    /// Maximum power (in W) supported by the electric vehicle. Required for DC charging.
3413    /// Relates to: +
3414    /// *ISO 15118-2*: DC_EVChargeParameterType: EVMaximumPowerLimit
3415    #[serde(rename = "evMaxPower")]
3416    #[serde(default, skip_serializing_if = "Option::is_none")]
3417    pub ev_max_power: Option<crate::types::Decimal>,
3418    /// Capacity of the electric vehicle battery (in Wh).
3419    /// Relates to: +
3420    /// *ISO 15118-2*: DC_EVChargeParameterType: EVEnergyCapacity
3421    #[serde(rename = "evEnergyCapacity")]
3422    #[serde(default, skip_serializing_if = "Option::is_none")]
3423    pub ev_energy_capacity: Option<crate::types::Decimal>,
3424    /// Amount of energy requested (in Wh). This inludes energy required for preconditioning.
3425    /// Relates to: +
3426    /// *ISO 15118-2*: DC_EVChargeParameterType: EVEnergyRequest
3427    #[serde(rename = "energyAmount")]
3428    #[serde(default, skip_serializing_if = "Option::is_none")]
3429    pub energy_amount: Option<crate::types::Decimal>,
3430    /// Energy available in the battery (in percent of the battery capacity)
3431    /// Relates to: +
3432    /// *ISO 15118-2*: DC_EVChargeParameterType: DC_EVStatus: EVRESSSOC
3433    #[serde(rename = "stateOfCharge")]
3434    #[serde(default, skip_serializing_if = "Option::is_none")]
3435    pub state_of_charge: Option<i32>,
3436    /// Percentage of SoC at which the EV considers the battery fully charged. (possible values: 0 - 100)
3437    /// Relates to: +
3438    /// *ISO 15118-2*: DC_EVChargeParameterType: FullSOC
3439    #[serde(rename = "fullSoC")]
3440    #[serde(default, skip_serializing_if = "Option::is_none")]
3441    pub full_so_c: Option<i32>,
3442    /// Percentage of SoC at which the EV considers a fast charging process to end. (possible values: 0 - 100)
3443    /// Relates to: +
3444    /// *ISO 15118-2*: DC_EVChargeParameterType: BulkSOC
3445    #[serde(rename = "bulkSoC")]
3446    #[serde(default, skip_serializing_if = "Option::is_none")]
3447    pub bulk_so_c: Option<i32>,
3448    /// The `customData` member.
3449    #[serde(rename = "customData")]
3450    #[serde(default, skip_serializing_if = "Option::is_none")]
3451    pub custom_data: Option<crate::types::CustomData>,
3452}
3453
3454impl DCChargingParameters {
3455    /// Creates a `DCChargingParameters` from its required fields.
3456    #[must_use]
3457    pub fn new(
3458        ev_max_current: impl Into<crate::types::Decimal>,
3459        ev_max_voltage: impl Into<crate::types::Decimal>,
3460    ) -> Self {
3461        Self {
3462            ev_max_current: ev_max_current.into(),
3463            ev_max_voltage: ev_max_voltage.into(),
3464            ev_max_power: None,
3465            ev_energy_capacity: None,
3466            energy_amount: None,
3467            state_of_charge: None,
3468            full_so_c: None,
3469            bulk_so_c: None,
3470            custom_data: None,
3471        }
3472    }
3473
3474    /// Sets the optional `evMaxPower` field.
3475    #[must_use]
3476    pub fn with_ev_max_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3477        self.ev_max_power = Some(value.into());
3478        self
3479    }
3480
3481    /// Sets the optional `evEnergyCapacity` field.
3482    #[must_use]
3483    pub fn with_ev_energy_capacity(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3484        self.ev_energy_capacity = Some(value.into());
3485        self
3486    }
3487
3488    /// Sets the optional `energyAmount` field.
3489    #[must_use]
3490    pub fn with_energy_amount(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3491        self.energy_amount = Some(value.into());
3492        self
3493    }
3494
3495    /// Sets the optional `stateOfCharge` field.
3496    #[must_use]
3497    pub fn with_state_of_charge(mut self, value: i32) -> Self {
3498        self.state_of_charge = Some(value);
3499        self
3500    }
3501
3502    /// Sets the optional `fullSoC` field.
3503    #[must_use]
3504    pub fn with_full_so_c(mut self, value: i32) -> Self {
3505        self.full_so_c = Some(value);
3506        self
3507    }
3508
3509    /// Sets the optional `bulkSoC` field.
3510    #[must_use]
3511    pub fn with_bulk_so_c(mut self, value: i32) -> Self {
3512        self.bulk_so_c = Some(value);
3513        self
3514    }
3515
3516    /// Sets the optional `customData` field.
3517    #[must_use]
3518    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3519        self.custom_data = Some(value);
3520        self
3521    }
3522}
3523
3524impl Validate for DCChargingParameters {
3525    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3526        path.push_key("stateOfCharge");
3527        if let Some(value) = &self.state_of_charge {
3528            validate::int_range(i64::from(*value), Some(0.0), Some(100.0), path, out);
3529        }
3530        path.pop();
3531        path.push_key("fullSoC");
3532        if let Some(value) = &self.full_so_c {
3533            validate::int_range(i64::from(*value), Some(0.0), Some(100.0), path, out);
3534        }
3535        path.pop();
3536        path.push_key("bulkSoC");
3537        if let Some(value) = &self.bulk_so_c {
3538            validate::int_range(i64::from(*value), Some(0.0), Some(100.0), path, out);
3539        }
3540        path.pop();
3541        path.push_key("customData");
3542        if let Some(value) = &self.custom_data {
3543            Validate::validate_at(value, path, out);
3544        }
3545        path.pop();
3546    }
3547}
3548
3549/// *(2.1)* DERChargingParametersType is used in ChargingNeedsType during an ISO 15118-20 session for AC_BPT_DER to report the inverter settings related to DER control that were agreed between EVSE and EV.
3550///
3551/// Fields starting with "ev" contain values from the EV.
3552/// Other fields contain a value that is supported by both EV and EVSE.
3553///
3554/// DERChargingParametersType type is only relevant in case of an ISO 15118-20 AC_BPT_DER/AC_DER charging session.
3555///
3556/// NOTE: All these fields have values greater or equal to zero (i.e. are non-negative)
3557///
3558/// The OCPP 2.1 `DERChargingParameters` data type.
3559#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3560pub struct DERChargingParameters {
3561    /// DER control functions supported by EV. +
3562    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType:DERControlFunctions (bitmap)
3563    #[serde(rename = "evSupportedDERControl")]
3564    #[serde(default, skip_serializing_if = "Option::is_none")]
3565    pub ev_supported_der_control: Option<Vec<DERControl>>,
3566    /// Rated maximum injected active power by EV, at specified over-excited power factor (overExcitedPowerFactor). +
3567    /// It can also be defined as the rated maximum discharge power at the rated minimum injected reactive power value. This means that if the EV is providing reactive power support, and it is requested to discharge at max power (e.g. to satisfy an EMS request), the EV may override the request and discharge up to overExcitedMaximumDischargePower to meet the minimum reactive power requirements. +
3568    /// Corresponds to the WOvPF attribute in IEC 61850. +
3569    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVOverExcitedMaximumDischargePower
3570    #[serde(rename = "evOverExcitedMaxDischargePower")]
3571    #[serde(default, skip_serializing_if = "Option::is_none")]
3572    pub ev_over_excited_max_discharge_power: Option<crate::types::Decimal>,
3573    /// EV power factor when injecting (over excited) the minimum reactive power. +
3574    /// Corresponds to the OvPF attribute in IEC 61850. +
3575    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVOverExcitedPowerFactor
3576    #[serde(rename = "evOverExcitedPowerFactor")]
3577    #[serde(default, skip_serializing_if = "Option::is_none")]
3578    pub ev_over_excited_power_factor: Option<crate::types::Decimal>,
3579    /// Rated maximum injected active power by EV supported at specified under-excited power factor (EVUnderExcitedPowerFactor). +
3580    /// It can also be defined as the rated maximum dischargePower at the rated minimum absorbed reactive power value.
3581    /// This means that if the EV is providing reactive power support, and it is requested to discharge at max power (e.g. to satisfy an EMS request), the EV may override the request and discharge up to underExcitedMaximumDischargePower to meet the minimum reactive power requirements. +
3582    /// This corresponds to the WUnPF attribute in the IEC 61850. +
3583    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVUnderExcitedMaximumDischargePower
3584    #[serde(rename = "evUnderExcitedMaxDischargePower")]
3585    #[serde(default, skip_serializing_if = "Option::is_none")]
3586    pub ev_under_excited_max_discharge_power: Option<crate::types::Decimal>,
3587    /// EV power factor when injecting (under excited) the minimum reactive power. +
3588    /// Corresponds to the OvPF attribute in IEC 61850. +
3589    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVUnderExcitedPowerFactor
3590    #[serde(rename = "evUnderExcitedPowerFactor")]
3591    #[serde(default, skip_serializing_if = "Option::is_none")]
3592    pub ev_under_excited_power_factor: Option<crate::types::Decimal>,
3593    /// Rated maximum total apparent power, defined by min(EV, EVSE) in va.
3594    /// Corresponds to the VAMaxRtg in IEC 61850. +
3595    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumApparentPower
3596    #[serde(rename = "maxApparentPower")]
3597    #[serde(default, skip_serializing_if = "Option::is_none")]
3598    pub max_apparent_power: Option<crate::types::Decimal>,
3599    /// Rated maximum absorbed apparent power, defined by min(EV, EVSE) in va. +
3600    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3601    ///     in which case this field represents phase L1. +
3602    ///     Corresponds to the ChaVAMaxRtg in IEC 61850. +
3603    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower
3604    #[serde(rename = "maxChargeApparentPower")]
3605    #[serde(default, skip_serializing_if = "Option::is_none")]
3606    pub max_charge_apparent_power: Option<crate::types::Decimal>,
3607    /// Rated maximum absorbed apparent power on phase L2, defined by min(EV, EVSE) in va.
3608    /// Corresponds to the ChaVAMaxRtg in IEC 61850. +
3609    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower_L2
3610    #[serde(rename = "maxChargeApparentPower_L2")]
3611    #[serde(default, skip_serializing_if = "Option::is_none")]
3612    pub max_charge_apparent_power_l2: Option<crate::types::Decimal>,
3613    /// Rated maximum absorbed apparent power on phase L3, defined by min(EV, EVSE) in va.
3614    /// Corresponds to the ChaVAMaxRtg in IEC 61850. +
3615    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower_L3
3616    #[serde(rename = "maxChargeApparentPower_L3")]
3617    #[serde(default, skip_serializing_if = "Option::is_none")]
3618    pub max_charge_apparent_power_l3: Option<crate::types::Decimal>,
3619    /// Rated maximum injected apparent power, defined by min(EV, EVSE) in va. +
3620    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3621    ///     in which case this field represents phase L1. +
3622    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3623    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower
3624    #[serde(rename = "maxDischargeApparentPower")]
3625    #[serde(default, skip_serializing_if = "Option::is_none")]
3626    pub max_discharge_apparent_power: Option<crate::types::Decimal>,
3627    /// Rated maximum injected apparent power on phase L2, defined by min(EV, EVSE) in va. +
3628    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3629    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower_L2
3630    #[serde(rename = "maxDischargeApparentPower_L2")]
3631    #[serde(default, skip_serializing_if = "Option::is_none")]
3632    pub max_discharge_apparent_power_l2: Option<crate::types::Decimal>,
3633    /// Rated maximum injected apparent power on phase L3, defined by min(EV, EVSE) in va. +
3634    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3635    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower_L3
3636    #[serde(rename = "maxDischargeApparentPower_L3")]
3637    #[serde(default, skip_serializing_if = "Option::is_none")]
3638    pub max_discharge_apparent_power_l3: Option<crate::types::Decimal>,
3639    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars. +
3640    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3641    ///     in which case this field represents phase L1. +
3642    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3643    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower
3644    #[serde(rename = "maxChargeReactivePower")]
3645    #[serde(default, skip_serializing_if = "Option::is_none")]
3646    pub max_charge_reactive_power: Option<crate::types::Decimal>,
3647    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars on phase L2. +
3648    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3649    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower_L2
3650    #[serde(rename = "maxChargeReactivePower_L2")]
3651    #[serde(default, skip_serializing_if = "Option::is_none")]
3652    pub max_charge_reactive_power_l2: Option<crate::types::Decimal>,
3653    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars on phase L3. +
3654    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3655    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower_L3
3656    #[serde(rename = "maxChargeReactivePower_L3")]
3657    #[serde(default, skip_serializing_if = "Option::is_none")]
3658    pub max_charge_reactive_power_l3: Option<crate::types::Decimal>,
3659    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars. +
3660    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3661    ///     in which case this field represents phase L1. +
3662    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower
3663    #[serde(rename = "minChargeReactivePower")]
3664    #[serde(default, skip_serializing_if = "Option::is_none")]
3665    pub min_charge_reactive_power: Option<crate::types::Decimal>,
3666    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars on phase L2. +
3667    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower_L2
3668    #[serde(rename = "minChargeReactivePower_L2")]
3669    #[serde(default, skip_serializing_if = "Option::is_none")]
3670    pub min_charge_reactive_power_l2: Option<crate::types::Decimal>,
3671    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars on phase L3. +
3672    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower_L3
3673    #[serde(rename = "minChargeReactivePower_L3")]
3674    #[serde(default, skip_serializing_if = "Option::is_none")]
3675    pub min_charge_reactive_power_l3: Option<crate::types::Decimal>,
3676    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars. +
3677    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3678    ///     in which case this field represents phase L1. +
3679    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3680    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower
3681    #[serde(rename = "maxDischargeReactivePower")]
3682    #[serde(default, skip_serializing_if = "Option::is_none")]
3683    pub max_discharge_reactive_power: Option<crate::types::Decimal>,
3684    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars on phase L2. +
3685    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3686    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower_L2
3687    #[serde(rename = "maxDischargeReactivePower_L2")]
3688    #[serde(default, skip_serializing_if = "Option::is_none")]
3689    pub max_discharge_reactive_power_l2: Option<crate::types::Decimal>,
3690    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars on phase L3. +
3691    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3692    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower_L3
3693    #[serde(rename = "maxDischargeReactivePower_L3")]
3694    #[serde(default, skip_serializing_if = "Option::is_none")]
3695    pub max_discharge_reactive_power_l3: Option<crate::types::Decimal>,
3696    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in vars. +
3697    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3698    ///     in which case this field represents phase L1. +
3699    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower
3700    #[serde(rename = "minDischargeReactivePower")]
3701    #[serde(default, skip_serializing_if = "Option::is_none")]
3702    pub min_discharge_reactive_power: Option<crate::types::Decimal>,
3703    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in var on phase L2. +
3704    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower_L2
3705    #[serde(rename = "minDischargeReactivePower_L2")]
3706    #[serde(default, skip_serializing_if = "Option::is_none")]
3707    pub min_discharge_reactive_power_l2: Option<crate::types::Decimal>,
3708    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in var on phase L3. +
3709    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower_L3
3710    #[serde(rename = "minDischargeReactivePower_L3")]
3711    #[serde(default, skip_serializing_if = "Option::is_none")]
3712    pub min_discharge_reactive_power_l3: Option<crate::types::Decimal>,
3713    /// Line voltage supported by EVSE and EV.
3714    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVNominalVoltage
3715    #[serde(rename = "nominalVoltage")]
3716    #[serde(default, skip_serializing_if = "Option::is_none")]
3717    pub nominal_voltage: Option<crate::types::Decimal>,
3718    /// The nominal AC voltage (rms) offset between the Charging Station's electrical connection point and the utility’s point of common coupling. +
3719    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVNominalVoltageOffset
3720    #[serde(rename = "nominalVoltageOffset")]
3721    #[serde(default, skip_serializing_if = "Option::is_none")]
3722    pub nominal_voltage_offset: Option<crate::types::Decimal>,
3723    /// Maximum AC rms voltage, as defined by min(EV, EVSE)  to operate with. +
3724    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumNominalVoltage
3725    #[serde(rename = "maxNominalVoltage")]
3726    #[serde(default, skip_serializing_if = "Option::is_none")]
3727    pub max_nominal_voltage: Option<crate::types::Decimal>,
3728    /// Minimum AC rms voltage, as defined by max(EV, EVSE)  to operate with. +
3729    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumNominalVoltage
3730    #[serde(rename = "minNominalVoltage")]
3731    #[serde(default, skip_serializing_if = "Option::is_none")]
3732    pub min_nominal_voltage: Option<crate::types::Decimal>,
3733    /// Manufacturer of the EV inverter. +
3734    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterManufacturer
3735    #[serde(rename = "evInverterManufacturer")]
3736    #[serde(default, skip_serializing_if = "Option::is_none")]
3737    pub ev_inverter_manufacturer: Option<String>,
3738    /// Model name of the EV inverter. +
3739    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterModel
3740    #[serde(rename = "evInverterModel")]
3741    #[serde(default, skip_serializing_if = "Option::is_none")]
3742    pub ev_inverter_model: Option<String>,
3743    /// Serial number of the EV inverter. +
3744    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterSerialNumber
3745    #[serde(rename = "evInverterSerialNumber")]
3746    #[serde(default, skip_serializing_if = "Option::is_none")]
3747    pub ev_inverter_serial_number: Option<String>,
3748    /// Software version of EV inverter. +
3749    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterSwVersion
3750    #[serde(rename = "evInverterSwVersion")]
3751    #[serde(default, skip_serializing_if = "Option::is_none")]
3752    pub ev_inverter_sw_version: Option<String>,
3753    /// Hardware version of EV inverter. +
3754    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterHwVersion
3755    #[serde(rename = "evInverterHwVersion")]
3756    #[serde(default, skip_serializing_if = "Option::is_none")]
3757    pub ev_inverter_hw_version: Option<String>,
3758    /// Type of islanding detection method. Only mandatory when islanding detection is required at the site, as set in the ISO 15118 Service Details configuration. +
3759    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVIslandingDetectionMethod
3760    #[serde(rename = "evIslandingDetectionMethod")]
3761    #[serde(default, skip_serializing_if = "Option::is_none")]
3762    pub ev_islanding_detection_method: Option<Vec<IslandingDetection>>,
3763    /// Time after which EV will trip if an island has been detected. +
3764    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVIslandingTripTime
3765    #[serde(rename = "evIslandingTripTime")]
3766    #[serde(default, skip_serializing_if = "Option::is_none")]
3767    pub ev_islanding_trip_time: Option<crate::types::Decimal>,
3768    /// Maximum injected DC current allowed at level 1 charging. +
3769    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumLevel1DCInjection
3770    #[serde(rename = "evMaximumLevel1DCInjection")]
3771    #[serde(default, skip_serializing_if = "Option::is_none")]
3772    pub ev_maximum_level1_dc_injection: Option<crate::types::Decimal>,
3773    /// Maximum allowed duration of DC injection at level 1 charging. +
3774    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVDurationLevel1DCInjection
3775    #[serde(rename = "evDurationLevel1DCInjection")]
3776    #[serde(default, skip_serializing_if = "Option::is_none")]
3777    pub ev_duration_level1_dc_injection: Option<crate::types::Decimal>,
3778    /// Maximum injected DC current allowed at level 2 charging. +
3779    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumLevel2DCInjection
3780    #[serde(rename = "evMaximumLevel2DCInjection")]
3781    #[serde(default, skip_serializing_if = "Option::is_none")]
3782    pub ev_maximum_level2_dc_injection: Option<crate::types::Decimal>,
3783    /// Maximum allowed duration of DC injection at level 2 charging. +
3784    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVDurationLevel2DCInjection
3785    #[serde(rename = "evDurationLevel2DCInjection")]
3786    #[serde(default, skip_serializing_if = "Option::is_none")]
3787    pub ev_duration_level2_dc_injection: Option<crate::types::Decimal>,
3788    ///     Measure of the susceptibility of the circuit to reactance, in Siemens (S). +
3789    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVReactiveSusceptance
3790    #[serde(rename = "evReactiveSusceptance")]
3791    #[serde(default, skip_serializing_if = "Option::is_none")]
3792    pub ev_reactive_susceptance: Option<crate::types::Decimal>,
3793    /// Total energy value, in Wh, that EV is allowed to provide during the entire V2G session. The value is independent of the V2X Cycling area. Once this value reaches the value of 0, the EV may block any attempt to discharge in order to protect the battery health.
3794    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVSessionTotalDischargeEnergyAvailable
3795    #[serde(rename = "evSessionTotalDischargeEnergyAvailable")]
3796    #[serde(default, skip_serializing_if = "Option::is_none")]
3797    pub ev_session_total_discharge_energy_available: Option<crate::types::Decimal>,
3798    /// The `customData` member.
3799    #[serde(rename = "customData")]
3800    #[serde(default, skip_serializing_if = "Option::is_none")]
3801    pub custom_data: Option<crate::types::CustomData>,
3802}
3803
3804impl DERChargingParameters {
3805    /// Creates an empty `DERChargingParameters`. Every field of this type is optional.
3806    #[must_use]
3807    pub fn new() -> Self {
3808        Self::default()
3809    }
3810
3811    /// Sets the optional `evSupportedDERControl` field.
3812    #[must_use]
3813    pub fn with_ev_supported_der_control(mut self, value: Vec<DERControl>) -> Self {
3814        self.ev_supported_der_control = Some(value);
3815        self
3816    }
3817
3818    /// Sets the optional `evOverExcitedMaxDischargePower` field.
3819    #[must_use]
3820    pub fn with_ev_over_excited_max_discharge_power(
3821        mut self,
3822        value: impl Into<crate::types::Decimal>,
3823    ) -> Self {
3824        self.ev_over_excited_max_discharge_power = Some(value.into());
3825        self
3826    }
3827
3828    /// Sets the optional `evOverExcitedPowerFactor` field.
3829    #[must_use]
3830    pub fn with_ev_over_excited_power_factor(
3831        mut self,
3832        value: impl Into<crate::types::Decimal>,
3833    ) -> Self {
3834        self.ev_over_excited_power_factor = Some(value.into());
3835        self
3836    }
3837
3838    /// Sets the optional `evUnderExcitedMaxDischargePower` field.
3839    #[must_use]
3840    pub fn with_ev_under_excited_max_discharge_power(
3841        mut self,
3842        value: impl Into<crate::types::Decimal>,
3843    ) -> Self {
3844        self.ev_under_excited_max_discharge_power = Some(value.into());
3845        self
3846    }
3847
3848    /// Sets the optional `evUnderExcitedPowerFactor` field.
3849    #[must_use]
3850    pub fn with_ev_under_excited_power_factor(
3851        mut self,
3852        value: impl Into<crate::types::Decimal>,
3853    ) -> Self {
3854        self.ev_under_excited_power_factor = Some(value.into());
3855        self
3856    }
3857
3858    /// Sets the optional `maxApparentPower` field.
3859    #[must_use]
3860    pub fn with_max_apparent_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3861        self.max_apparent_power = Some(value.into());
3862        self
3863    }
3864
3865    /// Sets the optional `maxChargeApparentPower` field.
3866    #[must_use]
3867    pub fn with_max_charge_apparent_power(
3868        mut self,
3869        value: impl Into<crate::types::Decimal>,
3870    ) -> Self {
3871        self.max_charge_apparent_power = Some(value.into());
3872        self
3873    }
3874
3875    /// Sets the optional `maxChargeApparentPower_L2` field.
3876    #[must_use]
3877    pub fn with_max_charge_apparent_power_l2(
3878        mut self,
3879        value: impl Into<crate::types::Decimal>,
3880    ) -> Self {
3881        self.max_charge_apparent_power_l2 = Some(value.into());
3882        self
3883    }
3884
3885    /// Sets the optional `maxChargeApparentPower_L3` field.
3886    #[must_use]
3887    pub fn with_max_charge_apparent_power_l3(
3888        mut self,
3889        value: impl Into<crate::types::Decimal>,
3890    ) -> Self {
3891        self.max_charge_apparent_power_l3 = Some(value.into());
3892        self
3893    }
3894
3895    /// Sets the optional `maxDischargeApparentPower` field.
3896    #[must_use]
3897    pub fn with_max_discharge_apparent_power(
3898        mut self,
3899        value: impl Into<crate::types::Decimal>,
3900    ) -> Self {
3901        self.max_discharge_apparent_power = Some(value.into());
3902        self
3903    }
3904
3905    /// Sets the optional `maxDischargeApparentPower_L2` field.
3906    #[must_use]
3907    pub fn with_max_discharge_apparent_power_l2(
3908        mut self,
3909        value: impl Into<crate::types::Decimal>,
3910    ) -> Self {
3911        self.max_discharge_apparent_power_l2 = Some(value.into());
3912        self
3913    }
3914
3915    /// Sets the optional `maxDischargeApparentPower_L3` field.
3916    #[must_use]
3917    pub fn with_max_discharge_apparent_power_l3(
3918        mut self,
3919        value: impl Into<crate::types::Decimal>,
3920    ) -> Self {
3921        self.max_discharge_apparent_power_l3 = Some(value.into());
3922        self
3923    }
3924
3925    /// Sets the optional `maxChargeReactivePower` field.
3926    #[must_use]
3927    pub fn with_max_charge_reactive_power(
3928        mut self,
3929        value: impl Into<crate::types::Decimal>,
3930    ) -> Self {
3931        self.max_charge_reactive_power = Some(value.into());
3932        self
3933    }
3934
3935    /// Sets the optional `maxChargeReactivePower_L2` field.
3936    #[must_use]
3937    pub fn with_max_charge_reactive_power_l2(
3938        mut self,
3939        value: impl Into<crate::types::Decimal>,
3940    ) -> Self {
3941        self.max_charge_reactive_power_l2 = Some(value.into());
3942        self
3943    }
3944
3945    /// Sets the optional `maxChargeReactivePower_L3` field.
3946    #[must_use]
3947    pub fn with_max_charge_reactive_power_l3(
3948        mut self,
3949        value: impl Into<crate::types::Decimal>,
3950    ) -> Self {
3951        self.max_charge_reactive_power_l3 = Some(value.into());
3952        self
3953    }
3954
3955    /// Sets the optional `minChargeReactivePower` field.
3956    #[must_use]
3957    pub fn with_min_charge_reactive_power(
3958        mut self,
3959        value: impl Into<crate::types::Decimal>,
3960    ) -> Self {
3961        self.min_charge_reactive_power = Some(value.into());
3962        self
3963    }
3964
3965    /// Sets the optional `minChargeReactivePower_L2` field.
3966    #[must_use]
3967    pub fn with_min_charge_reactive_power_l2(
3968        mut self,
3969        value: impl Into<crate::types::Decimal>,
3970    ) -> Self {
3971        self.min_charge_reactive_power_l2 = Some(value.into());
3972        self
3973    }
3974
3975    /// Sets the optional `minChargeReactivePower_L3` field.
3976    #[must_use]
3977    pub fn with_min_charge_reactive_power_l3(
3978        mut self,
3979        value: impl Into<crate::types::Decimal>,
3980    ) -> Self {
3981        self.min_charge_reactive_power_l3 = Some(value.into());
3982        self
3983    }
3984
3985    /// Sets the optional `maxDischargeReactivePower` field.
3986    #[must_use]
3987    pub fn with_max_discharge_reactive_power(
3988        mut self,
3989        value: impl Into<crate::types::Decimal>,
3990    ) -> Self {
3991        self.max_discharge_reactive_power = Some(value.into());
3992        self
3993    }
3994
3995    /// Sets the optional `maxDischargeReactivePower_L2` field.
3996    #[must_use]
3997    pub fn with_max_discharge_reactive_power_l2(
3998        mut self,
3999        value: impl Into<crate::types::Decimal>,
4000    ) -> Self {
4001        self.max_discharge_reactive_power_l2 = Some(value.into());
4002        self
4003    }
4004
4005    /// Sets the optional `maxDischargeReactivePower_L3` field.
4006    #[must_use]
4007    pub fn with_max_discharge_reactive_power_l3(
4008        mut self,
4009        value: impl Into<crate::types::Decimal>,
4010    ) -> Self {
4011        self.max_discharge_reactive_power_l3 = Some(value.into());
4012        self
4013    }
4014
4015    /// Sets the optional `minDischargeReactivePower` field.
4016    #[must_use]
4017    pub fn with_min_discharge_reactive_power(
4018        mut self,
4019        value: impl Into<crate::types::Decimal>,
4020    ) -> Self {
4021        self.min_discharge_reactive_power = Some(value.into());
4022        self
4023    }
4024
4025    /// Sets the optional `minDischargeReactivePower_L2` field.
4026    #[must_use]
4027    pub fn with_min_discharge_reactive_power_l2(
4028        mut self,
4029        value: impl Into<crate::types::Decimal>,
4030    ) -> Self {
4031        self.min_discharge_reactive_power_l2 = Some(value.into());
4032        self
4033    }
4034
4035    /// Sets the optional `minDischargeReactivePower_L3` field.
4036    #[must_use]
4037    pub fn with_min_discharge_reactive_power_l3(
4038        mut self,
4039        value: impl Into<crate::types::Decimal>,
4040    ) -> Self {
4041        self.min_discharge_reactive_power_l3 = Some(value.into());
4042        self
4043    }
4044
4045    /// Sets the optional `nominalVoltage` field.
4046    #[must_use]
4047    pub fn with_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4048        self.nominal_voltage = Some(value.into());
4049        self
4050    }
4051
4052    /// Sets the optional `nominalVoltageOffset` field.
4053    #[must_use]
4054    pub fn with_nominal_voltage_offset(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4055        self.nominal_voltage_offset = Some(value.into());
4056        self
4057    }
4058
4059    /// Sets the optional `maxNominalVoltage` field.
4060    #[must_use]
4061    pub fn with_max_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4062        self.max_nominal_voltage = Some(value.into());
4063        self
4064    }
4065
4066    /// Sets the optional `minNominalVoltage` field.
4067    #[must_use]
4068    pub fn with_min_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4069        self.min_nominal_voltage = Some(value.into());
4070        self
4071    }
4072
4073    /// Sets the optional `evInverterManufacturer` field.
4074    #[must_use]
4075    pub fn with_ev_inverter_manufacturer(mut self, value: impl Into<String>) -> Self {
4076        self.ev_inverter_manufacturer = Some(value.into());
4077        self
4078    }
4079
4080    /// Sets the optional `evInverterModel` field.
4081    #[must_use]
4082    pub fn with_ev_inverter_model(mut self, value: impl Into<String>) -> Self {
4083        self.ev_inverter_model = Some(value.into());
4084        self
4085    }
4086
4087    /// Sets the optional `evInverterSerialNumber` field.
4088    #[must_use]
4089    pub fn with_ev_inverter_serial_number(mut self, value: impl Into<String>) -> Self {
4090        self.ev_inverter_serial_number = Some(value.into());
4091        self
4092    }
4093
4094    /// Sets the optional `evInverterSwVersion` field.
4095    #[must_use]
4096    pub fn with_ev_inverter_sw_version(mut self, value: impl Into<String>) -> Self {
4097        self.ev_inverter_sw_version = Some(value.into());
4098        self
4099    }
4100
4101    /// Sets the optional `evInverterHwVersion` field.
4102    #[must_use]
4103    pub fn with_ev_inverter_hw_version(mut self, value: impl Into<String>) -> Self {
4104        self.ev_inverter_hw_version = Some(value.into());
4105        self
4106    }
4107
4108    /// Sets the optional `evIslandingDetectionMethod` field.
4109    #[must_use]
4110    pub fn with_ev_islanding_detection_method(mut self, value: Vec<IslandingDetection>) -> Self {
4111        self.ev_islanding_detection_method = Some(value);
4112        self
4113    }
4114
4115    /// Sets the optional `evIslandingTripTime` field.
4116    #[must_use]
4117    pub fn with_ev_islanding_trip_time(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4118        self.ev_islanding_trip_time = Some(value.into());
4119        self
4120    }
4121
4122    /// Sets the optional `evMaximumLevel1DCInjection` field.
4123    #[must_use]
4124    pub fn with_ev_maximum_level1_dc_injection(
4125        mut self,
4126        value: impl Into<crate::types::Decimal>,
4127    ) -> Self {
4128        self.ev_maximum_level1_dc_injection = Some(value.into());
4129        self
4130    }
4131
4132    /// Sets the optional `evDurationLevel1DCInjection` field.
4133    #[must_use]
4134    pub fn with_ev_duration_level1_dc_injection(
4135        mut self,
4136        value: impl Into<crate::types::Decimal>,
4137    ) -> Self {
4138        self.ev_duration_level1_dc_injection = Some(value.into());
4139        self
4140    }
4141
4142    /// Sets the optional `evMaximumLevel2DCInjection` field.
4143    #[must_use]
4144    pub fn with_ev_maximum_level2_dc_injection(
4145        mut self,
4146        value: impl Into<crate::types::Decimal>,
4147    ) -> Self {
4148        self.ev_maximum_level2_dc_injection = Some(value.into());
4149        self
4150    }
4151
4152    /// Sets the optional `evDurationLevel2DCInjection` field.
4153    #[must_use]
4154    pub fn with_ev_duration_level2_dc_injection(
4155        mut self,
4156        value: impl Into<crate::types::Decimal>,
4157    ) -> Self {
4158        self.ev_duration_level2_dc_injection = Some(value.into());
4159        self
4160    }
4161
4162    /// Sets the optional `evReactiveSusceptance` field.
4163    #[must_use]
4164    pub fn with_ev_reactive_susceptance(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4165        self.ev_reactive_susceptance = Some(value.into());
4166        self
4167    }
4168
4169    /// Sets the optional `evSessionTotalDischargeEnergyAvailable` field.
4170    #[must_use]
4171    pub fn with_ev_session_total_discharge_energy_available(
4172        mut self,
4173        value: impl Into<crate::types::Decimal>,
4174    ) -> Self {
4175        self.ev_session_total_discharge_energy_available = Some(value.into());
4176        self
4177    }
4178
4179    /// Sets the optional `customData` field.
4180    #[must_use]
4181    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4182        self.custom_data = Some(value);
4183        self
4184    }
4185}
4186
4187impl Validate for DERChargingParameters {
4188    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4189        path.push_key("evSupportedDERControl");
4190        if let Some(value) = &self.ev_supported_der_control {
4191            validate::list_len(value.len(), Some(1), None, path, out);
4192            for (index, item) in value.iter().enumerate() {
4193                path.push_index(index);
4194                Validate::validate_at(item, path, out);
4195                path.pop();
4196            }
4197        }
4198        path.pop();
4199        path.push_key("evInverterManufacturer");
4200        if let Some(value) = &self.ev_inverter_manufacturer {
4201            validate::string(value.as_str(), None, Some(50), path, out);
4202        }
4203        path.pop();
4204        path.push_key("evInverterModel");
4205        if let Some(value) = &self.ev_inverter_model {
4206            validate::string(value.as_str(), None, Some(50), path, out);
4207        }
4208        path.pop();
4209        path.push_key("evInverterSerialNumber");
4210        if let Some(value) = &self.ev_inverter_serial_number {
4211            validate::string(value.as_str(), None, Some(50), path, out);
4212        }
4213        path.pop();
4214        path.push_key("evInverterSwVersion");
4215        if let Some(value) = &self.ev_inverter_sw_version {
4216            validate::string(value.as_str(), None, Some(50), path, out);
4217        }
4218        path.pop();
4219        path.push_key("evInverterHwVersion");
4220        if let Some(value) = &self.ev_inverter_hw_version {
4221            validate::string(value.as_str(), None, Some(50), path, out);
4222        }
4223        path.pop();
4224        path.push_key("evIslandingDetectionMethod");
4225        if let Some(value) = &self.ev_islanding_detection_method {
4226            validate::list_len(value.len(), Some(1), None, path, out);
4227            for (index, item) in value.iter().enumerate() {
4228                path.push_index(index);
4229                Validate::validate_at(item, path, out);
4230                path.pop();
4231            }
4232        }
4233        path.pop();
4234        path.push_key("customData");
4235        if let Some(value) = &self.custom_data {
4236            Validate::validate_at(value, path, out);
4237        }
4238        path.pop();
4239    }
4240}
4241
4242/// The OCPP 2.1 `DERCurve` data type.
4243#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4244pub struct DERCurve {
4245    /// The `curveData` member.
4246    #[serde(rename = "curveData")]
4247    pub curve_data: Vec<DERCurvePoints>,
4248    /// Priority of curve (0=highest)
4249    pub priority: i32,
4250    /// The `yUnit` member.
4251    #[serde(rename = "yUnit")]
4252    pub y_unit: DERUnit,
4253    /// The `hysteresis` member.
4254    #[serde(default, skip_serializing_if = "Option::is_none")]
4255    pub hysteresis: Option<Hysteresis>,
4256    /// The `reactivePowerParams` member.
4257    #[serde(rename = "reactivePowerParams")]
4258    #[serde(default, skip_serializing_if = "Option::is_none")]
4259    pub reactive_power_params: Option<ReactivePowerParams>,
4260    /// The `voltageParams` member.
4261    #[serde(rename = "voltageParams")]
4262    #[serde(default, skip_serializing_if = "Option::is_none")]
4263    pub voltage_params: Option<VoltageParams>,
4264    /// Open loop response time, the time to ramp up to 90% of the new target in response to the change in voltage, in seconds. A value of 0 is used to mean no limit. When not present, the device should follow its default behavior.
4265    #[serde(rename = "responseTime")]
4266    #[serde(default, skip_serializing_if = "Option::is_none")]
4267    pub response_time: Option<crate::types::Decimal>,
4268    /// Point in time when this curve will become activated. Only absent when _default_ is true.
4269    #[serde(rename = "startTime")]
4270    #[serde(default, skip_serializing_if = "Option::is_none")]
4271    pub start_time: Option<crate::types::DateTime>,
4272    /// Duration in seconds that this curve will be active. Only absent when _default_ is true.
4273    #[serde(default, skip_serializing_if = "Option::is_none")]
4274    pub duration: Option<crate::types::Decimal>,
4275    /// The `customData` member.
4276    #[serde(rename = "customData")]
4277    #[serde(default, skip_serializing_if = "Option::is_none")]
4278    pub custom_data: Option<crate::types::CustomData>,
4279}
4280
4281impl DERCurve {
4282    /// Creates a `DERCurve` from its required fields.
4283    #[must_use]
4284    pub fn new(curve_data: Vec<DERCurvePoints>, priority: i32, y_unit: DERUnit) -> Self {
4285        Self {
4286            curve_data,
4287            priority,
4288            y_unit,
4289            hysteresis: None,
4290            reactive_power_params: None,
4291            voltage_params: None,
4292            response_time: None,
4293            start_time: None,
4294            duration: None,
4295            custom_data: None,
4296        }
4297    }
4298
4299    /// Sets the optional `hysteresis` field.
4300    #[must_use]
4301    pub fn with_hysteresis(mut self, value: Hysteresis) -> Self {
4302        self.hysteresis = Some(value);
4303        self
4304    }
4305
4306    /// Sets the optional `reactivePowerParams` field.
4307    #[must_use]
4308    pub fn with_reactive_power_params(mut self, value: ReactivePowerParams) -> Self {
4309        self.reactive_power_params = Some(value);
4310        self
4311    }
4312
4313    /// Sets the optional `voltageParams` field.
4314    #[must_use]
4315    pub fn with_voltage_params(mut self, value: VoltageParams) -> Self {
4316        self.voltage_params = Some(value);
4317        self
4318    }
4319
4320    /// Sets the optional `responseTime` field.
4321    #[must_use]
4322    pub fn with_response_time(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4323        self.response_time = Some(value.into());
4324        self
4325    }
4326
4327    /// Sets the optional `startTime` field.
4328    #[must_use]
4329    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
4330        self.start_time = Some(value.into());
4331        self
4332    }
4333
4334    /// Sets the optional `duration` field.
4335    #[must_use]
4336    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4337        self.duration = Some(value.into());
4338        self
4339    }
4340
4341    /// Sets the optional `customData` field.
4342    #[must_use]
4343    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4344        self.custom_data = Some(value);
4345        self
4346    }
4347}
4348
4349impl Validate for DERCurve {
4350    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4351        path.push_key("curveData");
4352        validate::list_len(self.curve_data.len(), Some(1), Some(10), path, out);
4353        for (index, item) in self.curve_data.iter().enumerate() {
4354            path.push_index(index);
4355            Validate::validate_at(item, path, out);
4356            path.pop();
4357        }
4358        path.pop();
4359        path.push_key("priority");
4360        validate::int_range(i64::from(self.priority), Some(0.0), None, path, out);
4361        path.pop();
4362        path.push_key("yUnit");
4363        Validate::validate_at(&self.y_unit, path, out);
4364        path.pop();
4365        path.push_key("hysteresis");
4366        if let Some(value) = &self.hysteresis {
4367            Validate::validate_at(value, path, out);
4368        }
4369        path.pop();
4370        path.push_key("reactivePowerParams");
4371        if let Some(value) = &self.reactive_power_params {
4372            Validate::validate_at(value, path, out);
4373        }
4374        path.pop();
4375        path.push_key("voltageParams");
4376        if let Some(value) = &self.voltage_params {
4377            Validate::validate_at(value, path, out);
4378        }
4379        path.pop();
4380        path.push_key("customData");
4381        if let Some(value) = &self.custom_data {
4382            Validate::validate_at(value, path, out);
4383        }
4384        path.pop();
4385    }
4386}
4387
4388/// The OCPP 2.1 `DERCurveGet` data type.
4389#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4390pub struct DERCurveGet {
4391    /// The `curve` member.
4392    pub curve: DERCurve,
4393    /// Id of DER curve
4394    pub id: String,
4395    /// The `curveType` member.
4396    #[serde(rename = "curveType")]
4397    pub curve_type: DERControl,
4398    /// True if this is a default curve
4399    #[serde(rename = "isDefault")]
4400    pub is_default: bool,
4401    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
4402    #[serde(rename = "isSuperseded")]
4403    pub is_superseded: bool,
4404    /// The `customData` member.
4405    #[serde(rename = "customData")]
4406    #[serde(default, skip_serializing_if = "Option::is_none")]
4407    pub custom_data: Option<crate::types::CustomData>,
4408}
4409
4410impl DERCurveGet {
4411    /// Creates a `DERCurveGet` from its required fields.
4412    #[must_use]
4413    pub fn new(
4414        curve: DERCurve,
4415        id: impl Into<String>,
4416        curve_type: DERControl,
4417        is_default: bool,
4418        is_superseded: bool,
4419    ) -> Self {
4420        Self {
4421            curve,
4422            id: id.into(),
4423            curve_type,
4424            is_default,
4425            is_superseded,
4426            custom_data: None,
4427        }
4428    }
4429
4430    /// Sets the optional `customData` field.
4431    #[must_use]
4432    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4433        self.custom_data = Some(value);
4434        self
4435    }
4436}
4437
4438impl Validate for DERCurveGet {
4439    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4440        path.push_key("curve");
4441        Validate::validate_at(&self.curve, path, out);
4442        path.pop();
4443        path.push_key("id");
4444        validate::string(self.id.as_str(), None, Some(36), path, out);
4445        path.pop();
4446        path.push_key("curveType");
4447        Validate::validate_at(&self.curve_type, path, out);
4448        path.pop();
4449        path.push_key("customData");
4450        if let Some(value) = &self.custom_data {
4451            Validate::validate_at(value, path, out);
4452        }
4453        path.pop();
4454    }
4455}
4456
4457/// The OCPP 2.1 `DERCurvePoints` data type.
4458#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4459pub struct DERCurvePoints {
4460    /// The data value of the X-axis (independent) variable, depending on the curve type.
4461    pub x: crate::types::Decimal,
4462    /// The data value of the Y-axis (dependent) variable, depending on the  &lt;&lt;cmn_derunitenumtype&gt;&gt; of the curve. If _y_ is power factor, then a positive value means DER is absorbing reactive power (under-excited), a negative value when DER is injecting reactive power (over-excited).
4463    pub y: crate::types::Decimal,
4464    /// The `customData` member.
4465    #[serde(rename = "customData")]
4466    #[serde(default, skip_serializing_if = "Option::is_none")]
4467    pub custom_data: Option<crate::types::CustomData>,
4468}
4469
4470impl DERCurvePoints {
4471    /// Creates a `DERCurvePoints` from its required fields.
4472    #[must_use]
4473    pub fn new(x: impl Into<crate::types::Decimal>, y: impl Into<crate::types::Decimal>) -> Self {
4474        Self {
4475            x: x.into(),
4476            y: y.into(),
4477            custom_data: None,
4478        }
4479    }
4480
4481    /// Sets the optional `customData` field.
4482    #[must_use]
4483    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4484        self.custom_data = Some(value);
4485        self
4486    }
4487}
4488
4489impl Validate for DERCurvePoints {
4490    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4491        path.push_key("customData");
4492        if let Some(value) = &self.custom_data {
4493            Validate::validate_at(value, path, out);
4494        }
4495        path.pop();
4496    }
4497}
4498
4499/// *(2.1)* Price schedule of EV energy offer.
4500///
4501/// The OCPP 2.1 `EVAbsolutePriceSchedule` data type.
4502#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4503pub struct EVAbsolutePriceSchedule {
4504    /// Starting point in time of the EVEnergyOffer.
4505    #[serde(rename = "timeAnchor")]
4506    pub time_anchor: crate::types::DateTime,
4507    /// Currency code according to ISO 4217.
4508    pub currency: String,
4509    /// The `evAbsolutePriceScheduleEntries` member.
4510    #[serde(rename = "evAbsolutePriceScheduleEntries")]
4511    pub ev_absolute_price_schedule_entries: Vec<EVAbsolutePriceScheduleEntry>,
4512    /// ISO 15118-20 URN of price algorithm: Power, PeakPower, StackedEnergy.
4513    #[serde(rename = "priceAlgorithm")]
4514    pub price_algorithm: String,
4515    /// The `customData` member.
4516    #[serde(rename = "customData")]
4517    #[serde(default, skip_serializing_if = "Option::is_none")]
4518    pub custom_data: Option<crate::types::CustomData>,
4519}
4520
4521impl EVAbsolutePriceSchedule {
4522    /// Creates a `EVAbsolutePriceSchedule` from its required fields.
4523    #[must_use]
4524    pub fn new(
4525        time_anchor: impl Into<crate::types::DateTime>,
4526        currency: impl Into<String>,
4527        ev_absolute_price_schedule_entries: Vec<EVAbsolutePriceScheduleEntry>,
4528        price_algorithm: impl Into<String>,
4529    ) -> Self {
4530        Self {
4531            time_anchor: time_anchor.into(),
4532            currency: currency.into(),
4533            ev_absolute_price_schedule_entries,
4534            price_algorithm: price_algorithm.into(),
4535            custom_data: None,
4536        }
4537    }
4538
4539    /// Sets the optional `customData` field.
4540    #[must_use]
4541    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4542        self.custom_data = Some(value);
4543        self
4544    }
4545}
4546
4547impl Validate for EVAbsolutePriceSchedule {
4548    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4549        path.push_key("currency");
4550        validate::string(self.currency.as_str(), None, Some(3), path, out);
4551        path.pop();
4552        path.push_key("evAbsolutePriceScheduleEntries");
4553        validate::list_len(
4554            self.ev_absolute_price_schedule_entries.len(),
4555            Some(1),
4556            Some(1024),
4557            path,
4558            out,
4559        );
4560        for (index, item) in self.ev_absolute_price_schedule_entries.iter().enumerate() {
4561            path.push_index(index);
4562            Validate::validate_at(item, path, out);
4563            path.pop();
4564        }
4565        path.pop();
4566        path.push_key("priceAlgorithm");
4567        validate::string(self.price_algorithm.as_str(), None, Some(2000), path, out);
4568        path.pop();
4569        path.push_key("customData");
4570        if let Some(value) = &self.custom_data {
4571            Validate::validate_at(value, path, out);
4572        }
4573        path.pop();
4574    }
4575}
4576
4577/// *(2.1)* An entry in price schedule over time for which EV is willing to discharge.
4578///
4579/// The OCPP 2.1 `EVAbsolutePriceScheduleEntry` data type.
4580#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4581pub struct EVAbsolutePriceScheduleEntry {
4582    /// The amount of seconds of this entry.
4583    pub duration: i32,
4584    /// The `evPriceRule` member.
4585    #[serde(rename = "evPriceRule")]
4586    pub ev_price_rule: Vec<EVPriceRule>,
4587    /// The `customData` member.
4588    #[serde(rename = "customData")]
4589    #[serde(default, skip_serializing_if = "Option::is_none")]
4590    pub custom_data: Option<crate::types::CustomData>,
4591}
4592
4593impl EVAbsolutePriceScheduleEntry {
4594    /// Creates a `EVAbsolutePriceScheduleEntry` from its required fields.
4595    #[must_use]
4596    pub fn new(duration: i32, ev_price_rule: Vec<EVPriceRule>) -> Self {
4597        Self {
4598            duration,
4599            ev_price_rule,
4600            custom_data: None,
4601        }
4602    }
4603
4604    /// Sets the optional `customData` field.
4605    #[must_use]
4606    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4607        self.custom_data = Some(value);
4608        self
4609    }
4610}
4611
4612impl Validate for EVAbsolutePriceScheduleEntry {
4613    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4614        path.push_key("evPriceRule");
4615        validate::list_len(self.ev_price_rule.len(), Some(1), Some(8), path, out);
4616        for (index, item) in self.ev_price_rule.iter().enumerate() {
4617            path.push_index(index);
4618            Validate::validate_at(item, path, out);
4619            path.pop();
4620        }
4621        path.pop();
4622        path.push_key("customData");
4623        if let Some(value) = &self.custom_data {
4624            Validate::validate_at(value, path, out);
4625        }
4626        path.pop();
4627    }
4628}
4629
4630/// *(2.1)* A schedule of the energy amount over time that EV is willing to discharge. A negative value indicates the willingness to discharge under specific conditions, a positive value indicates that the EV currently is not able to offer energy to discharge.
4631///
4632/// The OCPP 2.1 `EVEnergyOffer` data type.
4633#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4634pub struct EVEnergyOffer {
4635    /// The `evPowerSchedule` member.
4636    #[serde(rename = "evPowerSchedule")]
4637    pub ev_power_schedule: EVPowerSchedule,
4638    /// The `evAbsolutePriceSchedule` member.
4639    #[serde(rename = "evAbsolutePriceSchedule")]
4640    #[serde(default, skip_serializing_if = "Option::is_none")]
4641    pub ev_absolute_price_schedule: Option<EVAbsolutePriceSchedule>,
4642    /// The `customData` member.
4643    #[serde(rename = "customData")]
4644    #[serde(default, skip_serializing_if = "Option::is_none")]
4645    pub custom_data: Option<crate::types::CustomData>,
4646}
4647
4648impl EVEnergyOffer {
4649    /// Creates a `EVEnergyOffer` from its required fields.
4650    #[must_use]
4651    pub fn new(ev_power_schedule: EVPowerSchedule) -> Self {
4652        Self {
4653            ev_power_schedule,
4654            ev_absolute_price_schedule: None,
4655            custom_data: None,
4656        }
4657    }
4658
4659    /// Sets the optional `evAbsolutePriceSchedule` field.
4660    #[must_use]
4661    pub fn with_ev_absolute_price_schedule(mut self, value: EVAbsolutePriceSchedule) -> Self {
4662        self.ev_absolute_price_schedule = Some(value);
4663        self
4664    }
4665
4666    /// Sets the optional `customData` field.
4667    #[must_use]
4668    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4669        self.custom_data = Some(value);
4670        self
4671    }
4672}
4673
4674impl Validate for EVEnergyOffer {
4675    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4676        path.push_key("evPowerSchedule");
4677        Validate::validate_at(&self.ev_power_schedule, path, out);
4678        path.pop();
4679        path.push_key("evAbsolutePriceSchedule");
4680        if let Some(value) = &self.ev_absolute_price_schedule {
4681            Validate::validate_at(value, path, out);
4682        }
4683        path.pop();
4684        path.push_key("customData");
4685        if let Some(value) = &self.custom_data {
4686            Validate::validate_at(value, path, out);
4687        }
4688        path.pop();
4689    }
4690}
4691
4692/// *(2.1)* Schedule of EV energy offer.
4693///
4694/// The OCPP 2.1 `EVPowerSchedule` data type.
4695#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4696pub struct EVPowerSchedule {
4697    /// The `evPowerScheduleEntries` member.
4698    #[serde(rename = "evPowerScheduleEntries")]
4699    pub ev_power_schedule_entries: Vec<EVPowerScheduleEntry>,
4700    /// The time that defines the starting point for the EVEnergyOffer.
4701    #[serde(rename = "timeAnchor")]
4702    pub time_anchor: crate::types::DateTime,
4703    /// The `customData` member.
4704    #[serde(rename = "customData")]
4705    #[serde(default, skip_serializing_if = "Option::is_none")]
4706    pub custom_data: Option<crate::types::CustomData>,
4707}
4708
4709impl EVPowerSchedule {
4710    /// Creates a `EVPowerSchedule` from its required fields.
4711    #[must_use]
4712    pub fn new(
4713        ev_power_schedule_entries: Vec<EVPowerScheduleEntry>,
4714        time_anchor: impl Into<crate::types::DateTime>,
4715    ) -> Self {
4716        Self {
4717            ev_power_schedule_entries,
4718            time_anchor: time_anchor.into(),
4719            custom_data: None,
4720        }
4721    }
4722
4723    /// Sets the optional `customData` field.
4724    #[must_use]
4725    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4726        self.custom_data = Some(value);
4727        self
4728    }
4729}
4730
4731impl Validate for EVPowerSchedule {
4732    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4733        path.push_key("evPowerScheduleEntries");
4734        validate::list_len(
4735            self.ev_power_schedule_entries.len(),
4736            Some(1),
4737            Some(1024),
4738            path,
4739            out,
4740        );
4741        for (index, item) in self.ev_power_schedule_entries.iter().enumerate() {
4742            path.push_index(index);
4743            Validate::validate_at(item, path, out);
4744            path.pop();
4745        }
4746        path.pop();
4747        path.push_key("customData");
4748        if let Some(value) = &self.custom_data {
4749            Validate::validate_at(value, path, out);
4750        }
4751        path.pop();
4752    }
4753}
4754
4755/// *(2.1)* An entry in schedule of the energy amount over time that EV is willing to discharge. A negative value indicates the willingness to discharge under specific conditions, a positive value indicates that the EV currently is not able to offer energy to discharge.
4756///
4757/// The OCPP 2.1 `EVPowerScheduleEntry` data type.
4758#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4759pub struct EVPowerScheduleEntry {
4760    /// The duration of this entry.
4761    pub duration: i32,
4762    /// Defines maximum amount of power for the duration of this EVPowerScheduleEntry to be discharged from the EV battery through EVSE power outlet. Negative values are used for discharging.
4763    pub power: crate::types::Decimal,
4764    /// The `customData` member.
4765    #[serde(rename = "customData")]
4766    #[serde(default, skip_serializing_if = "Option::is_none")]
4767    pub custom_data: Option<crate::types::CustomData>,
4768}
4769
4770impl EVPowerScheduleEntry {
4771    /// Creates a `EVPowerScheduleEntry` from its required fields.
4772    #[must_use]
4773    pub fn new(duration: i32, power: impl Into<crate::types::Decimal>) -> Self {
4774        Self {
4775            duration,
4776            power: power.into(),
4777            custom_data: None,
4778        }
4779    }
4780
4781    /// Sets the optional `customData` field.
4782    #[must_use]
4783    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4784        self.custom_data = Some(value);
4785        self
4786    }
4787}
4788
4789impl Validate for EVPowerScheduleEntry {
4790    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4791        path.push_key("customData");
4792        if let Some(value) = &self.custom_data {
4793            Validate::validate_at(value, path, out);
4794        }
4795        path.pop();
4796    }
4797}
4798
4799/// *(2.1)* An entry in price schedule over time for which EV is willing to discharge.
4800///
4801/// The OCPP 2.1 `EVPriceRule` data type.
4802#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4803pub struct EVPriceRule {
4804    /// Cost per kWh.
4805    #[serde(rename = "energyFee")]
4806    pub energy_fee: crate::types::Decimal,
4807    /// The EnergyFee applies between this value and the value of the PowerRangeStart of the subsequent EVPriceRule. If the power is below this value, the EnergyFee of the previous EVPriceRule applies. Negative values are used for discharging.
4808    #[serde(rename = "powerRangeStart")]
4809    pub power_range_start: crate::types::Decimal,
4810    /// The `customData` member.
4811    #[serde(rename = "customData")]
4812    #[serde(default, skip_serializing_if = "Option::is_none")]
4813    pub custom_data: Option<crate::types::CustomData>,
4814}
4815
4816impl EVPriceRule {
4817    /// Creates a `EVPriceRule` from its required fields.
4818    #[must_use]
4819    pub fn new(
4820        energy_fee: impl Into<crate::types::Decimal>,
4821        power_range_start: impl Into<crate::types::Decimal>,
4822    ) -> Self {
4823        Self {
4824            energy_fee: energy_fee.into(),
4825            power_range_start: power_range_start.into(),
4826            custom_data: None,
4827        }
4828    }
4829
4830    /// Sets the optional `customData` field.
4831    #[must_use]
4832    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4833        self.custom_data = Some(value);
4834        self
4835    }
4836}
4837
4838impl Validate for EVPriceRule {
4839    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4840        path.push_key("customData");
4841        if let Some(value) = &self.custom_data {
4842            Validate::validate_at(value, path, out);
4843        }
4844        path.pop();
4845    }
4846}
4847
4848/// Electric Vehicle Supply Equipment
4849///
4850/// The OCPP 2.1 `EVSE` data type.
4851#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4852pub struct EVSE {
4853    /// EVSE Identifier. This contains a number (&gt; 0) designating an EVSE of the Charging Station.
4854    pub id: i32,
4855    /// An id to designate a specific connector (on an EVSE) by connector index number.
4856    #[serde(rename = "connectorId")]
4857    #[serde(default, skip_serializing_if = "Option::is_none")]
4858    pub connector_id: Option<i32>,
4859    /// The `customData` member.
4860    #[serde(rename = "customData")]
4861    #[serde(default, skip_serializing_if = "Option::is_none")]
4862    pub custom_data: Option<crate::types::CustomData>,
4863}
4864
4865impl EVSE {
4866    /// Creates a `EVSE` from its required fields.
4867    #[must_use]
4868    pub fn new(id: i32) -> Self {
4869        Self {
4870            id,
4871            connector_id: None,
4872            custom_data: None,
4873        }
4874    }
4875
4876    /// Sets the optional `connectorId` field.
4877    #[must_use]
4878    pub fn with_connector_id(mut self, value: i32) -> Self {
4879        self.connector_id = Some(value);
4880        self
4881    }
4882
4883    /// Sets the optional `customData` field.
4884    #[must_use]
4885    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4886        self.custom_data = Some(value);
4887        self
4888    }
4889}
4890
4891impl Validate for EVSE {
4892    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4893        path.push_key("id");
4894        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
4895        path.pop();
4896        path.push_key("connectorId");
4897        if let Some(value) = &self.connector_id {
4898            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
4899        }
4900        path.pop();
4901        path.push_key("customData");
4902        if let Some(value) = &self.custom_data {
4903            Validate::validate_at(value, path, out);
4904        }
4905        path.pop();
4906    }
4907}
4908
4909/// The OCPP 2.1 `EnterService` data type.
4910#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4911pub struct EnterService {
4912    /// Priority of setting (0=highest)
4913    pub priority: i32,
4914    /// Enter service voltage high
4915    #[serde(rename = "highVoltage")]
4916    pub high_voltage: crate::types::Decimal,
4917    /// Enter service voltage low
4918    #[serde(rename = "lowVoltage")]
4919    pub low_voltage: crate::types::Decimal,
4920    /// Enter service frequency high
4921    #[serde(rename = "highFreq")]
4922    pub high_freq: crate::types::Decimal,
4923    /// Enter service frequency low
4924    #[serde(rename = "lowFreq")]
4925    pub low_freq: crate::types::Decimal,
4926    /// Enter service delay
4927    #[serde(default, skip_serializing_if = "Option::is_none")]
4928    pub delay: Option<crate::types::Decimal>,
4929    /// Enter service randomized delay
4930    #[serde(rename = "randomDelay")]
4931    #[serde(default, skip_serializing_if = "Option::is_none")]
4932    pub random_delay: Option<crate::types::Decimal>,
4933    /// Enter service ramp rate in seconds
4934    #[serde(rename = "rampRate")]
4935    #[serde(default, skip_serializing_if = "Option::is_none")]
4936    pub ramp_rate: Option<crate::types::Decimal>,
4937    /// The `customData` member.
4938    #[serde(rename = "customData")]
4939    #[serde(default, skip_serializing_if = "Option::is_none")]
4940    pub custom_data: Option<crate::types::CustomData>,
4941}
4942
4943impl EnterService {
4944    /// Creates a `EnterService` from its required fields.
4945    #[must_use]
4946    pub fn new(
4947        priority: i32,
4948        high_voltage: impl Into<crate::types::Decimal>,
4949        low_voltage: impl Into<crate::types::Decimal>,
4950        high_freq: impl Into<crate::types::Decimal>,
4951        low_freq: impl Into<crate::types::Decimal>,
4952    ) -> Self {
4953        Self {
4954            priority,
4955            high_voltage: high_voltage.into(),
4956            low_voltage: low_voltage.into(),
4957            high_freq: high_freq.into(),
4958            low_freq: low_freq.into(),
4959            delay: None,
4960            random_delay: None,
4961            ramp_rate: None,
4962            custom_data: None,
4963        }
4964    }
4965
4966    /// Sets the optional `delay` field.
4967    #[must_use]
4968    pub fn with_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4969        self.delay = Some(value.into());
4970        self
4971    }
4972
4973    /// Sets the optional `randomDelay` field.
4974    #[must_use]
4975    pub fn with_random_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4976        self.random_delay = Some(value.into());
4977        self
4978    }
4979
4980    /// Sets the optional `rampRate` field.
4981    #[must_use]
4982    pub fn with_ramp_rate(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4983        self.ramp_rate = Some(value.into());
4984        self
4985    }
4986
4987    /// Sets the optional `customData` field.
4988    #[must_use]
4989    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4990        self.custom_data = Some(value);
4991        self
4992    }
4993}
4994
4995impl Validate for EnterService {
4996    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4997        path.push_key("priority");
4998        validate::int_range(i64::from(self.priority), Some(0.0), None, path, out);
4999        path.pop();
5000        path.push_key("customData");
5001        if let Some(value) = &self.custom_data {
5002            Validate::validate_at(value, path, out);
5003        }
5004        path.pop();
5005    }
5006}
5007
5008/// The OCPP 2.1 `EnterServiceGet` data type.
5009#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5010pub struct EnterServiceGet {
5011    /// The `enterService` member.
5012    #[serde(rename = "enterService")]
5013    pub enter_service: EnterService,
5014    /// Id of setting
5015    pub id: String,
5016    /// The `customData` member.
5017    #[serde(rename = "customData")]
5018    #[serde(default, skip_serializing_if = "Option::is_none")]
5019    pub custom_data: Option<crate::types::CustomData>,
5020}
5021
5022impl EnterServiceGet {
5023    /// Creates a `EnterServiceGet` from its required fields.
5024    #[must_use]
5025    pub fn new(enter_service: EnterService, id: impl Into<String>) -> Self {
5026        Self {
5027            enter_service,
5028            id: id.into(),
5029            custom_data: None,
5030        }
5031    }
5032
5033    /// Sets the optional `customData` field.
5034    #[must_use]
5035    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5036        self.custom_data = Some(value);
5037        self
5038    }
5039}
5040
5041impl Validate for EnterServiceGet {
5042    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5043        path.push_key("enterService");
5044        Validate::validate_at(&self.enter_service, path, out);
5045        path.pop();
5046        path.push_key("id");
5047        validate::string(self.id.as_str(), None, Some(36), path, out);
5048        path.pop();
5049        path.push_key("customData");
5050        if let Some(value) = &self.custom_data {
5051            Validate::validate_at(value, path, out);
5052        }
5053        path.pop();
5054    }
5055}
5056
5057/// Class to report an event notification for a component-variable.
5058///
5059/// The OCPP 2.1 `EventData` data type.
5060#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5061pub struct EventData {
5062    /// Identifies the event. This field can be referred to as a cause by other events.
5063    #[serde(rename = "eventId")]
5064    pub event_id: i32,
5065    /// Timestamp of the moment the report was generated.
5066    pub timestamp: crate::types::DateTime,
5067    /// The `trigger` member.
5068    pub trigger: EventTrigger,
5069    /// Actual value (_attributeType_ Actual) of the variable.
5070    ///
5071    /// 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.
5072    #[serde(rename = "actualValue")]
5073    pub actual_value: String,
5074    /// The `component` member.
5075    pub component: Component,
5076    /// The `eventNotificationType` member.
5077    #[serde(rename = "eventNotificationType")]
5078    pub event_notification_type: EventNotification,
5079    /// The `variable` member.
5080    pub variable: Variable,
5081    /// Refers to the Id of an event that is considered to be the cause for this event.
5082    #[serde(default, skip_serializing_if = "Option::is_none")]
5083    pub cause: Option<i32>,
5084    /// Technical (error) code as reported by component.
5085    #[serde(rename = "techCode")]
5086    #[serde(default, skip_serializing_if = "Option::is_none")]
5087    pub tech_code: Option<String>,
5088    /// Technical detail information as reported by component.
5089    #[serde(rename = "techInfo")]
5090    #[serde(default, skip_serializing_if = "Option::is_none")]
5091    pub tech_info: Option<String>,
5092    /// _Cleared_ is set to true to report the clearing of a monitored situation, i.e. a 'return to normal'.
5093    #[serde(default, skip_serializing_if = "Option::is_none")]
5094    pub cleared: Option<bool>,
5095    /// If an event notification is linked to a specific transaction, this field can be used to specify its transactionId.
5096    #[serde(rename = "transactionId")]
5097    #[serde(default, skip_serializing_if = "Option::is_none")]
5098    pub transaction_id: Option<String>,
5099    /// Identifies the VariableMonitoring which triggered the event.
5100    #[serde(rename = "variableMonitoringId")]
5101    #[serde(default, skip_serializing_if = "Option::is_none")]
5102    pub variable_monitoring_id: Option<i32>,
5103    /// *(2.1)* Severity associated with the monitor in _variableMonitoringId_ or with the hardwired notification.
5104    #[serde(default, skip_serializing_if = "Option::is_none")]
5105    pub severity: Option<i32>,
5106    /// The `customData` member.
5107    #[serde(rename = "customData")]
5108    #[serde(default, skip_serializing_if = "Option::is_none")]
5109    pub custom_data: Option<crate::types::CustomData>,
5110}
5111
5112impl EventData {
5113    /// Creates a `EventData` from its required fields.
5114    #[must_use]
5115    pub fn new(
5116        event_id: i32,
5117        timestamp: impl Into<crate::types::DateTime>,
5118        trigger: EventTrigger,
5119        actual_value: impl Into<String>,
5120        component: Component,
5121        event_notification_type: EventNotification,
5122        variable: Variable,
5123    ) -> Self {
5124        Self {
5125            event_id,
5126            timestamp: timestamp.into(),
5127            trigger,
5128            actual_value: actual_value.into(),
5129            component,
5130            event_notification_type,
5131            variable,
5132            cause: None,
5133            tech_code: None,
5134            tech_info: None,
5135            cleared: None,
5136            transaction_id: None,
5137            variable_monitoring_id: None,
5138            severity: None,
5139            custom_data: None,
5140        }
5141    }
5142
5143    /// Sets the optional `cause` field.
5144    #[must_use]
5145    pub fn with_cause(mut self, value: i32) -> Self {
5146        self.cause = Some(value);
5147        self
5148    }
5149
5150    /// Sets the optional `techCode` field.
5151    #[must_use]
5152    pub fn with_tech_code(mut self, value: impl Into<String>) -> Self {
5153        self.tech_code = Some(value.into());
5154        self
5155    }
5156
5157    /// Sets the optional `techInfo` field.
5158    #[must_use]
5159    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
5160        self.tech_info = Some(value.into());
5161        self
5162    }
5163
5164    /// Sets the optional `cleared` field.
5165    #[must_use]
5166    pub fn with_cleared(mut self, value: bool) -> Self {
5167        self.cleared = Some(value);
5168        self
5169    }
5170
5171    /// Sets the optional `transactionId` field.
5172    #[must_use]
5173    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
5174        self.transaction_id = Some(value.into());
5175        self
5176    }
5177
5178    /// Sets the optional `variableMonitoringId` field.
5179    #[must_use]
5180    pub fn with_variable_monitoring_id(mut self, value: i32) -> Self {
5181        self.variable_monitoring_id = Some(value);
5182        self
5183    }
5184
5185    /// Sets the optional `severity` field.
5186    #[must_use]
5187    pub fn with_severity(mut self, value: i32) -> Self {
5188        self.severity = Some(value);
5189        self
5190    }
5191
5192    /// Sets the optional `customData` field.
5193    #[must_use]
5194    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5195        self.custom_data = Some(value);
5196        self
5197    }
5198}
5199
5200impl Validate for EventData {
5201    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5202        path.push_key("eventId");
5203        validate::int_range(i64::from(self.event_id), Some(0.0), None, path, out);
5204        path.pop();
5205        path.push_key("trigger");
5206        Validate::validate_at(&self.trigger, path, out);
5207        path.pop();
5208        path.push_key("actualValue");
5209        validate::string(self.actual_value.as_str(), None, Some(2500), path, out);
5210        path.pop();
5211        path.push_key("component");
5212        Validate::validate_at(&self.component, path, out);
5213        path.pop();
5214        path.push_key("eventNotificationType");
5215        Validate::validate_at(&self.event_notification_type, path, out);
5216        path.pop();
5217        path.push_key("variable");
5218        Validate::validate_at(&self.variable, path, out);
5219        path.pop();
5220        path.push_key("cause");
5221        if let Some(value) = &self.cause {
5222            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
5223        }
5224        path.pop();
5225        path.push_key("techCode");
5226        if let Some(value) = &self.tech_code {
5227            validate::string(value.as_str(), None, Some(50), path, out);
5228        }
5229        path.pop();
5230        path.push_key("techInfo");
5231        if let Some(value) = &self.tech_info {
5232            validate::string(value.as_str(), None, Some(500), path, out);
5233        }
5234        path.pop();
5235        path.push_key("transactionId");
5236        if let Some(value) = &self.transaction_id {
5237            validate::string(value.as_str(), None, Some(36), path, out);
5238        }
5239        path.pop();
5240        path.push_key("variableMonitoringId");
5241        if let Some(value) = &self.variable_monitoring_id {
5242            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
5243        }
5244        path.pop();
5245        path.push_key("severity");
5246        if let Some(value) = &self.severity {
5247            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
5248        }
5249        path.pop();
5250        path.push_key("customData");
5251        if let Some(value) = &self.custom_data {
5252            Validate::validate_at(value, path, out);
5253        }
5254        path.pop();
5255    }
5256}
5257
5258/// Represents a copy of the firmware that can be loaded/updated on the Charging Station.
5259///
5260/// The OCPP 2.1 `Firmware` data type.
5261#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5262pub struct Firmware {
5263    /// URI defining the origin of the firmware.
5264    pub location: String,
5265    /// Date and time at which the firmware shall be retrieved.
5266    #[serde(rename = "retrieveDateTime")]
5267    pub retrieve_date_time: crate::types::DateTime,
5268    /// Date and time at which the firmware shall be installed.
5269    #[serde(rename = "installDateTime")]
5270    #[serde(default, skip_serializing_if = "Option::is_none")]
5271    pub install_date_time: Option<crate::types::DateTime>,
5272    /// Certificate with which the firmware was signed.
5273    /// PEM encoded X.509 certificate.
5274    #[serde(rename = "signingCertificate")]
5275    #[serde(default, skip_serializing_if = "Option::is_none")]
5276    pub signing_certificate: Option<String>,
5277    /// Base64 encoded firmware signature.
5278    #[serde(default, skip_serializing_if = "Option::is_none")]
5279    pub signature: Option<String>,
5280    /// The `customData` member.
5281    #[serde(rename = "customData")]
5282    #[serde(default, skip_serializing_if = "Option::is_none")]
5283    pub custom_data: Option<crate::types::CustomData>,
5284}
5285
5286impl Firmware {
5287    /// Creates a `Firmware` from its required fields.
5288    #[must_use]
5289    pub fn new(
5290        location: impl Into<String>,
5291        retrieve_date_time: impl Into<crate::types::DateTime>,
5292    ) -> Self {
5293        Self {
5294            location: location.into(),
5295            retrieve_date_time: retrieve_date_time.into(),
5296            install_date_time: None,
5297            signing_certificate: None,
5298            signature: None,
5299            custom_data: None,
5300        }
5301    }
5302
5303    /// Sets the optional `installDateTime` field.
5304    #[must_use]
5305    pub fn with_install_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5306        self.install_date_time = Some(value.into());
5307        self
5308    }
5309
5310    /// Sets the optional `signingCertificate` field.
5311    #[must_use]
5312    pub fn with_signing_certificate(mut self, value: impl Into<String>) -> Self {
5313        self.signing_certificate = Some(value.into());
5314        self
5315    }
5316
5317    /// Sets the optional `signature` field.
5318    #[must_use]
5319    pub fn with_signature(mut self, value: impl Into<String>) -> Self {
5320        self.signature = Some(value.into());
5321        self
5322    }
5323
5324    /// Sets the optional `customData` field.
5325    #[must_use]
5326    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5327        self.custom_data = Some(value);
5328        self
5329    }
5330}
5331
5332impl Validate for Firmware {
5333    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5334        path.push_key("location");
5335        validate::string(self.location.as_str(), None, Some(2000), path, out);
5336        path.pop();
5337        path.push_key("signingCertificate");
5338        if let Some(value) = &self.signing_certificate {
5339            validate::string(value.as_str(), None, Some(5500), path, out);
5340        }
5341        path.pop();
5342        path.push_key("signature");
5343        if let Some(value) = &self.signature {
5344            validate::string(value.as_str(), None, Some(800), path, out);
5345        }
5346        path.pop();
5347        path.push_key("customData");
5348        if let Some(value) = &self.custom_data {
5349            Validate::validate_at(value, path, out);
5350        }
5351        path.pop();
5352    }
5353}
5354
5355/// The OCPP 2.1 `FixedPF` data type.
5356#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5357pub struct FixedPF {
5358    /// Priority of setting (0=highest)
5359    pub priority: i32,
5360    /// Power factor, cos(phi), as value between 0..1.
5361    pub displacement: crate::types::Decimal,
5362    /// True when absorbing reactive power (under-excited), false when injecting reactive power (over-excited).
5363    pub excitation: bool,
5364    /// Time when this setting becomes active
5365    #[serde(rename = "startTime")]
5366    #[serde(default, skip_serializing_if = "Option::is_none")]
5367    pub start_time: Option<crate::types::DateTime>,
5368    /// Duration in seconds that this setting is active.
5369    #[serde(default, skip_serializing_if = "Option::is_none")]
5370    pub duration: Option<crate::types::Decimal>,
5371    /// The `customData` member.
5372    #[serde(rename = "customData")]
5373    #[serde(default, skip_serializing_if = "Option::is_none")]
5374    pub custom_data: Option<crate::types::CustomData>,
5375}
5376
5377impl FixedPF {
5378    /// Creates a `FixedPF` from its required fields.
5379    #[must_use]
5380    pub fn new(
5381        priority: i32,
5382        displacement: impl Into<crate::types::Decimal>,
5383        excitation: bool,
5384    ) -> Self {
5385        Self {
5386            priority,
5387            displacement: displacement.into(),
5388            excitation,
5389            start_time: None,
5390            duration: None,
5391            custom_data: None,
5392        }
5393    }
5394
5395    /// Sets the optional `startTime` field.
5396    #[must_use]
5397    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5398        self.start_time = Some(value.into());
5399        self
5400    }
5401
5402    /// Sets the optional `duration` field.
5403    #[must_use]
5404    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5405        self.duration = Some(value.into());
5406        self
5407    }
5408
5409    /// Sets the optional `customData` field.
5410    #[must_use]
5411    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5412        self.custom_data = Some(value);
5413        self
5414    }
5415}
5416
5417impl Validate for FixedPF {
5418    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5419        path.push_key("priority");
5420        validate::int_range(i64::from(self.priority), Some(0.0), None, path, out);
5421        path.pop();
5422        path.push_key("customData");
5423        if let Some(value) = &self.custom_data {
5424            Validate::validate_at(value, path, out);
5425        }
5426        path.pop();
5427    }
5428}
5429
5430/// The OCPP 2.1 `FixedPFGet` data type.
5431#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5432pub struct FixedPFGet {
5433    /// The `fixedPF` member.
5434    #[serde(rename = "fixedPF")]
5435    pub fixed_pf: FixedPF,
5436    /// Id of setting.
5437    pub id: String,
5438    /// True if setting is a default control.
5439    #[serde(rename = "isDefault")]
5440    pub is_default: bool,
5441    /// True if this setting is superseded by a lower priority setting.
5442    #[serde(rename = "isSuperseded")]
5443    pub is_superseded: bool,
5444    /// The `customData` member.
5445    #[serde(rename = "customData")]
5446    #[serde(default, skip_serializing_if = "Option::is_none")]
5447    pub custom_data: Option<crate::types::CustomData>,
5448}
5449
5450impl FixedPFGet {
5451    /// Creates a `FixedPFGet` from its required fields.
5452    #[must_use]
5453    pub fn new(
5454        fixed_pf: FixedPF,
5455        id: impl Into<String>,
5456        is_default: bool,
5457        is_superseded: bool,
5458    ) -> Self {
5459        Self {
5460            fixed_pf,
5461            id: id.into(),
5462            is_default,
5463            is_superseded,
5464            custom_data: None,
5465        }
5466    }
5467
5468    /// Sets the optional `customData` field.
5469    #[must_use]
5470    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5471        self.custom_data = Some(value);
5472        self
5473    }
5474}
5475
5476impl Validate for FixedPFGet {
5477    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5478        path.push_key("fixedPF");
5479        Validate::validate_at(&self.fixed_pf, path, out);
5480        path.pop();
5481        path.push_key("id");
5482        validate::string(self.id.as_str(), None, Some(36), path, out);
5483        path.pop();
5484        path.push_key("customData");
5485        if let Some(value) = &self.custom_data {
5486            Validate::validate_at(value, path, out);
5487        }
5488        path.pop();
5489    }
5490}
5491
5492/// The OCPP 2.1 `FixedVar` data type.
5493#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5494pub struct FixedVar {
5495    /// Priority of setting (0=highest)
5496    pub priority: i32,
5497    /// The value specifies a target var output interpreted as a signed percentage (-100 to 100).
5498    ///     A negative value refers to charging, whereas a positive one refers to discharging.
5499    ///     The value type is determined by the unit field.
5500    pub setpoint: crate::types::Decimal,
5501    /// The `unit` member.
5502    pub unit: DERUnit,
5503    /// Time when this setting becomes active.
5504    #[serde(rename = "startTime")]
5505    #[serde(default, skip_serializing_if = "Option::is_none")]
5506    pub start_time: Option<crate::types::DateTime>,
5507    /// Duration in seconds that this setting is active.
5508    #[serde(default, skip_serializing_if = "Option::is_none")]
5509    pub duration: Option<crate::types::Decimal>,
5510    /// The `customData` member.
5511    #[serde(rename = "customData")]
5512    #[serde(default, skip_serializing_if = "Option::is_none")]
5513    pub custom_data: Option<crate::types::CustomData>,
5514}
5515
5516impl FixedVar {
5517    /// Creates a `FixedVar` from its required fields.
5518    #[must_use]
5519    pub fn new(priority: i32, setpoint: impl Into<crate::types::Decimal>, unit: DERUnit) -> Self {
5520        Self {
5521            priority,
5522            setpoint: setpoint.into(),
5523            unit,
5524            start_time: None,
5525            duration: None,
5526            custom_data: None,
5527        }
5528    }
5529
5530    /// Sets the optional `startTime` field.
5531    #[must_use]
5532    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5533        self.start_time = Some(value.into());
5534        self
5535    }
5536
5537    /// Sets the optional `duration` field.
5538    #[must_use]
5539    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5540        self.duration = Some(value.into());
5541        self
5542    }
5543
5544    /// Sets the optional `customData` field.
5545    #[must_use]
5546    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5547        self.custom_data = Some(value);
5548        self
5549    }
5550}
5551
5552impl Validate for FixedVar {
5553    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5554        path.push_key("priority");
5555        validate::int_range(i64::from(self.priority), Some(0.0), None, path, out);
5556        path.pop();
5557        path.push_key("unit");
5558        Validate::validate_at(&self.unit, path, out);
5559        path.pop();
5560        path.push_key("customData");
5561        if let Some(value) = &self.custom_data {
5562            Validate::validate_at(value, path, out);
5563        }
5564        path.pop();
5565    }
5566}
5567
5568/// The OCPP 2.1 `FixedVarGet` data type.
5569#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5570pub struct FixedVarGet {
5571    /// The `fixedVar` member.
5572    #[serde(rename = "fixedVar")]
5573    pub fixed_var: FixedVar,
5574    /// Id of setting
5575    pub id: String,
5576    /// True if setting is a default control.
5577    #[serde(rename = "isDefault")]
5578    pub is_default: bool,
5579    /// True if this setting is superseded by a lower priority setting
5580    #[serde(rename = "isSuperseded")]
5581    pub is_superseded: bool,
5582    /// The `customData` member.
5583    #[serde(rename = "customData")]
5584    #[serde(default, skip_serializing_if = "Option::is_none")]
5585    pub custom_data: Option<crate::types::CustomData>,
5586}
5587
5588impl FixedVarGet {
5589    /// Creates a `FixedVarGet` from its required fields.
5590    #[must_use]
5591    pub fn new(
5592        fixed_var: FixedVar,
5593        id: impl Into<String>,
5594        is_default: bool,
5595        is_superseded: bool,
5596    ) -> Self {
5597        Self {
5598            fixed_var,
5599            id: id.into(),
5600            is_default,
5601            is_superseded,
5602            custom_data: None,
5603        }
5604    }
5605
5606    /// Sets the optional `customData` field.
5607    #[must_use]
5608    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5609        self.custom_data = Some(value);
5610        self
5611    }
5612}
5613
5614impl Validate for FixedVarGet {
5615    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5616        path.push_key("fixedVar");
5617        Validate::validate_at(&self.fixed_var, path, out);
5618        path.pop();
5619        path.push_key("id");
5620        validate::string(self.id.as_str(), None, Some(36), path, out);
5621        path.pop();
5622        path.push_key("customData");
5623        if let Some(value) = &self.custom_data {
5624            Validate::validate_at(value, path, out);
5625        }
5626        path.pop();
5627    }
5628}
5629
5630/// The OCPP 2.1 `FreqDroop` data type.
5631#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5632pub struct FreqDroop {
5633    /// Priority of setting (0=highest)
5634    pub priority: i32,
5635    /// Over-frequency start of droop
5636    #[serde(rename = "overFreq")]
5637    pub over_freq: crate::types::Decimal,
5638    /// Under-frequency start of droop
5639    #[serde(rename = "underFreq")]
5640    pub under_freq: crate::types::Decimal,
5641    /// Over-frequency droop per unit, oFDroop
5642    #[serde(rename = "overDroop")]
5643    pub over_droop: crate::types::Decimal,
5644    /// Under-frequency droop per unit, uFDroop
5645    #[serde(rename = "underDroop")]
5646    pub under_droop: crate::types::Decimal,
5647    /// Open loop response time in seconds
5648    #[serde(rename = "responseTime")]
5649    pub response_time: crate::types::Decimal,
5650    /// Time when this setting becomes active
5651    #[serde(rename = "startTime")]
5652    #[serde(default, skip_serializing_if = "Option::is_none")]
5653    pub start_time: Option<crate::types::DateTime>,
5654    /// Duration in seconds that this setting is active
5655    #[serde(default, skip_serializing_if = "Option::is_none")]
5656    pub duration: Option<crate::types::Decimal>,
5657    /// The `customData` member.
5658    #[serde(rename = "customData")]
5659    #[serde(default, skip_serializing_if = "Option::is_none")]
5660    pub custom_data: Option<crate::types::CustomData>,
5661}
5662
5663impl FreqDroop {
5664    /// Creates a `FreqDroop` from its required fields.
5665    #[must_use]
5666    pub fn new(
5667        priority: i32,
5668        over_freq: impl Into<crate::types::Decimal>,
5669        under_freq: impl Into<crate::types::Decimal>,
5670        over_droop: impl Into<crate::types::Decimal>,
5671        under_droop: impl Into<crate::types::Decimal>,
5672        response_time: impl Into<crate::types::Decimal>,
5673    ) -> Self {
5674        Self {
5675            priority,
5676            over_freq: over_freq.into(),
5677            under_freq: under_freq.into(),
5678            over_droop: over_droop.into(),
5679            under_droop: under_droop.into(),
5680            response_time: response_time.into(),
5681            start_time: None,
5682            duration: None,
5683            custom_data: None,
5684        }
5685    }
5686
5687    /// Sets the optional `startTime` field.
5688    #[must_use]
5689    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5690        self.start_time = Some(value.into());
5691        self
5692    }
5693
5694    /// Sets the optional `duration` field.
5695    #[must_use]
5696    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5697        self.duration = Some(value.into());
5698        self
5699    }
5700
5701    /// Sets the optional `customData` field.
5702    #[must_use]
5703    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5704        self.custom_data = Some(value);
5705        self
5706    }
5707}
5708
5709impl Validate for FreqDroop {
5710    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5711        path.push_key("priority");
5712        validate::int_range(i64::from(self.priority), Some(0.0), None, path, out);
5713        path.pop();
5714        path.push_key("customData");
5715        if let Some(value) = &self.custom_data {
5716            Validate::validate_at(value, path, out);
5717        }
5718        path.pop();
5719    }
5720}
5721
5722/// The OCPP 2.1 `FreqDroopGet` data type.
5723#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5724pub struct FreqDroopGet {
5725    /// The `freqDroop` member.
5726    #[serde(rename = "freqDroop")]
5727    pub freq_droop: FreqDroop,
5728    /// Id of setting
5729    pub id: String,
5730    /// True if setting is a default control.
5731    #[serde(rename = "isDefault")]
5732    pub is_default: bool,
5733    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
5734    #[serde(rename = "isSuperseded")]
5735    pub is_superseded: bool,
5736    /// The `customData` member.
5737    #[serde(rename = "customData")]
5738    #[serde(default, skip_serializing_if = "Option::is_none")]
5739    pub custom_data: Option<crate::types::CustomData>,
5740}
5741
5742impl FreqDroopGet {
5743    /// Creates a `FreqDroopGet` from its required fields.
5744    #[must_use]
5745    pub fn new(
5746        freq_droop: FreqDroop,
5747        id: impl Into<String>,
5748        is_default: bool,
5749        is_superseded: bool,
5750    ) -> Self {
5751        Self {
5752            freq_droop,
5753            id: id.into(),
5754            is_default,
5755            is_superseded,
5756            custom_data: None,
5757        }
5758    }
5759
5760    /// Sets the optional `customData` field.
5761    #[must_use]
5762    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5763        self.custom_data = Some(value);
5764        self
5765    }
5766}
5767
5768impl Validate for FreqDroopGet {
5769    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5770        path.push_key("freqDroop");
5771        Validate::validate_at(&self.freq_droop, path, out);
5772        path.pop();
5773        path.push_key("id");
5774        validate::string(self.id.as_str(), None, Some(36), path, out);
5775        path.pop();
5776        path.push_key("customData");
5777        if let Some(value) = &self.custom_data {
5778            Validate::validate_at(value, path, out);
5779        }
5780        path.pop();
5781    }
5782}
5783
5784/// Class to hold parameters for GetVariables request.
5785///
5786/// The OCPP 2.1 `GetVariableData` data type.
5787#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5788pub struct GetVariableData {
5789    /// The `component` member.
5790    pub component: Component,
5791    /// The `variable` member.
5792    pub variable: Variable,
5793    /// The `attributeType` member.
5794    #[serde(rename = "attributeType")]
5795    #[serde(default, skip_serializing_if = "Option::is_none")]
5796    pub attribute_type: Option<Attribute>,
5797    /// The `customData` member.
5798    #[serde(rename = "customData")]
5799    #[serde(default, skip_serializing_if = "Option::is_none")]
5800    pub custom_data: Option<crate::types::CustomData>,
5801}
5802
5803impl GetVariableData {
5804    /// Creates a `GetVariableData` from its required fields.
5805    #[must_use]
5806    pub fn new(component: Component, variable: Variable) -> Self {
5807        Self {
5808            component,
5809            variable,
5810            attribute_type: None,
5811            custom_data: None,
5812        }
5813    }
5814
5815    /// Sets the optional `attributeType` field.
5816    #[must_use]
5817    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
5818        self.attribute_type = Some(value);
5819        self
5820    }
5821
5822    /// Sets the optional `customData` field.
5823    #[must_use]
5824    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5825        self.custom_data = Some(value);
5826        self
5827    }
5828}
5829
5830impl Validate for GetVariableData {
5831    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5832        path.push_key("component");
5833        Validate::validate_at(&self.component, path, out);
5834        path.pop();
5835        path.push_key("variable");
5836        Validate::validate_at(&self.variable, path, out);
5837        path.pop();
5838        path.push_key("attributeType");
5839        if let Some(value) = &self.attribute_type {
5840            Validate::validate_at(value, path, out);
5841        }
5842        path.pop();
5843        path.push_key("customData");
5844        if let Some(value) = &self.custom_data {
5845            Validate::validate_at(value, path, out);
5846        }
5847        path.pop();
5848    }
5849}
5850
5851/// Class to hold results of GetVariables request.
5852///
5853/// The OCPP 2.1 `GetVariableResult` data type.
5854#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5855pub struct GetVariableResult {
5856    /// The `attributeStatus` member.
5857    #[serde(rename = "attributeStatus")]
5858    pub attribute_status: GetVariableStatus,
5859    /// The `component` member.
5860    pub component: Component,
5861    /// The `variable` member.
5862    pub variable: Variable,
5863    /// The `attributeStatusInfo` member.
5864    #[serde(rename = "attributeStatusInfo")]
5865    #[serde(default, skip_serializing_if = "Option::is_none")]
5866    pub attribute_status_info: Option<StatusInfo>,
5867    /// The `attributeType` member.
5868    #[serde(rename = "attributeType")]
5869    #[serde(default, skip_serializing_if = "Option::is_none")]
5870    pub attribute_type: Option<Attribute>,
5871    /// Value of requested attribute type of component-variable. This field can only be empty when the given status is NOT accepted.
5872    ///
5873    /// 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.
5874    #[serde(rename = "attributeValue")]
5875    #[serde(default, skip_serializing_if = "Option::is_none")]
5876    pub attribute_value: Option<String>,
5877    /// The `customData` member.
5878    #[serde(rename = "customData")]
5879    #[serde(default, skip_serializing_if = "Option::is_none")]
5880    pub custom_data: Option<crate::types::CustomData>,
5881}
5882
5883impl GetVariableResult {
5884    /// Creates a `GetVariableResult` from its required fields.
5885    #[must_use]
5886    pub fn new(
5887        attribute_status: GetVariableStatus,
5888        component: Component,
5889        variable: Variable,
5890    ) -> Self {
5891        Self {
5892            attribute_status,
5893            component,
5894            variable,
5895            attribute_status_info: None,
5896            attribute_type: None,
5897            attribute_value: None,
5898            custom_data: None,
5899        }
5900    }
5901
5902    /// Sets the optional `attributeStatusInfo` field.
5903    #[must_use]
5904    pub fn with_attribute_status_info(mut self, value: StatusInfo) -> Self {
5905        self.attribute_status_info = Some(value);
5906        self
5907    }
5908
5909    /// Sets the optional `attributeType` field.
5910    #[must_use]
5911    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
5912        self.attribute_type = Some(value);
5913        self
5914    }
5915
5916    /// Sets the optional `attributeValue` field.
5917    #[must_use]
5918    pub fn with_attribute_value(mut self, value: impl Into<String>) -> Self {
5919        self.attribute_value = Some(value.into());
5920        self
5921    }
5922
5923    /// Sets the optional `customData` field.
5924    #[must_use]
5925    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5926        self.custom_data = Some(value);
5927        self
5928    }
5929}
5930
5931impl Validate for GetVariableResult {
5932    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5933        path.push_key("attributeStatus");
5934        Validate::validate_at(&self.attribute_status, path, out);
5935        path.pop();
5936        path.push_key("component");
5937        Validate::validate_at(&self.component, path, out);
5938        path.pop();
5939        path.push_key("variable");
5940        Validate::validate_at(&self.variable, path, out);
5941        path.pop();
5942        path.push_key("attributeStatusInfo");
5943        if let Some(value) = &self.attribute_status_info {
5944            Validate::validate_at(value, path, out);
5945        }
5946        path.pop();
5947        path.push_key("attributeType");
5948        if let Some(value) = &self.attribute_type {
5949            Validate::validate_at(value, path, out);
5950        }
5951        path.pop();
5952        path.push_key("attributeValue");
5953        if let Some(value) = &self.attribute_value {
5954            validate::string(value.as_str(), None, Some(2500), path, out);
5955        }
5956        path.pop();
5957        path.push_key("customData");
5958        if let Some(value) = &self.custom_data {
5959            Validate::validate_at(value, path, out);
5960        }
5961        path.pop();
5962    }
5963}
5964
5965/// The OCPP 2.1 `Gradient` data type.
5966#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5967pub struct Gradient {
5968    /// Id of setting
5969    pub priority: i32,
5970    /// Default ramp rate in seconds (0 if not applicable)
5971    pub gradient: crate::types::Decimal,
5972    /// Soft-start ramp rate in seconds (0 if not applicable)
5973    #[serde(rename = "softGradient")]
5974    pub soft_gradient: crate::types::Decimal,
5975    /// The `customData` member.
5976    #[serde(rename = "customData")]
5977    #[serde(default, skip_serializing_if = "Option::is_none")]
5978    pub custom_data: Option<crate::types::CustomData>,
5979}
5980
5981impl Gradient {
5982    /// Creates a `Gradient` from its required fields.
5983    #[must_use]
5984    pub fn new(
5985        priority: i32,
5986        gradient: impl Into<crate::types::Decimal>,
5987        soft_gradient: impl Into<crate::types::Decimal>,
5988    ) -> Self {
5989        Self {
5990            priority,
5991            gradient: gradient.into(),
5992            soft_gradient: soft_gradient.into(),
5993            custom_data: None,
5994        }
5995    }
5996
5997    /// Sets the optional `customData` field.
5998    #[must_use]
5999    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6000        self.custom_data = Some(value);
6001        self
6002    }
6003}
6004
6005impl Validate for Gradient {
6006    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6007        path.push_key("priority");
6008        validate::int_range(i64::from(self.priority), Some(0.0), None, path, out);
6009        path.pop();
6010        path.push_key("customData");
6011        if let Some(value) = &self.custom_data {
6012            Validate::validate_at(value, path, out);
6013        }
6014        path.pop();
6015    }
6016}
6017
6018/// The OCPP 2.1 `GradientGet` data type.
6019#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6020pub struct GradientGet {
6021    /// The `gradient` member.
6022    pub gradient: Gradient,
6023    /// Id of setting
6024    pub id: String,
6025    /// The `customData` member.
6026    #[serde(rename = "customData")]
6027    #[serde(default, skip_serializing_if = "Option::is_none")]
6028    pub custom_data: Option<crate::types::CustomData>,
6029}
6030
6031impl GradientGet {
6032    /// Creates a `GradientGet` from its required fields.
6033    #[must_use]
6034    pub fn new(gradient: Gradient, id: impl Into<String>) -> Self {
6035        Self {
6036            gradient,
6037            id: id.into(),
6038            custom_data: None,
6039        }
6040    }
6041
6042    /// Sets the optional `customData` field.
6043    #[must_use]
6044    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6045        self.custom_data = Some(value);
6046        self
6047    }
6048}
6049
6050impl Validate for GradientGet {
6051    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6052        path.push_key("gradient");
6053        Validate::validate_at(&self.gradient, path, out);
6054        path.pop();
6055        path.push_key("id");
6056        validate::string(self.id.as_str(), None, Some(36), path, out);
6057        path.pop();
6058        path.push_key("customData");
6059        if let Some(value) = &self.custom_data {
6060            Validate::validate_at(value, path, out);
6061        }
6062        path.pop();
6063    }
6064}
6065
6066/// The OCPP 2.1 `Hysteresis` data type.
6067#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6068pub struct Hysteresis {
6069    /// High value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
6070    #[serde(rename = "hysteresisHigh")]
6071    #[serde(default, skip_serializing_if = "Option::is_none")]
6072    pub hysteresis_high: Option<crate::types::Decimal>,
6073    /// Low value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
6074    #[serde(rename = "hysteresisLow")]
6075    #[serde(default, skip_serializing_if = "Option::is_none")]
6076    pub hysteresis_low: Option<crate::types::Decimal>,
6077    /// Delay in seconds, once grid parameter within HysteresisLow and HysteresisHigh, for the EV to return to normal operation after a grid event.
6078    #[serde(rename = "hysteresisDelay")]
6079    #[serde(default, skip_serializing_if = "Option::is_none")]
6080    pub hysteresis_delay: Option<crate::types::Decimal>,
6081    /// Set default rate of change (ramp rate %/s) for the EV to return to normal operation after a grid event
6082    #[serde(rename = "hysteresisGradient")]
6083    #[serde(default, skip_serializing_if = "Option::is_none")]
6084    pub hysteresis_gradient: Option<crate::types::Decimal>,
6085    /// The `customData` member.
6086    #[serde(rename = "customData")]
6087    #[serde(default, skip_serializing_if = "Option::is_none")]
6088    pub custom_data: Option<crate::types::CustomData>,
6089}
6090
6091impl Hysteresis {
6092    /// Creates an empty `Hysteresis`. Every field of this type is optional.
6093    #[must_use]
6094    pub fn new() -> Self {
6095        Self::default()
6096    }
6097
6098    /// Sets the optional `hysteresisHigh` field.
6099    #[must_use]
6100    pub fn with_hysteresis_high(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6101        self.hysteresis_high = Some(value.into());
6102        self
6103    }
6104
6105    /// Sets the optional `hysteresisLow` field.
6106    #[must_use]
6107    pub fn with_hysteresis_low(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6108        self.hysteresis_low = Some(value.into());
6109        self
6110    }
6111
6112    /// Sets the optional `hysteresisDelay` field.
6113    #[must_use]
6114    pub fn with_hysteresis_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6115        self.hysteresis_delay = Some(value.into());
6116        self
6117    }
6118
6119    /// Sets the optional `hysteresisGradient` field.
6120    #[must_use]
6121    pub fn with_hysteresis_gradient(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6122        self.hysteresis_gradient = Some(value.into());
6123        self
6124    }
6125
6126    /// Sets the optional `customData` field.
6127    #[must_use]
6128    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6129        self.custom_data = Some(value);
6130        self
6131    }
6132}
6133
6134impl Validate for Hysteresis {
6135    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6136        path.push_key("customData");
6137        if let Some(value) = &self.custom_data {
6138            Validate::validate_at(value, path, out);
6139        }
6140        path.pop();
6141    }
6142}
6143
6144/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
6145///
6146/// The OCPP 2.1 `IdToken` data type.
6147#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6148pub struct IdToken {
6149    /// *(2.1)* IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also contain a UUID.
6150    #[serde(rename = "idToken")]
6151    pub id_token: String,
6152    /// *(2.1)* Enumeration of possible idToken types. Values defined in Appendix as IdTokenEnumStringType.
6153    pub r#type: String,
6154    /// The `additionalInfo` member.
6155    #[serde(rename = "additionalInfo")]
6156    #[serde(default, skip_serializing_if = "Option::is_none")]
6157    pub additional_info: Option<Vec<AdditionalInfo>>,
6158    /// The `customData` member.
6159    #[serde(rename = "customData")]
6160    #[serde(default, skip_serializing_if = "Option::is_none")]
6161    pub custom_data: Option<crate::types::CustomData>,
6162}
6163
6164impl IdToken {
6165    /// Creates a `IdToken` from its required fields.
6166    #[must_use]
6167    pub fn new(id_token: impl Into<String>, r#type: impl Into<String>) -> Self {
6168        Self {
6169            id_token: id_token.into(),
6170            r#type: r#type.into(),
6171            additional_info: None,
6172            custom_data: None,
6173        }
6174    }
6175
6176    /// Sets the optional `additionalInfo` field.
6177    #[must_use]
6178    pub fn with_additional_info(mut self, value: Vec<AdditionalInfo>) -> Self {
6179        self.additional_info = Some(value);
6180        self
6181    }
6182
6183    /// Sets the optional `customData` field.
6184    #[must_use]
6185    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6186        self.custom_data = Some(value);
6187        self
6188    }
6189}
6190
6191impl Validate for IdToken {
6192    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6193        path.push_key("idToken");
6194        validate::string(self.id_token.as_str(), None, Some(255), path, out);
6195        path.pop();
6196        path.push_key("type");
6197        validate::string(self.r#type.as_str(), None, Some(20), path, out);
6198        path.pop();
6199        path.push_key("additionalInfo");
6200        if let Some(value) = &self.additional_info {
6201            validate::list_len(value.len(), Some(1), None, path, out);
6202            for (index, item) in value.iter().enumerate() {
6203                path.push_index(index);
6204                Validate::validate_at(item, path, out);
6205                path.pop();
6206            }
6207        }
6208        path.pop();
6209        path.push_key("customData");
6210        if let Some(value) = &self.custom_data {
6211            Validate::validate_at(value, path, out);
6212        }
6213        path.pop();
6214    }
6215}
6216
6217/// Contains status information about an identifier.
6218/// 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.
6219///
6220/// The OCPP 2.1 `IdTokenInfo` data type.
6221#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6222pub struct IdTokenInfo {
6223    /// The `status` member.
6224    pub status: AuthorizationStatus,
6225    /// Date and Time after which the token must be considered invalid.
6226    #[serde(rename = "cacheExpiryDateTime")]
6227    #[serde(default, skip_serializing_if = "Option::is_none")]
6228    pub cache_expiry_date_time: Option<crate::types::DateTime>,
6229    /// 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.
6230    #[serde(rename = "chargingPriority")]
6231    #[serde(default, skip_serializing_if = "Option::is_none")]
6232    pub charging_priority: Option<i32>,
6233    /// The `groupIdToken` member.
6234    #[serde(rename = "groupIdToken")]
6235    #[serde(default, skip_serializing_if = "Option::is_none")]
6236    pub group_id_token: Option<IdToken>,
6237    /// Preferred user interface language of identifier user. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
6238    #[serde(default, skip_serializing_if = "Option::is_none")]
6239    pub language1: Option<String>,
6240    /// 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;.
6241    #[serde(default, skip_serializing_if = "Option::is_none")]
6242    pub language2: Option<String>,
6243    /// Only used when the IdToken is only valid for one or more specific EVSEs, not for the entire Charging Station.
6244    #[serde(rename = "evseId")]
6245    #[serde(default, skip_serializing_if = "Option::is_none")]
6246    pub evse_id: Option<Vec<i32>>,
6247    /// The `personalMessage` member.
6248    #[serde(rename = "personalMessage")]
6249    #[serde(default, skip_serializing_if = "Option::is_none")]
6250    pub personal_message: Option<MessageContent>,
6251    /// The `customData` member.
6252    #[serde(rename = "customData")]
6253    #[serde(default, skip_serializing_if = "Option::is_none")]
6254    pub custom_data: Option<crate::types::CustomData>,
6255}
6256
6257impl IdTokenInfo {
6258    /// Creates a `IdTokenInfo` from its required fields.
6259    #[must_use]
6260    pub fn new(status: AuthorizationStatus) -> Self {
6261        Self {
6262            status,
6263            cache_expiry_date_time: None,
6264            charging_priority: None,
6265            group_id_token: None,
6266            language1: None,
6267            language2: None,
6268            evse_id: None,
6269            personal_message: None,
6270            custom_data: None,
6271        }
6272    }
6273
6274    /// Sets the optional `cacheExpiryDateTime` field.
6275    #[must_use]
6276    pub fn with_cache_expiry_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6277        self.cache_expiry_date_time = Some(value.into());
6278        self
6279    }
6280
6281    /// Sets the optional `chargingPriority` field.
6282    #[must_use]
6283    pub fn with_charging_priority(mut self, value: i32) -> Self {
6284        self.charging_priority = Some(value);
6285        self
6286    }
6287
6288    /// Sets the optional `groupIdToken` field.
6289    #[must_use]
6290    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
6291        self.group_id_token = Some(value);
6292        self
6293    }
6294
6295    /// Sets the optional `language1` field.
6296    #[must_use]
6297    pub fn with_language1(mut self, value: impl Into<String>) -> Self {
6298        self.language1 = Some(value.into());
6299        self
6300    }
6301
6302    /// Sets the optional `language2` field.
6303    #[must_use]
6304    pub fn with_language2(mut self, value: impl Into<String>) -> Self {
6305        self.language2 = Some(value.into());
6306        self
6307    }
6308
6309    /// Sets the optional `evseId` field.
6310    #[must_use]
6311    pub fn with_evse_id(mut self, value: Vec<i32>) -> Self {
6312        self.evse_id = Some(value);
6313        self
6314    }
6315
6316    /// Sets the optional `personalMessage` field.
6317    #[must_use]
6318    pub fn with_personal_message(mut self, value: MessageContent) -> Self {
6319        self.personal_message = Some(value);
6320        self
6321    }
6322
6323    /// Sets the optional `customData` field.
6324    #[must_use]
6325    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6326        self.custom_data = Some(value);
6327        self
6328    }
6329}
6330
6331impl Validate for IdTokenInfo {
6332    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6333        path.push_key("status");
6334        Validate::validate_at(&self.status, path, out);
6335        path.pop();
6336        path.push_key("groupIdToken");
6337        if let Some(value) = &self.group_id_token {
6338            Validate::validate_at(value, path, out);
6339        }
6340        path.pop();
6341        path.push_key("language1");
6342        if let Some(value) = &self.language1 {
6343            validate::string(value.as_str(), None, Some(8), path, out);
6344        }
6345        path.pop();
6346        path.push_key("language2");
6347        if let Some(value) = &self.language2 {
6348            validate::string(value.as_str(), None, Some(8), path, out);
6349        }
6350        path.pop();
6351        path.push_key("evseId");
6352        if let Some(value) = &self.evse_id {
6353            validate::list_len(value.len(), Some(1), None, path, out);
6354            for (index, item) in value.iter().enumerate() {
6355                path.push_index(index);
6356                validate::int_range(i64::from(*item), Some(0.0), None, path, out);
6357                path.pop();
6358            }
6359        }
6360        path.pop();
6361        path.push_key("personalMessage");
6362        if let Some(value) = &self.personal_message {
6363            Validate::validate_at(value, path, out);
6364        }
6365        path.pop();
6366        path.push_key("customData");
6367        if let Some(value) = &self.custom_data {
6368            Validate::validate_at(value, path, out);
6369        }
6370        path.pop();
6371    }
6372}
6373
6374/// The OCPP 2.1 `LimitAtSoC` data type.
6375#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6376pub struct LimitAtSoC {
6377    /// The SoC value beyond which the charging rate limit should be applied.
6378    pub soc: i32,
6379    /// Charging rate limit beyond the SoC value.
6380    /// The unit is defined by _chargingSchedule.chargingRateUnit_.
6381    pub limit: crate::types::Decimal,
6382    /// The `customData` member.
6383    #[serde(rename = "customData")]
6384    #[serde(default, skip_serializing_if = "Option::is_none")]
6385    pub custom_data: Option<crate::types::CustomData>,
6386}
6387
6388impl LimitAtSoC {
6389    /// Creates a `LimitAtSoC` from its required fields.
6390    #[must_use]
6391    pub fn new(soc: i32, limit: impl Into<crate::types::Decimal>) -> Self {
6392        Self {
6393            soc,
6394            limit: limit.into(),
6395            custom_data: None,
6396        }
6397    }
6398
6399    /// Sets the optional `customData` field.
6400    #[must_use]
6401    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6402        self.custom_data = Some(value);
6403        self
6404    }
6405}
6406
6407impl Validate for LimitAtSoC {
6408    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6409        path.push_key("soc");
6410        validate::int_range(i64::from(self.soc), Some(0.0), Some(100.0), path, out);
6411        path.pop();
6412        path.push_key("customData");
6413        if let Some(value) = &self.custom_data {
6414            Validate::validate_at(value, path, out);
6415        }
6416        path.pop();
6417    }
6418}
6419
6420/// The OCPP 2.1 `LimitMaxDischarge` data type.
6421#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6422pub struct LimitMaxDischarge {
6423    /// Priority of setting (0=highest)
6424    pub priority: i32,
6425    /// Only for PowerMonitoring. +
6426    ///     The value specifies a percentage (0 to 100) of the rated maximum discharge power of EV.
6427    ///     The PowerMonitoring curve becomes active when power exceeds this percentage.
6428    #[serde(rename = "pctMaxDischargePower")]
6429    #[serde(default, skip_serializing_if = "Option::is_none")]
6430    pub pct_max_discharge_power: Option<crate::types::Decimal>,
6431    /// The `powerMonitoringMustTrip` member.
6432    #[serde(rename = "powerMonitoringMustTrip")]
6433    #[serde(default, skip_serializing_if = "Option::is_none")]
6434    pub power_monitoring_must_trip: Option<DERCurve>,
6435    /// Time when this setting becomes active
6436    #[serde(rename = "startTime")]
6437    #[serde(default, skip_serializing_if = "Option::is_none")]
6438    pub start_time: Option<crate::types::DateTime>,
6439    /// Duration in seconds that this setting is active
6440    #[serde(default, skip_serializing_if = "Option::is_none")]
6441    pub duration: Option<crate::types::Decimal>,
6442    /// The `customData` member.
6443    #[serde(rename = "customData")]
6444    #[serde(default, skip_serializing_if = "Option::is_none")]
6445    pub custom_data: Option<crate::types::CustomData>,
6446}
6447
6448impl LimitMaxDischarge {
6449    /// Creates a `LimitMaxDischarge` from its required fields.
6450    #[must_use]
6451    pub fn new(priority: i32) -> Self {
6452        Self {
6453            priority,
6454            pct_max_discharge_power: None,
6455            power_monitoring_must_trip: None,
6456            start_time: None,
6457            duration: None,
6458            custom_data: None,
6459        }
6460    }
6461
6462    /// Sets the optional `pctMaxDischargePower` field.
6463    #[must_use]
6464    pub fn with_pct_max_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6465        self.pct_max_discharge_power = Some(value.into());
6466        self
6467    }
6468
6469    /// Sets the optional `powerMonitoringMustTrip` field.
6470    #[must_use]
6471    pub fn with_power_monitoring_must_trip(mut self, value: DERCurve) -> Self {
6472        self.power_monitoring_must_trip = Some(value);
6473        self
6474    }
6475
6476    /// Sets the optional `startTime` field.
6477    #[must_use]
6478    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6479        self.start_time = Some(value.into());
6480        self
6481    }
6482
6483    /// Sets the optional `duration` field.
6484    #[must_use]
6485    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6486        self.duration = Some(value.into());
6487        self
6488    }
6489
6490    /// Sets the optional `customData` field.
6491    #[must_use]
6492    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6493        self.custom_data = Some(value);
6494        self
6495    }
6496}
6497
6498impl Validate for LimitMaxDischarge {
6499    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6500        path.push_key("priority");
6501        validate::int_range(i64::from(self.priority), Some(0.0), None, path, out);
6502        path.pop();
6503        path.push_key("powerMonitoringMustTrip");
6504        if let Some(value) = &self.power_monitoring_must_trip {
6505            Validate::validate_at(value, path, out);
6506        }
6507        path.pop();
6508        path.push_key("customData");
6509        if let Some(value) = &self.custom_data {
6510            Validate::validate_at(value, path, out);
6511        }
6512        path.pop();
6513    }
6514}
6515
6516/// The OCPP 2.1 `LimitMaxDischargeGet` data type.
6517#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6518pub struct LimitMaxDischargeGet {
6519    /// Id of setting
6520    pub id: String,
6521    /// True if setting is a default control.
6522    #[serde(rename = "isDefault")]
6523    pub is_default: bool,
6524    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
6525    #[serde(rename = "isSuperseded")]
6526    pub is_superseded: bool,
6527    /// The `limitMaxDischarge` member.
6528    #[serde(rename = "limitMaxDischarge")]
6529    pub limit_max_discharge: LimitMaxDischarge,
6530    /// The `customData` member.
6531    #[serde(rename = "customData")]
6532    #[serde(default, skip_serializing_if = "Option::is_none")]
6533    pub custom_data: Option<crate::types::CustomData>,
6534}
6535
6536impl LimitMaxDischargeGet {
6537    /// Creates a `LimitMaxDischargeGet` from its required fields.
6538    #[must_use]
6539    pub fn new(
6540        id: impl Into<String>,
6541        is_default: bool,
6542        is_superseded: bool,
6543        limit_max_discharge: LimitMaxDischarge,
6544    ) -> Self {
6545        Self {
6546            id: id.into(),
6547            is_default,
6548            is_superseded,
6549            limit_max_discharge,
6550            custom_data: None,
6551        }
6552    }
6553
6554    /// Sets the optional `customData` field.
6555    #[must_use]
6556    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6557        self.custom_data = Some(value);
6558        self
6559    }
6560}
6561
6562impl Validate for LimitMaxDischargeGet {
6563    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6564        path.push_key("id");
6565        validate::string(self.id.as_str(), None, Some(36), path, out);
6566        path.pop();
6567        path.push_key("limitMaxDischarge");
6568        Validate::validate_at(&self.limit_max_discharge, path, out);
6569        path.pop();
6570        path.push_key("customData");
6571        if let Some(value) = &self.custom_data {
6572            Validate::validate_at(value, path, out);
6573        }
6574        path.pop();
6575    }
6576}
6577
6578/// Generic class for the configuration of logging entries.
6579///
6580/// The OCPP 2.1 `LogParameters` data type.
6581#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6582pub struct LogParameters {
6583    /// The URL of the location at the remote system where the log should be stored.
6584    #[serde(rename = "remoteLocation")]
6585    pub remote_location: String,
6586    /// This contains the date and time of the oldest logging information to include in the diagnostics.
6587    #[serde(rename = "oldestTimestamp")]
6588    #[serde(default, skip_serializing_if = "Option::is_none")]
6589    pub oldest_timestamp: Option<crate::types::DateTime>,
6590    /// This contains the date and time of the latest logging information to include in the diagnostics.
6591    #[serde(rename = "latestTimestamp")]
6592    #[serde(default, skip_serializing_if = "Option::is_none")]
6593    pub latest_timestamp: Option<crate::types::DateTime>,
6594    /// The `customData` member.
6595    #[serde(rename = "customData")]
6596    #[serde(default, skip_serializing_if = "Option::is_none")]
6597    pub custom_data: Option<crate::types::CustomData>,
6598}
6599
6600impl LogParameters {
6601    /// Creates a `LogParameters` from its required fields.
6602    #[must_use]
6603    pub fn new(remote_location: impl Into<String>) -> Self {
6604        Self {
6605            remote_location: remote_location.into(),
6606            oldest_timestamp: None,
6607            latest_timestamp: None,
6608            custom_data: None,
6609        }
6610    }
6611
6612    /// Sets the optional `oldestTimestamp` field.
6613    #[must_use]
6614    pub fn with_oldest_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6615        self.oldest_timestamp = Some(value.into());
6616        self
6617    }
6618
6619    /// Sets the optional `latestTimestamp` field.
6620    #[must_use]
6621    pub fn with_latest_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6622        self.latest_timestamp = Some(value.into());
6623        self
6624    }
6625
6626    /// Sets the optional `customData` field.
6627    #[must_use]
6628    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6629        self.custom_data = Some(value);
6630        self
6631    }
6632}
6633
6634impl Validate for LogParameters {
6635    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6636        path.push_key("remoteLocation");
6637        validate::string(self.remote_location.as_str(), None, Some(2000), path, out);
6638        path.pop();
6639        path.push_key("customData");
6640        if let Some(value) = &self.custom_data {
6641            Validate::validate_at(value, path, out);
6642        }
6643        path.pop();
6644    }
6645}
6646
6647/// Contains message details, for a message to be displayed on a Charging Station.
6648///
6649/// The OCPP 2.1 `MessageContent` data type.
6650#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6651pub struct MessageContent {
6652    /// The `format` member.
6653    pub format: MessageFormat,
6654    /// *(2.1)* Required. Message contents. +
6655    /// Maximum length supported by Charging Station is given in OCPPCommCtrlr.FieldLength\["MessageContentType.content"\].
6656    ///     Maximum length defaults to 1024.
6657    pub content: String,
6658    /// Message language identifier. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
6659    #[serde(default, skip_serializing_if = "Option::is_none")]
6660    pub language: Option<String>,
6661    /// The `customData` member.
6662    #[serde(rename = "customData")]
6663    #[serde(default, skip_serializing_if = "Option::is_none")]
6664    pub custom_data: Option<crate::types::CustomData>,
6665}
6666
6667impl MessageContent {
6668    /// Creates a `MessageContent` from its required fields.
6669    #[must_use]
6670    pub fn new(format: MessageFormat, content: impl Into<String>) -> Self {
6671        Self {
6672            format,
6673            content: content.into(),
6674            language: None,
6675            custom_data: None,
6676        }
6677    }
6678
6679    /// Sets the optional `language` field.
6680    #[must_use]
6681    pub fn with_language(mut self, value: impl Into<String>) -> Self {
6682        self.language = Some(value.into());
6683        self
6684    }
6685
6686    /// Sets the optional `customData` field.
6687    #[must_use]
6688    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6689        self.custom_data = Some(value);
6690        self
6691    }
6692}
6693
6694impl Validate for MessageContent {
6695    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6696        path.push_key("format");
6697        Validate::validate_at(&self.format, path, out);
6698        path.pop();
6699        path.push_key("content");
6700        validate::string(self.content.as_str(), None, Some(1024), path, out);
6701        path.pop();
6702        path.push_key("language");
6703        if let Some(value) = &self.language {
6704            validate::string(value.as_str(), None, Some(8), path, out);
6705        }
6706        path.pop();
6707        path.push_key("customData");
6708        if let Some(value) = &self.custom_data {
6709            Validate::validate_at(value, path, out);
6710        }
6711        path.pop();
6712    }
6713}
6714
6715/// Contains message details, for a message to be displayed on a Charging Station.
6716///
6717/// The OCPP 2.1 `MessageInfo` data type.
6718#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6719pub struct MessageInfo {
6720    /// Unique id within an exchange context. It is defined within the OCPP context as a positive Integer value (greater or equal to zero).
6721    pub id: i32,
6722    /// The `priority` member.
6723    pub priority: MessagePriority,
6724    /// The `message` member.
6725    pub message: MessageContent,
6726    /// The `display` member.
6727    #[serde(default, skip_serializing_if = "Option::is_none")]
6728    pub display: Option<Component>,
6729    /// The `state` member.
6730    #[serde(default, skip_serializing_if = "Option::is_none")]
6731    pub state: Option<MessageState>,
6732    /// From what date-time should this message be shown. If omitted: directly.
6733    #[serde(rename = "startDateTime")]
6734    #[serde(default, skip_serializing_if = "Option::is_none")]
6735    pub start_date_time: Option<crate::types::DateTime>,
6736    /// Until what date-time should this message be shown, after this date/time this message SHALL be removed.
6737    #[serde(rename = "endDateTime")]
6738    #[serde(default, skip_serializing_if = "Option::is_none")]
6739    pub end_date_time: Option<crate::types::DateTime>,
6740    /// During which transaction shall this message be shown.
6741    /// Message SHALL be removed by the Charging Station after transaction has
6742    /// ended.
6743    #[serde(rename = "transactionId")]
6744    #[serde(default, skip_serializing_if = "Option::is_none")]
6745    pub transaction_id: Option<String>,
6746    /// The `messageExtra` member.
6747    #[serde(rename = "messageExtra")]
6748    #[serde(default, skip_serializing_if = "Option::is_none")]
6749    pub message_extra: Option<Vec<MessageContent>>,
6750    /// The `customData` member.
6751    #[serde(rename = "customData")]
6752    #[serde(default, skip_serializing_if = "Option::is_none")]
6753    pub custom_data: Option<crate::types::CustomData>,
6754}
6755
6756impl MessageInfo {
6757    /// Creates a `MessageInfo` from its required fields.
6758    #[must_use]
6759    pub fn new(id: i32, priority: MessagePriority, message: MessageContent) -> Self {
6760        Self {
6761            id,
6762            priority,
6763            message,
6764            display: None,
6765            state: None,
6766            start_date_time: None,
6767            end_date_time: None,
6768            transaction_id: None,
6769            message_extra: None,
6770            custom_data: None,
6771        }
6772    }
6773
6774    /// Sets the optional `display` field.
6775    #[must_use]
6776    pub fn with_display(mut self, value: Component) -> Self {
6777        self.display = Some(value);
6778        self
6779    }
6780
6781    /// Sets the optional `state` field.
6782    #[must_use]
6783    pub fn with_state(mut self, value: MessageState) -> Self {
6784        self.state = Some(value);
6785        self
6786    }
6787
6788    /// Sets the optional `startDateTime` field.
6789    #[must_use]
6790    pub fn with_start_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6791        self.start_date_time = Some(value.into());
6792        self
6793    }
6794
6795    /// Sets the optional `endDateTime` field.
6796    #[must_use]
6797    pub fn with_end_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6798        self.end_date_time = Some(value.into());
6799        self
6800    }
6801
6802    /// Sets the optional `transactionId` field.
6803    #[must_use]
6804    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
6805        self.transaction_id = Some(value.into());
6806        self
6807    }
6808
6809    /// Sets the optional `messageExtra` field.
6810    #[must_use]
6811    pub fn with_message_extra(mut self, value: Vec<MessageContent>) -> Self {
6812        self.message_extra = Some(value);
6813        self
6814    }
6815
6816    /// Sets the optional `customData` field.
6817    #[must_use]
6818    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6819        self.custom_data = Some(value);
6820        self
6821    }
6822}
6823
6824impl Validate for MessageInfo {
6825    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6826        path.push_key("id");
6827        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
6828        path.pop();
6829        path.push_key("priority");
6830        Validate::validate_at(&self.priority, path, out);
6831        path.pop();
6832        path.push_key("message");
6833        Validate::validate_at(&self.message, path, out);
6834        path.pop();
6835        path.push_key("display");
6836        if let Some(value) = &self.display {
6837            Validate::validate_at(value, path, out);
6838        }
6839        path.pop();
6840        path.push_key("state");
6841        if let Some(value) = &self.state {
6842            Validate::validate_at(value, path, out);
6843        }
6844        path.pop();
6845        path.push_key("transactionId");
6846        if let Some(value) = &self.transaction_id {
6847            validate::string(value.as_str(), None, Some(36), path, out);
6848        }
6849        path.pop();
6850        path.push_key("messageExtra");
6851        if let Some(value) = &self.message_extra {
6852            validate::list_len(value.len(), Some(1), Some(4), path, out);
6853            for (index, item) in value.iter().enumerate() {
6854                path.push_index(index);
6855                Validate::validate_at(item, path, out);
6856                path.pop();
6857            }
6858        }
6859        path.pop();
6860        path.push_key("customData");
6861        if let Some(value) = &self.custom_data {
6862            Validate::validate_at(value, path, out);
6863        }
6864        path.pop();
6865    }
6866}
6867
6868/// 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.
6869///
6870/// The OCPP 2.1 `MeterValue` data type.
6871#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6872pub struct MeterValue {
6873    /// The `sampledValue` member.
6874    #[serde(rename = "sampledValue")]
6875    pub sampled_value: Vec<SampledValue>,
6876    /// Timestamp for measured value(s).
6877    pub timestamp: crate::types::DateTime,
6878    /// The `customData` member.
6879    #[serde(rename = "customData")]
6880    #[serde(default, skip_serializing_if = "Option::is_none")]
6881    pub custom_data: Option<crate::types::CustomData>,
6882}
6883
6884impl MeterValue {
6885    /// Creates a `MeterValue` from its required fields.
6886    #[must_use]
6887    pub fn new(
6888        sampled_value: Vec<SampledValue>,
6889        timestamp: impl Into<crate::types::DateTime>,
6890    ) -> Self {
6891        Self {
6892            sampled_value,
6893            timestamp: timestamp.into(),
6894            custom_data: None,
6895        }
6896    }
6897
6898    /// Sets the optional `customData` field.
6899    #[must_use]
6900    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6901        self.custom_data = Some(value);
6902        self
6903    }
6904}
6905
6906impl Validate for MeterValue {
6907    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6908        path.push_key("sampledValue");
6909        validate::list_len(self.sampled_value.len(), Some(1), None, path, out);
6910        for (index, item) in self.sampled_value.iter().enumerate() {
6911            path.push_index(index);
6912            Validate::validate_at(item, path, out);
6913            path.pop();
6914        }
6915        path.pop();
6916        path.push_key("customData");
6917        if let Some(value) = &self.custom_data {
6918            Validate::validate_at(value, path, out);
6919        }
6920        path.pop();
6921    }
6922}
6923
6924/// Defines parameters required for initiating and maintaining wireless communication with other devices.
6925///
6926/// The OCPP 2.1 `Modem` data type.
6927#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6928pub struct Modem {
6929    /// This contains the ICCID of the modem’s SIM card.
6930    #[serde(default, skip_serializing_if = "Option::is_none")]
6931    pub iccid: Option<String>,
6932    /// This contains the IMSI of the modem’s SIM card.
6933    #[serde(default, skip_serializing_if = "Option::is_none")]
6934    pub imsi: Option<String>,
6935    /// The `customData` member.
6936    #[serde(rename = "customData")]
6937    #[serde(default, skip_serializing_if = "Option::is_none")]
6938    pub custom_data: Option<crate::types::CustomData>,
6939}
6940
6941impl Modem {
6942    /// Creates an empty `Modem`. Every field of this type is optional.
6943    #[must_use]
6944    pub fn new() -> Self {
6945        Self::default()
6946    }
6947
6948    /// Sets the optional `iccid` field.
6949    #[must_use]
6950    pub fn with_iccid(mut self, value: impl Into<String>) -> Self {
6951        self.iccid = Some(value.into());
6952        self
6953    }
6954
6955    /// Sets the optional `imsi` field.
6956    #[must_use]
6957    pub fn with_imsi(mut self, value: impl Into<String>) -> Self {
6958        self.imsi = Some(value.into());
6959        self
6960    }
6961
6962    /// Sets the optional `customData` field.
6963    #[must_use]
6964    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6965        self.custom_data = Some(value);
6966        self
6967    }
6968}
6969
6970impl Validate for Modem {
6971    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6972        path.push_key("iccid");
6973        if let Some(value) = &self.iccid {
6974            validate::string(value.as_str(), None, Some(20), path, out);
6975        }
6976        path.pop();
6977        path.push_key("imsi");
6978        if let Some(value) = &self.imsi {
6979            validate::string(value.as_str(), None, Some(20), path, out);
6980        }
6981        path.pop();
6982        path.push_key("customData");
6983        if let Some(value) = &self.custom_data {
6984            Validate::validate_at(value, path, out);
6985        }
6986        path.pop();
6987    }
6988}
6989
6990/// Class to hold parameters of SetVariableMonitoring request.
6991///
6992/// The OCPP 2.1 `MonitoringData` data type.
6993#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6994pub struct MonitoringData {
6995    /// The `component` member.
6996    pub component: Component,
6997    /// The `variable` member.
6998    pub variable: Variable,
6999    /// The `variableMonitoring` member.
7000    #[serde(rename = "variableMonitoring")]
7001    pub variable_monitoring: Vec<VariableMonitoring>,
7002    /// The `customData` member.
7003    #[serde(rename = "customData")]
7004    #[serde(default, skip_serializing_if = "Option::is_none")]
7005    pub custom_data: Option<crate::types::CustomData>,
7006}
7007
7008impl MonitoringData {
7009    /// Creates a `MonitoringData` from its required fields.
7010    #[must_use]
7011    pub fn new(
7012        component: Component,
7013        variable: Variable,
7014        variable_monitoring: Vec<VariableMonitoring>,
7015    ) -> Self {
7016        Self {
7017            component,
7018            variable,
7019            variable_monitoring,
7020            custom_data: None,
7021        }
7022    }
7023
7024    /// Sets the optional `customData` field.
7025    #[must_use]
7026    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7027        self.custom_data = Some(value);
7028        self
7029    }
7030}
7031
7032impl Validate for MonitoringData {
7033    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7034        path.push_key("component");
7035        Validate::validate_at(&self.component, path, out);
7036        path.pop();
7037        path.push_key("variable");
7038        Validate::validate_at(&self.variable, path, out);
7039        path.pop();
7040        path.push_key("variableMonitoring");
7041        validate::list_len(self.variable_monitoring.len(), Some(1), None, path, out);
7042        for (index, item) in self.variable_monitoring.iter().enumerate() {
7043            path.push_index(index);
7044            Validate::validate_at(item, path, out);
7045            path.pop();
7046        }
7047        path.pop();
7048        path.push_key("customData");
7049        if let Some(value) = &self.custom_data {
7050            Validate::validate_at(value, path, out);
7051        }
7052        path.pop();
7053    }
7054}
7055
7056/// The NetworkConnectionProfile defines the functional and technical parameters of a communication link.
7057///
7058/// The OCPP 2.1 `NetworkConnectionProfile` data type.
7059#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7060pub struct NetworkConnectionProfile {
7061    /// The `ocppInterface` member.
7062    #[serde(rename = "ocppInterface")]
7063    pub ocpp_interface: OCPPInterface,
7064    /// The `ocppTransport` member.
7065    #[serde(rename = "ocppTransport")]
7066    pub ocpp_transport: OCPPTransport,
7067    /// Duration in seconds before a message send by the Charging Station via this network connection times-out.
7068    /// The best setting depends on the underlying network and response times of the CSMS.
7069    /// If you are looking for a some guideline: use 30 seconds as a starting point.
7070    #[serde(rename = "messageTimeout")]
7071    pub message_timeout: i32,
7072    /// URL of the CSMS(s) that this Charging Station communicates with, without the Charging Station identity part. +
7073    /// The SecurityCtrlr.Identity field is appended to _ocppCsmsUrl_ to provide the full websocket URL.
7074    #[serde(rename = "ocppCsmsUrl")]
7075    pub ocpp_csms_url: String,
7076    /// This field specifies the security profile used when connecting to the CSMS with this NetworkConnectionProfile.
7077    #[serde(rename = "securityProfile")]
7078    pub security_profile: i32,
7079    /// The `apn` member.
7080    #[serde(default, skip_serializing_if = "Option::is_none")]
7081    pub apn: Option<APN>,
7082    /// The `ocppVersion` member.
7083    #[serde(rename = "ocppVersion")]
7084    #[serde(default, skip_serializing_if = "Option::is_none")]
7085    pub ocpp_version: Option<OCPPVersion>,
7086    /// *(2.1)* Charging Station identity to be used as the basic authentication username.
7087    #[serde(default, skip_serializing_if = "Option::is_none")]
7088    pub identity: Option<String>,
7089    /// *(2.1)* BasicAuthPassword to use for security profile 1 or 2.
7090    #[serde(rename = "basicAuthPassword")]
7091    #[serde(default, skip_serializing_if = "Option::is_none")]
7092    pub basic_auth_password: Option<String>,
7093    /// The `vpn` member.
7094    #[serde(default, skip_serializing_if = "Option::is_none")]
7095    pub vpn: Option<VPN>,
7096    /// The `customData` member.
7097    #[serde(rename = "customData")]
7098    #[serde(default, skip_serializing_if = "Option::is_none")]
7099    pub custom_data: Option<crate::types::CustomData>,
7100}
7101
7102impl NetworkConnectionProfile {
7103    /// Creates a `NetworkConnectionProfile` from its required fields.
7104    #[must_use]
7105    pub fn new(
7106        ocpp_interface: OCPPInterface,
7107        ocpp_transport: OCPPTransport,
7108        message_timeout: i32,
7109        ocpp_csms_url: impl Into<String>,
7110        security_profile: i32,
7111    ) -> Self {
7112        Self {
7113            ocpp_interface,
7114            ocpp_transport,
7115            message_timeout,
7116            ocpp_csms_url: ocpp_csms_url.into(),
7117            security_profile,
7118            apn: None,
7119            ocpp_version: None,
7120            identity: None,
7121            basic_auth_password: None,
7122            vpn: None,
7123            custom_data: None,
7124        }
7125    }
7126
7127    /// Sets the optional `apn` field.
7128    #[must_use]
7129    pub fn with_apn(mut self, value: APN) -> Self {
7130        self.apn = Some(value);
7131        self
7132    }
7133
7134    /// Sets the optional `ocppVersion` field.
7135    #[must_use]
7136    pub fn with_ocpp_version(mut self, value: OCPPVersion) -> Self {
7137        self.ocpp_version = Some(value);
7138        self
7139    }
7140
7141    /// Sets the optional `identity` field.
7142    #[must_use]
7143    pub fn with_identity(mut self, value: impl Into<String>) -> Self {
7144        self.identity = Some(value.into());
7145        self
7146    }
7147
7148    /// Sets the optional `basicAuthPassword` field.
7149    #[must_use]
7150    pub fn with_basic_auth_password(mut self, value: impl Into<String>) -> Self {
7151        self.basic_auth_password = Some(value.into());
7152        self
7153    }
7154
7155    /// Sets the optional `vpn` field.
7156    #[must_use]
7157    pub fn with_vpn(mut self, value: VPN) -> Self {
7158        self.vpn = Some(value);
7159        self
7160    }
7161
7162    /// Sets the optional `customData` field.
7163    #[must_use]
7164    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7165        self.custom_data = Some(value);
7166        self
7167    }
7168}
7169
7170impl Validate for NetworkConnectionProfile {
7171    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7172        path.push_key("ocppInterface");
7173        Validate::validate_at(&self.ocpp_interface, path, out);
7174        path.pop();
7175        path.push_key("ocppTransport");
7176        Validate::validate_at(&self.ocpp_transport, path, out);
7177        path.pop();
7178        path.push_key("ocppCsmsUrl");
7179        validate::string(self.ocpp_csms_url.as_str(), None, Some(2000), path, out);
7180        path.pop();
7181        path.push_key("securityProfile");
7182        validate::int_range(i64::from(self.security_profile), Some(0.0), None, path, out);
7183        path.pop();
7184        path.push_key("apn");
7185        if let Some(value) = &self.apn {
7186            Validate::validate_at(value, path, out);
7187        }
7188        path.pop();
7189        path.push_key("ocppVersion");
7190        if let Some(value) = &self.ocpp_version {
7191            Validate::validate_at(value, path, out);
7192        }
7193        path.pop();
7194        path.push_key("identity");
7195        if let Some(value) = &self.identity {
7196            validate::string(value.as_str(), None, Some(48), path, out);
7197        }
7198        path.pop();
7199        path.push_key("basicAuthPassword");
7200        if let Some(value) = &self.basic_auth_password {
7201            validate::string(value.as_str(), None, Some(64), path, out);
7202        }
7203        path.pop();
7204        path.push_key("vpn");
7205        if let Some(value) = &self.vpn {
7206            Validate::validate_at(value, path, out);
7207        }
7208        path.pop();
7209        path.push_key("customData");
7210        if let Some(value) = &self.custom_data {
7211            Validate::validate_at(value, path, out);
7212        }
7213        path.pop();
7214    }
7215}
7216
7217/// Information about a certificate for an OCSP check.
7218///
7219/// The OCPP 2.1 `OCSPRequestData` data type.
7220#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7221pub struct OCSPRequestData {
7222    /// The `hashAlgorithm` member.
7223    #[serde(rename = "hashAlgorithm")]
7224    pub hash_algorithm: HashAlgorithm,
7225    /// The hash of the issuer’s distinguished
7226    /// name (DN), that must be calculated over the DER
7227    /// encoding of the issuer’s name field in the certificate
7228    /// being checked.
7229    #[serde(rename = "issuerNameHash")]
7230    pub issuer_name_hash: String,
7231    /// The hash of the DER encoded public key:
7232    /// the value (excluding tag and length) of the subject
7233    /// public key field in the issuer’s certificate.
7234    #[serde(rename = "issuerKeyHash")]
7235    pub issuer_key_hash: String,
7236    /// The string representation of the
7237    /// hexadecimal value of the serial number without the
7238    /// prefix "0x" and without leading zeroes.
7239    #[serde(rename = "serialNumber")]
7240    pub serial_number: String,
7241    /// This contains the responder URL (Case insensitive).
7242    #[serde(rename = "responderURL")]
7243    pub responder_url: String,
7244    /// The `customData` member.
7245    #[serde(rename = "customData")]
7246    #[serde(default, skip_serializing_if = "Option::is_none")]
7247    pub custom_data: Option<crate::types::CustomData>,
7248}
7249
7250impl OCSPRequestData {
7251    /// Creates a `OCSPRequestData` from its required fields.
7252    #[must_use]
7253    pub fn new(
7254        hash_algorithm: HashAlgorithm,
7255        issuer_name_hash: impl Into<String>,
7256        issuer_key_hash: impl Into<String>,
7257        serial_number: impl Into<String>,
7258        responder_url: impl Into<String>,
7259    ) -> Self {
7260        Self {
7261            hash_algorithm,
7262            issuer_name_hash: issuer_name_hash.into(),
7263            issuer_key_hash: issuer_key_hash.into(),
7264            serial_number: serial_number.into(),
7265            responder_url: responder_url.into(),
7266            custom_data: None,
7267        }
7268    }
7269
7270    /// Sets the optional `customData` field.
7271    #[must_use]
7272    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7273        self.custom_data = Some(value);
7274        self
7275    }
7276}
7277
7278impl Validate for OCSPRequestData {
7279    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7280        path.push_key("hashAlgorithm");
7281        Validate::validate_at(&self.hash_algorithm, path, out);
7282        path.pop();
7283        path.push_key("issuerNameHash");
7284        validate::string(self.issuer_name_hash.as_str(), None, Some(128), path, out);
7285        path.pop();
7286        path.push_key("issuerKeyHash");
7287        validate::string(self.issuer_key_hash.as_str(), None, Some(128), path, out);
7288        path.pop();
7289        path.push_key("serialNumber");
7290        validate::string(self.serial_number.as_str(), None, Some(40), path, out);
7291        path.pop();
7292        path.push_key("responderURL");
7293        validate::string(self.responder_url.as_str(), None, Some(2000), path, out);
7294        path.pop();
7295        path.push_key("customData");
7296        if let Some(value) = &self.custom_data {
7297            Validate::validate_at(value, path, out);
7298        }
7299        path.pop();
7300    }
7301}
7302
7303/// Part of ISO 15118-20 price schedule.
7304///
7305/// The OCPP 2.1 `OverstayRule` data type.
7306#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7307pub struct OverstayRule {
7308    /// The `overstayFee` member.
7309    #[serde(rename = "overstayFee")]
7310    pub overstay_fee: RationalNumber,
7311    /// Time in seconds after trigger of the parent Overstay Rules for this particular fee to apply.
7312    #[serde(rename = "startTime")]
7313    pub start_time: i32,
7314    /// Time till overstay will be reapplied
7315    #[serde(rename = "overstayFeePeriod")]
7316    pub overstay_fee_period: i32,
7317    /// Human readable string to identify the overstay rule.
7318    #[serde(rename = "overstayRuleDescription")]
7319    #[serde(default, skip_serializing_if = "Option::is_none")]
7320    pub overstay_rule_description: Option<String>,
7321    /// The `customData` member.
7322    #[serde(rename = "customData")]
7323    #[serde(default, skip_serializing_if = "Option::is_none")]
7324    pub custom_data: Option<crate::types::CustomData>,
7325}
7326
7327impl OverstayRule {
7328    /// Creates a `OverstayRule` from its required fields.
7329    #[must_use]
7330    pub fn new(overstay_fee: RationalNumber, start_time: i32, overstay_fee_period: i32) -> Self {
7331        Self {
7332            overstay_fee,
7333            start_time,
7334            overstay_fee_period,
7335            overstay_rule_description: None,
7336            custom_data: None,
7337        }
7338    }
7339
7340    /// Sets the optional `overstayRuleDescription` field.
7341    #[must_use]
7342    pub fn with_overstay_rule_description(mut self, value: impl Into<String>) -> Self {
7343        self.overstay_rule_description = Some(value.into());
7344        self
7345    }
7346
7347    /// Sets the optional `customData` field.
7348    #[must_use]
7349    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7350        self.custom_data = Some(value);
7351        self
7352    }
7353}
7354
7355impl Validate for OverstayRule {
7356    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7357        path.push_key("overstayFee");
7358        Validate::validate_at(&self.overstay_fee, path, out);
7359        path.pop();
7360        path.push_key("overstayRuleDescription");
7361        if let Some(value) = &self.overstay_rule_description {
7362            validate::string(value.as_str(), None, Some(32), path, out);
7363        }
7364        path.pop();
7365        path.push_key("customData");
7366        if let Some(value) = &self.custom_data {
7367            Validate::validate_at(value, path, out);
7368        }
7369        path.pop();
7370    }
7371}
7372
7373/// Part of ISO 15118-20 price schedule.
7374///
7375/// The OCPP 2.1 `OverstayRuleList` data type.
7376#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7377pub struct OverstayRuleList {
7378    /// The `overstayRule` member.
7379    #[serde(rename = "overstayRule")]
7380    pub overstay_rule: Vec<OverstayRule>,
7381    /// The `overstayPowerThreshold` member.
7382    #[serde(rename = "overstayPowerThreshold")]
7383    #[serde(default, skip_serializing_if = "Option::is_none")]
7384    pub overstay_power_threshold: Option<RationalNumber>,
7385    /// Time till overstay is applied in seconds.
7386    #[serde(rename = "overstayTimeThreshold")]
7387    #[serde(default, skip_serializing_if = "Option::is_none")]
7388    pub overstay_time_threshold: Option<i32>,
7389    /// The `customData` member.
7390    #[serde(rename = "customData")]
7391    #[serde(default, skip_serializing_if = "Option::is_none")]
7392    pub custom_data: Option<crate::types::CustomData>,
7393}
7394
7395impl OverstayRuleList {
7396    /// Creates a `OverstayRuleList` from its required fields.
7397    #[must_use]
7398    pub fn new(overstay_rule: Vec<OverstayRule>) -> Self {
7399        Self {
7400            overstay_rule,
7401            overstay_power_threshold: None,
7402            overstay_time_threshold: None,
7403            custom_data: None,
7404        }
7405    }
7406
7407    /// Sets the optional `overstayPowerThreshold` field.
7408    #[must_use]
7409    pub fn with_overstay_power_threshold(mut self, value: RationalNumber) -> Self {
7410        self.overstay_power_threshold = Some(value);
7411        self
7412    }
7413
7414    /// Sets the optional `overstayTimeThreshold` field.
7415    #[must_use]
7416    pub fn with_overstay_time_threshold(mut self, value: i32) -> Self {
7417        self.overstay_time_threshold = Some(value);
7418        self
7419    }
7420
7421    /// Sets the optional `customData` field.
7422    #[must_use]
7423    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7424        self.custom_data = Some(value);
7425        self
7426    }
7427}
7428
7429impl Validate for OverstayRuleList {
7430    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7431        path.push_key("overstayRule");
7432        validate::list_len(self.overstay_rule.len(), Some(1), Some(5), path, out);
7433        for (index, item) in self.overstay_rule.iter().enumerate() {
7434            path.push_index(index);
7435            Validate::validate_at(item, path, out);
7436            path.pop();
7437        }
7438        path.pop();
7439        path.push_key("overstayPowerThreshold");
7440        if let Some(value) = &self.overstay_power_threshold {
7441            Validate::validate_at(value, path, out);
7442        }
7443        path.pop();
7444        path.push_key("customData");
7445        if let Some(value) = &self.custom_data {
7446            Validate::validate_at(value, path, out);
7447        }
7448        path.pop();
7449    }
7450}
7451
7452/// The OCPP 2.1 `PeriodicEventStreamParams` data type.
7453#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7454pub struct PeriodicEventStreamParams {
7455    /// Time in seconds after which stream data is sent.
7456    #[serde(default, skip_serializing_if = "Option::is_none")]
7457    pub interval: Option<i32>,
7458    /// Number of items to be sent together in stream.
7459    #[serde(default, skip_serializing_if = "Option::is_none")]
7460    pub values: Option<i32>,
7461    /// The `customData` member.
7462    #[serde(rename = "customData")]
7463    #[serde(default, skip_serializing_if = "Option::is_none")]
7464    pub custom_data: Option<crate::types::CustomData>,
7465}
7466
7467impl PeriodicEventStreamParams {
7468    /// Creates an empty `PeriodicEventStreamParams`. Every field of this type is optional.
7469    #[must_use]
7470    pub fn new() -> Self {
7471        Self::default()
7472    }
7473
7474    /// Sets the optional `interval` field.
7475    #[must_use]
7476    pub fn with_interval(mut self, value: i32) -> Self {
7477        self.interval = Some(value);
7478        self
7479    }
7480
7481    /// Sets the optional `values` field.
7482    #[must_use]
7483    pub fn with_values(mut self, value: i32) -> Self {
7484        self.values = Some(value);
7485        self
7486    }
7487
7488    /// Sets the optional `customData` field.
7489    #[must_use]
7490    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7491        self.custom_data = Some(value);
7492        self
7493    }
7494}
7495
7496impl Validate for PeriodicEventStreamParams {
7497    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7498        path.push_key("interval");
7499        if let Some(value) = &self.interval {
7500            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
7501        }
7502        path.pop();
7503        path.push_key("values");
7504        if let Some(value) = &self.values {
7505            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
7506        }
7507        path.pop();
7508        path.push_key("customData");
7509        if let Some(value) = &self.custom_data {
7510            Validate::validate_at(value, path, out);
7511        }
7512        path.pop();
7513    }
7514}
7515
7516/// Price with and without tax. At least one of _exclTax_, _inclTax_ must be present.
7517///
7518/// The OCPP 2.1 `Price` data type.
7519#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7520pub struct Price {
7521    /// Price/cost excluding tax. Can be absent if _inclTax_ is present.
7522    #[serde(rename = "exclTax")]
7523    #[serde(default, skip_serializing_if = "Option::is_none")]
7524    pub excl_tax: Option<crate::types::Decimal>,
7525    /// Price/cost including tax. Can be absent if _exclTax_ is present.
7526    #[serde(rename = "inclTax")]
7527    #[serde(default, skip_serializing_if = "Option::is_none")]
7528    pub incl_tax: Option<crate::types::Decimal>,
7529    /// The `taxRates` member.
7530    #[serde(rename = "taxRates")]
7531    #[serde(default, skip_serializing_if = "Option::is_none")]
7532    pub tax_rates: Option<Vec<TaxRate>>,
7533    /// The `customData` member.
7534    #[serde(rename = "customData")]
7535    #[serde(default, skip_serializing_if = "Option::is_none")]
7536    pub custom_data: Option<crate::types::CustomData>,
7537}
7538
7539impl Price {
7540    /// Creates an empty `Price`. Every field of this type is optional.
7541    #[must_use]
7542    pub fn new() -> Self {
7543        Self::default()
7544    }
7545
7546    /// Sets the optional `exclTax` field.
7547    #[must_use]
7548    pub fn with_excl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7549        self.excl_tax = Some(value.into());
7550        self
7551    }
7552
7553    /// Sets the optional `inclTax` field.
7554    #[must_use]
7555    pub fn with_incl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7556        self.incl_tax = Some(value.into());
7557        self
7558    }
7559
7560    /// Sets the optional `taxRates` field.
7561    #[must_use]
7562    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
7563        self.tax_rates = Some(value);
7564        self
7565    }
7566
7567    /// Sets the optional `customData` field.
7568    #[must_use]
7569    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7570        self.custom_data = Some(value);
7571        self
7572    }
7573}
7574
7575impl Validate for Price {
7576    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7577        path.push_key("taxRates");
7578        if let Some(value) = &self.tax_rates {
7579            validate::list_len(value.len(), Some(1), Some(5), path, out);
7580            for (index, item) in value.iter().enumerate() {
7581                path.push_index(index);
7582                Validate::validate_at(item, path, out);
7583                path.pop();
7584            }
7585        }
7586        path.pop();
7587        path.push_key("customData");
7588        if let Some(value) = &self.custom_data {
7589            Validate::validate_at(value, path, out);
7590        }
7591        path.pop();
7592    }
7593}
7594
7595/// The PriceLevelScheduleType is modeled after the same type that is defined in ISO 15118-20, such that if it is supplied by an EMSP as a signed EXI message, the conversion from EXI to JSON (in OCPP) and back to EXI (for ISO 15118-20) does not change the digest and therefore does not invalidate the signature.
7596///
7597/// The OCPP 2.1 `PriceLevelSchedule` data type.
7598#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7599pub struct PriceLevelSchedule {
7600    /// The `priceLevelScheduleEntries` member.
7601    #[serde(rename = "priceLevelScheduleEntries")]
7602    pub price_level_schedule_entries: Vec<PriceLevelScheduleEntry>,
7603    /// Starting point of this price schedule.
7604    #[serde(rename = "timeAnchor")]
7605    pub time_anchor: crate::types::DateTime,
7606    /// Unique ID of this price schedule.
7607    #[serde(rename = "priceScheduleId")]
7608    pub price_schedule_id: i32,
7609    /// Defines the overall number of distinct price level elements used across all PriceLevelSchedules.
7610    #[serde(rename = "numberOfPriceLevels")]
7611    pub number_of_price_levels: i32,
7612    /// Description of the price schedule.
7613    #[serde(rename = "priceScheduleDescription")]
7614    #[serde(default, skip_serializing_if = "Option::is_none")]
7615    pub price_schedule_description: Option<String>,
7616    /// The `customData` member.
7617    #[serde(rename = "customData")]
7618    #[serde(default, skip_serializing_if = "Option::is_none")]
7619    pub custom_data: Option<crate::types::CustomData>,
7620}
7621
7622impl PriceLevelSchedule {
7623    /// Creates a `PriceLevelSchedule` from its required fields.
7624    #[must_use]
7625    pub fn new(
7626        price_level_schedule_entries: Vec<PriceLevelScheduleEntry>,
7627        time_anchor: impl Into<crate::types::DateTime>,
7628        price_schedule_id: i32,
7629        number_of_price_levels: i32,
7630    ) -> Self {
7631        Self {
7632            price_level_schedule_entries,
7633            time_anchor: time_anchor.into(),
7634            price_schedule_id,
7635            number_of_price_levels,
7636            price_schedule_description: None,
7637            custom_data: None,
7638        }
7639    }
7640
7641    /// Sets the optional `priceScheduleDescription` field.
7642    #[must_use]
7643    pub fn with_price_schedule_description(mut self, value: impl Into<String>) -> Self {
7644        self.price_schedule_description = Some(value.into());
7645        self
7646    }
7647
7648    /// Sets the optional `customData` field.
7649    #[must_use]
7650    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7651        self.custom_data = Some(value);
7652        self
7653    }
7654}
7655
7656impl Validate for PriceLevelSchedule {
7657    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7658        path.push_key("priceLevelScheduleEntries");
7659        validate::list_len(
7660            self.price_level_schedule_entries.len(),
7661            Some(1),
7662            Some(100),
7663            path,
7664            out,
7665        );
7666        for (index, item) in self.price_level_schedule_entries.iter().enumerate() {
7667            path.push_index(index);
7668            Validate::validate_at(item, path, out);
7669            path.pop();
7670        }
7671        path.pop();
7672        path.push_key("priceScheduleId");
7673        validate::int_range(
7674            i64::from(self.price_schedule_id),
7675            Some(0.0),
7676            None,
7677            path,
7678            out,
7679        );
7680        path.pop();
7681        path.push_key("numberOfPriceLevels");
7682        validate::int_range(
7683            i64::from(self.number_of_price_levels),
7684            Some(0.0),
7685            None,
7686            path,
7687            out,
7688        );
7689        path.pop();
7690        path.push_key("priceScheduleDescription");
7691        if let Some(value) = &self.price_schedule_description {
7692            validate::string(value.as_str(), None, Some(32), path, out);
7693        }
7694        path.pop();
7695        path.push_key("customData");
7696        if let Some(value) = &self.custom_data {
7697            Validate::validate_at(value, path, out);
7698        }
7699        path.pop();
7700    }
7701}
7702
7703/// Part of ISO 15118-20 price schedule.
7704///
7705/// The OCPP 2.1 `PriceLevelScheduleEntry` data type.
7706#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7707pub struct PriceLevelScheduleEntry {
7708    /// The amount of seconds that define the duration of this given PriceLevelScheduleEntry.
7709    pub duration: i32,
7710    /// Defines the price level of this PriceLevelScheduleEntry (referring to NumberOfPriceLevels). Small values for the PriceLevel represent a cheaper PriceLevelScheduleEntry. Large values for the PriceLevel represent a more expensive PriceLevelScheduleEntry.
7711    #[serde(rename = "priceLevel")]
7712    pub price_level: i32,
7713    /// The `customData` member.
7714    #[serde(rename = "customData")]
7715    #[serde(default, skip_serializing_if = "Option::is_none")]
7716    pub custom_data: Option<crate::types::CustomData>,
7717}
7718
7719impl PriceLevelScheduleEntry {
7720    /// Creates a `PriceLevelScheduleEntry` from its required fields.
7721    #[must_use]
7722    pub fn new(duration: i32, price_level: i32) -> Self {
7723        Self {
7724            duration,
7725            price_level,
7726            custom_data: None,
7727        }
7728    }
7729
7730    /// Sets the optional `customData` field.
7731    #[must_use]
7732    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7733        self.custom_data = Some(value);
7734        self
7735    }
7736}
7737
7738impl Validate for PriceLevelScheduleEntry {
7739    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7740        path.push_key("priceLevel");
7741        validate::int_range(i64::from(self.price_level), Some(0.0), None, path, out);
7742        path.pop();
7743        path.push_key("customData");
7744        if let Some(value) = &self.custom_data {
7745            Validate::validate_at(value, path, out);
7746        }
7747        path.pop();
7748    }
7749}
7750
7751/// Part of ISO 15118-20 price schedule.
7752///
7753/// The OCPP 2.1 `PriceRule` data type.
7754#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7755pub struct PriceRule {
7756    /// The `energyFee` member.
7757    #[serde(rename = "energyFee")]
7758    pub energy_fee: RationalNumber,
7759    /// The `powerRangeStart` member.
7760    #[serde(rename = "powerRangeStart")]
7761    pub power_range_start: RationalNumber,
7762    /// The duration of the parking fee period (in seconds).
7763    /// When the time enters into a ParkingFeePeriod, the ParkingFee will apply to the session. .
7764    #[serde(rename = "parkingFeePeriod")]
7765    #[serde(default, skip_serializing_if = "Option::is_none")]
7766    pub parking_fee_period: Option<i32>,
7767    /// Number of grams of CO2 per kWh.
7768    #[serde(rename = "carbonDioxideEmission")]
7769    #[serde(default, skip_serializing_if = "Option::is_none")]
7770    pub carbon_dioxide_emission: Option<i32>,
7771    /// Percentage of the power that is created by renewable resources.
7772    #[serde(rename = "renewableGenerationPercentage")]
7773    #[serde(default, skip_serializing_if = "Option::is_none")]
7774    pub renewable_generation_percentage: Option<i32>,
7775    /// The `parkingFee` member.
7776    #[serde(rename = "parkingFee")]
7777    #[serde(default, skip_serializing_if = "Option::is_none")]
7778    pub parking_fee: Option<RationalNumber>,
7779    /// The `customData` member.
7780    #[serde(rename = "customData")]
7781    #[serde(default, skip_serializing_if = "Option::is_none")]
7782    pub custom_data: Option<crate::types::CustomData>,
7783}
7784
7785impl PriceRule {
7786    /// Creates a `PriceRule` from its required fields.
7787    #[must_use]
7788    pub fn new(energy_fee: RationalNumber, power_range_start: RationalNumber) -> Self {
7789        Self {
7790            energy_fee,
7791            power_range_start,
7792            parking_fee_period: None,
7793            carbon_dioxide_emission: None,
7794            renewable_generation_percentage: None,
7795            parking_fee: None,
7796            custom_data: None,
7797        }
7798    }
7799
7800    /// Sets the optional `parkingFeePeriod` field.
7801    #[must_use]
7802    pub fn with_parking_fee_period(mut self, value: i32) -> Self {
7803        self.parking_fee_period = Some(value);
7804        self
7805    }
7806
7807    /// Sets the optional `carbonDioxideEmission` field.
7808    #[must_use]
7809    pub fn with_carbon_dioxide_emission(mut self, value: i32) -> Self {
7810        self.carbon_dioxide_emission = Some(value);
7811        self
7812    }
7813
7814    /// Sets the optional `renewableGenerationPercentage` field.
7815    #[must_use]
7816    pub fn with_renewable_generation_percentage(mut self, value: i32) -> Self {
7817        self.renewable_generation_percentage = Some(value);
7818        self
7819    }
7820
7821    /// Sets the optional `parkingFee` field.
7822    #[must_use]
7823    pub fn with_parking_fee(mut self, value: RationalNumber) -> Self {
7824        self.parking_fee = Some(value);
7825        self
7826    }
7827
7828    /// Sets the optional `customData` field.
7829    #[must_use]
7830    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7831        self.custom_data = Some(value);
7832        self
7833    }
7834}
7835
7836impl Validate for PriceRule {
7837    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7838        path.push_key("energyFee");
7839        Validate::validate_at(&self.energy_fee, path, out);
7840        path.pop();
7841        path.push_key("powerRangeStart");
7842        Validate::validate_at(&self.power_range_start, path, out);
7843        path.pop();
7844        path.push_key("carbonDioxideEmission");
7845        if let Some(value) = &self.carbon_dioxide_emission {
7846            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
7847        }
7848        path.pop();
7849        path.push_key("renewableGenerationPercentage");
7850        if let Some(value) = &self.renewable_generation_percentage {
7851            validate::int_range(i64::from(*value), Some(0.0), Some(100.0), path, out);
7852        }
7853        path.pop();
7854        path.push_key("parkingFee");
7855        if let Some(value) = &self.parking_fee {
7856            Validate::validate_at(value, path, out);
7857        }
7858        path.pop();
7859        path.push_key("customData");
7860        if let Some(value) = &self.custom_data {
7861            Validate::validate_at(value, path, out);
7862        }
7863        path.pop();
7864    }
7865}
7866
7867/// Part of ISO 15118-20 price schedule.
7868///
7869/// The OCPP 2.1 `PriceRuleStack` data type.
7870#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7871pub struct PriceRuleStack {
7872    /// Duration of the stack of price rules.  he amount of seconds that define the duration of the given PriceRule(s).
7873    pub duration: i32,
7874    /// The `priceRule` member.
7875    #[serde(rename = "priceRule")]
7876    pub price_rule: Vec<PriceRule>,
7877    /// The `customData` member.
7878    #[serde(rename = "customData")]
7879    #[serde(default, skip_serializing_if = "Option::is_none")]
7880    pub custom_data: Option<crate::types::CustomData>,
7881}
7882
7883impl PriceRuleStack {
7884    /// Creates a `PriceRuleStack` from its required fields.
7885    #[must_use]
7886    pub fn new(duration: i32, price_rule: Vec<PriceRule>) -> Self {
7887        Self {
7888            duration,
7889            price_rule,
7890            custom_data: None,
7891        }
7892    }
7893
7894    /// Sets the optional `customData` field.
7895    #[must_use]
7896    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7897        self.custom_data = Some(value);
7898        self
7899    }
7900}
7901
7902impl Validate for PriceRuleStack {
7903    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7904        path.push_key("priceRule");
7905        validate::list_len(self.price_rule.len(), Some(1), Some(8), path, out);
7906        for (index, item) in self.price_rule.iter().enumerate() {
7907            path.push_index(index);
7908            Validate::validate_at(item, path, out);
7909            path.pop();
7910        }
7911        path.pop();
7912        path.push_key("customData");
7913        if let Some(value) = &self.custom_data {
7914            Validate::validate_at(value, path, out);
7915        }
7916        path.pop();
7917    }
7918}
7919
7920/// Part of ISO 15118-20 price schedule.
7921///
7922/// The OCPP 2.1 `RationalNumber` data type.
7923#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7924pub struct RationalNumber {
7925    /// The exponent to base 10 (dec)
7926    pub exponent: i32,
7927    /// Value which shall be multiplied.
7928    pub value: i32,
7929    /// The `customData` member.
7930    #[serde(rename = "customData")]
7931    #[serde(default, skip_serializing_if = "Option::is_none")]
7932    pub custom_data: Option<crate::types::CustomData>,
7933}
7934
7935impl RationalNumber {
7936    /// Creates a `RationalNumber` from its required fields.
7937    #[must_use]
7938    pub fn new(exponent: i32, value: i32) -> Self {
7939        Self {
7940            exponent,
7941            value,
7942            custom_data: None,
7943        }
7944    }
7945
7946    /// Sets the optional `customData` field.
7947    #[must_use]
7948    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7949        self.custom_data = Some(value);
7950        self
7951    }
7952}
7953
7954impl Validate for RationalNumber {
7955    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7956        path.push_key("customData");
7957        if let Some(value) = &self.custom_data {
7958            Validate::validate_at(value, path, out);
7959        }
7960        path.pop();
7961    }
7962}
7963
7964/// The OCPP 2.1 `ReactivePowerParams` data type.
7965#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7966pub struct ReactivePowerParams {
7967    /// Only for VoltVar curve: The nominal ac voltage (rms) adjustment to the voltage curve points for Volt-Var curves (percentage).
7968    #[serde(rename = "vRef")]
7969    #[serde(default, skip_serializing_if = "Option::is_none")]
7970    pub v_ref: Option<crate::types::Decimal>,
7971    /// Only for VoltVar: Enable/disable autonomous VRef adjustment
7972    #[serde(rename = "autonomousVRefEnable")]
7973    #[serde(default, skip_serializing_if = "Option::is_none")]
7974    pub autonomous_v_ref_enable: Option<bool>,
7975    /// Only for VoltVar: Adjustment range for VRef time constant
7976    #[serde(rename = "autonomousVRefTimeConstant")]
7977    #[serde(default, skip_serializing_if = "Option::is_none")]
7978    pub autonomous_v_ref_time_constant: Option<crate::types::Decimal>,
7979    /// The `customData` member.
7980    #[serde(rename = "customData")]
7981    #[serde(default, skip_serializing_if = "Option::is_none")]
7982    pub custom_data: Option<crate::types::CustomData>,
7983}
7984
7985impl ReactivePowerParams {
7986    /// Creates an empty `ReactivePowerParams`. Every field of this type is optional.
7987    #[must_use]
7988    pub fn new() -> Self {
7989        Self::default()
7990    }
7991
7992    /// Sets the optional `vRef` field.
7993    #[must_use]
7994    pub fn with_v_ref(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7995        self.v_ref = Some(value.into());
7996        self
7997    }
7998
7999    /// Sets the optional `autonomousVRefEnable` field.
8000    #[must_use]
8001    pub fn with_autonomous_v_ref_enable(mut self, value: bool) -> Self {
8002        self.autonomous_v_ref_enable = Some(value);
8003        self
8004    }
8005
8006    /// Sets the optional `autonomousVRefTimeConstant` field.
8007    #[must_use]
8008    pub fn with_autonomous_v_ref_time_constant(
8009        mut self,
8010        value: impl Into<crate::types::Decimal>,
8011    ) -> Self {
8012        self.autonomous_v_ref_time_constant = Some(value.into());
8013        self
8014    }
8015
8016    /// Sets the optional `customData` field.
8017    #[must_use]
8018    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8019        self.custom_data = Some(value);
8020        self
8021    }
8022}
8023
8024impl Validate for ReactivePowerParams {
8025    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8026        path.push_key("customData");
8027        if let Some(value) = &self.custom_data {
8028            Validate::validate_at(value, path, out);
8029        }
8030        path.pop();
8031    }
8032}
8033
8034/// The OCPP 2.1 `RelativeTimeInterval` data type.
8035#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8036pub struct RelativeTimeInterval {
8037    /// Start of the interval, in seconds from NOW.
8038    pub start: i32,
8039    /// Duration of the interval, in seconds.
8040    #[serde(default, skip_serializing_if = "Option::is_none")]
8041    pub duration: Option<i32>,
8042    /// The `customData` member.
8043    #[serde(rename = "customData")]
8044    #[serde(default, skip_serializing_if = "Option::is_none")]
8045    pub custom_data: Option<crate::types::CustomData>,
8046}
8047
8048impl RelativeTimeInterval {
8049    /// Creates a `RelativeTimeInterval` from its required fields.
8050    #[must_use]
8051    pub fn new(start: i32) -> Self {
8052        Self {
8053            start,
8054            duration: None,
8055            custom_data: None,
8056        }
8057    }
8058
8059    /// Sets the optional `duration` field.
8060    #[must_use]
8061    pub fn with_duration(mut self, value: i32) -> Self {
8062        self.duration = Some(value);
8063        self
8064    }
8065
8066    /// Sets the optional `customData` field.
8067    #[must_use]
8068    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8069        self.custom_data = Some(value);
8070        self
8071    }
8072}
8073
8074impl Validate for RelativeTimeInterval {
8075    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8076        path.push_key("customData");
8077        if let Some(value) = &self.custom_data {
8078            Validate::validate_at(value, path, out);
8079        }
8080        path.pop();
8081    }
8082}
8083
8084/// Class to report components, variables and variable attributes and characteristics.
8085///
8086/// The OCPP 2.1 `ReportData` data type.
8087#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8088pub struct ReportData {
8089    /// The `component` member.
8090    pub component: Component,
8091    /// The `variable` member.
8092    pub variable: Variable,
8093    /// The `variableAttribute` member.
8094    #[serde(rename = "variableAttribute")]
8095    pub variable_attribute: Vec<VariableAttribute>,
8096    /// The `variableCharacteristics` member.
8097    #[serde(rename = "variableCharacteristics")]
8098    #[serde(default, skip_serializing_if = "Option::is_none")]
8099    pub variable_characteristics: Option<VariableCharacteristics>,
8100    /// The `customData` member.
8101    #[serde(rename = "customData")]
8102    #[serde(default, skip_serializing_if = "Option::is_none")]
8103    pub custom_data: Option<crate::types::CustomData>,
8104}
8105
8106impl ReportData {
8107    /// Creates a `ReportData` from its required fields.
8108    #[must_use]
8109    pub fn new(
8110        component: Component,
8111        variable: Variable,
8112        variable_attribute: Vec<VariableAttribute>,
8113    ) -> Self {
8114        Self {
8115            component,
8116            variable,
8117            variable_attribute,
8118            variable_characteristics: None,
8119            custom_data: None,
8120        }
8121    }
8122
8123    /// Sets the optional `variableCharacteristics` field.
8124    #[must_use]
8125    pub fn with_variable_characteristics(mut self, value: VariableCharacteristics) -> Self {
8126        self.variable_characteristics = Some(value);
8127        self
8128    }
8129
8130    /// Sets the optional `customData` field.
8131    #[must_use]
8132    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8133        self.custom_data = Some(value);
8134        self
8135    }
8136}
8137
8138impl Validate for ReportData {
8139    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8140        path.push_key("component");
8141        Validate::validate_at(&self.component, path, out);
8142        path.pop();
8143        path.push_key("variable");
8144        Validate::validate_at(&self.variable, path, out);
8145        path.pop();
8146        path.push_key("variableAttribute");
8147        validate::list_len(self.variable_attribute.len(), Some(1), Some(4), path, out);
8148        for (index, item) in self.variable_attribute.iter().enumerate() {
8149            path.push_index(index);
8150            Validate::validate_at(item, path, out);
8151            path.pop();
8152        }
8153        path.pop();
8154        path.push_key("variableCharacteristics");
8155        if let Some(value) = &self.variable_characteristics {
8156            Validate::validate_at(value, path, out);
8157        }
8158        path.pop();
8159        path.push_key("customData");
8160        if let Some(value) = &self.custom_data {
8161            Validate::validate_at(value, path, out);
8162        }
8163        path.pop();
8164    }
8165}
8166
8167/// A SalesTariff provided by a Mobility Operator (EMSP) .
8168/// NOTE: This dataType is based on dataTypes from &lt;&lt;ref-ISOIEC15118-2,ISO 15118-2&gt;&gt;.
8169///
8170/// The OCPP 2.1 `SalesTariff` data type.
8171#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8172pub struct SalesTariff {
8173    /// SalesTariff identifier used to identify one sales tariff. An SAID remains a unique identifier for one schedule throughout a charging session.
8174    pub id: i32,
8175    /// The `salesTariffEntry` member.
8176    #[serde(rename = "salesTariffEntry")]
8177    pub sales_tariff_entry: Vec<SalesTariffEntry>,
8178    /// A human readable title/short description of the sales tariff e.g. for HMI display purposes.
8179    #[serde(rename = "salesTariffDescription")]
8180    #[serde(default, skip_serializing_if = "Option::is_none")]
8181    pub sales_tariff_description: Option<String>,
8182    /// Defines the overall number of distinct price levels used across all provided SalesTariff elements.
8183    #[serde(rename = "numEPriceLevels")]
8184    #[serde(default, skip_serializing_if = "Option::is_none")]
8185    pub num_e_price_levels: Option<i32>,
8186    /// The `customData` member.
8187    #[serde(rename = "customData")]
8188    #[serde(default, skip_serializing_if = "Option::is_none")]
8189    pub custom_data: Option<crate::types::CustomData>,
8190}
8191
8192impl SalesTariff {
8193    /// Creates a `SalesTariff` from its required fields.
8194    #[must_use]
8195    pub fn new(id: i32, sales_tariff_entry: Vec<SalesTariffEntry>) -> Self {
8196        Self {
8197            id,
8198            sales_tariff_entry,
8199            sales_tariff_description: None,
8200            num_e_price_levels: None,
8201            custom_data: None,
8202        }
8203    }
8204
8205    /// Sets the optional `salesTariffDescription` field.
8206    #[must_use]
8207    pub fn with_sales_tariff_description(mut self, value: impl Into<String>) -> Self {
8208        self.sales_tariff_description = Some(value.into());
8209        self
8210    }
8211
8212    /// Sets the optional `numEPriceLevels` field.
8213    #[must_use]
8214    pub fn with_num_e_price_levels(mut self, value: i32) -> Self {
8215        self.num_e_price_levels = Some(value);
8216        self
8217    }
8218
8219    /// Sets the optional `customData` field.
8220    #[must_use]
8221    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8222        self.custom_data = Some(value);
8223        self
8224    }
8225}
8226
8227impl Validate for SalesTariff {
8228    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8229        path.push_key("id");
8230        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
8231        path.pop();
8232        path.push_key("salesTariffEntry");
8233        validate::list_len(
8234            self.sales_tariff_entry.len(),
8235            Some(1),
8236            Some(1024),
8237            path,
8238            out,
8239        );
8240        for (index, item) in self.sales_tariff_entry.iter().enumerate() {
8241            path.push_index(index);
8242            Validate::validate_at(item, path, out);
8243            path.pop();
8244        }
8245        path.pop();
8246        path.push_key("salesTariffDescription");
8247        if let Some(value) = &self.sales_tariff_description {
8248            validate::string(value.as_str(), None, Some(32), path, out);
8249        }
8250        path.pop();
8251        path.push_key("numEPriceLevels");
8252        if let Some(value) = &self.num_e_price_levels {
8253            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
8254        }
8255        path.pop();
8256        path.push_key("customData");
8257        if let Some(value) = &self.custom_data {
8258            Validate::validate_at(value, path, out);
8259        }
8260        path.pop();
8261    }
8262}
8263
8264/// The OCPP 2.1 `SalesTariffEntry` data type.
8265#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8266pub struct SalesTariffEntry {
8267    /// The `relativeTimeInterval` member.
8268    #[serde(rename = "relativeTimeInterval")]
8269    pub relative_time_interval: RelativeTimeInterval,
8270    /// 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.
8271    #[serde(rename = "ePriceLevel")]
8272    #[serde(default, skip_serializing_if = "Option::is_none")]
8273    pub e_price_level: Option<i32>,
8274    /// The `consumptionCost` member.
8275    #[serde(rename = "consumptionCost")]
8276    #[serde(default, skip_serializing_if = "Option::is_none")]
8277    pub consumption_cost: Option<Vec<ConsumptionCost>>,
8278    /// The `customData` member.
8279    #[serde(rename = "customData")]
8280    #[serde(default, skip_serializing_if = "Option::is_none")]
8281    pub custom_data: Option<crate::types::CustomData>,
8282}
8283
8284impl SalesTariffEntry {
8285    /// Creates a `SalesTariffEntry` from its required fields.
8286    #[must_use]
8287    pub fn new(relative_time_interval: RelativeTimeInterval) -> Self {
8288        Self {
8289            relative_time_interval,
8290            e_price_level: None,
8291            consumption_cost: None,
8292            custom_data: None,
8293        }
8294    }
8295
8296    /// Sets the optional `ePriceLevel` field.
8297    #[must_use]
8298    pub fn with_e_price_level(mut self, value: i32) -> Self {
8299        self.e_price_level = Some(value);
8300        self
8301    }
8302
8303    /// Sets the optional `consumptionCost` field.
8304    #[must_use]
8305    pub fn with_consumption_cost(mut self, value: Vec<ConsumptionCost>) -> Self {
8306        self.consumption_cost = Some(value);
8307        self
8308    }
8309
8310    /// Sets the optional `customData` field.
8311    #[must_use]
8312    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8313        self.custom_data = Some(value);
8314        self
8315    }
8316}
8317
8318impl Validate for SalesTariffEntry {
8319    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8320        path.push_key("relativeTimeInterval");
8321        Validate::validate_at(&self.relative_time_interval, path, out);
8322        path.pop();
8323        path.push_key("ePriceLevel");
8324        if let Some(value) = &self.e_price_level {
8325            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
8326        }
8327        path.pop();
8328        path.push_key("consumptionCost");
8329        if let Some(value) = &self.consumption_cost {
8330            validate::list_len(value.len(), Some(1), Some(3), path, out);
8331            for (index, item) in value.iter().enumerate() {
8332                path.push_index(index);
8333                Validate::validate_at(item, path, out);
8334                path.pop();
8335            }
8336        }
8337        path.pop();
8338        path.push_key("customData");
8339        if let Some(value) = &self.custom_data {
8340            Validate::validate_at(value, path, out);
8341        }
8342        path.pop();
8343    }
8344}
8345
8346/// Single sampled value in MeterValues. Each value can be accompanied by optional fields.
8347///
8348/// 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.
8349///
8350/// The OCPP 2.1 `SampledValue` data type.
8351#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8352pub struct SampledValue {
8353    /// Indicates the measured value.
8354    pub value: crate::types::Decimal,
8355    /// The `measurand` member.
8356    #[serde(default, skip_serializing_if = "Option::is_none")]
8357    pub measurand: Option<Measurand>,
8358    /// The `context` member.
8359    #[serde(default, skip_serializing_if = "Option::is_none")]
8360    pub context: Option<ReadingContext>,
8361    /// The `phase` member.
8362    #[serde(default, skip_serializing_if = "Option::is_none")]
8363    pub phase: Option<Phase>,
8364    /// The `location` member.
8365    #[serde(default, skip_serializing_if = "Option::is_none")]
8366    pub location: Option<Location>,
8367    /// The `signedMeterValue` member.
8368    #[serde(rename = "signedMeterValue")]
8369    #[serde(default, skip_serializing_if = "Option::is_none")]
8370    pub signed_meter_value: Option<SignedMeterValue>,
8371    /// The `unitOfMeasure` member.
8372    #[serde(rename = "unitOfMeasure")]
8373    #[serde(default, skip_serializing_if = "Option::is_none")]
8374    pub unit_of_measure: Option<UnitOfMeasure>,
8375    /// The `customData` member.
8376    #[serde(rename = "customData")]
8377    #[serde(default, skip_serializing_if = "Option::is_none")]
8378    pub custom_data: Option<crate::types::CustomData>,
8379}
8380
8381impl SampledValue {
8382    /// Creates a `SampledValue` from its required fields.
8383    #[must_use]
8384    pub fn new(value: impl Into<crate::types::Decimal>) -> Self {
8385        Self {
8386            value: value.into(),
8387            measurand: None,
8388            context: None,
8389            phase: None,
8390            location: None,
8391            signed_meter_value: None,
8392            unit_of_measure: None,
8393            custom_data: None,
8394        }
8395    }
8396
8397    /// Sets the optional `measurand` field.
8398    #[must_use]
8399    pub fn with_measurand(mut self, value: Measurand) -> Self {
8400        self.measurand = Some(value);
8401        self
8402    }
8403
8404    /// Sets the optional `context` field.
8405    #[must_use]
8406    pub fn with_context(mut self, value: ReadingContext) -> Self {
8407        self.context = Some(value);
8408        self
8409    }
8410
8411    /// Sets the optional `phase` field.
8412    #[must_use]
8413    pub fn with_phase(mut self, value: Phase) -> Self {
8414        self.phase = Some(value);
8415        self
8416    }
8417
8418    /// Sets the optional `location` field.
8419    #[must_use]
8420    pub fn with_location(mut self, value: Location) -> Self {
8421        self.location = Some(value);
8422        self
8423    }
8424
8425    /// Sets the optional `signedMeterValue` field.
8426    #[must_use]
8427    pub fn with_signed_meter_value(mut self, value: SignedMeterValue) -> Self {
8428        self.signed_meter_value = Some(value);
8429        self
8430    }
8431
8432    /// Sets the optional `unitOfMeasure` field.
8433    #[must_use]
8434    pub fn with_unit_of_measure(mut self, value: UnitOfMeasure) -> Self {
8435        self.unit_of_measure = Some(value);
8436        self
8437    }
8438
8439    /// Sets the optional `customData` field.
8440    #[must_use]
8441    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8442        self.custom_data = Some(value);
8443        self
8444    }
8445}
8446
8447impl Validate for SampledValue {
8448    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8449        path.push_key("measurand");
8450        if let Some(value) = &self.measurand {
8451            Validate::validate_at(value, path, out);
8452        }
8453        path.pop();
8454        path.push_key("context");
8455        if let Some(value) = &self.context {
8456            Validate::validate_at(value, path, out);
8457        }
8458        path.pop();
8459        path.push_key("phase");
8460        if let Some(value) = &self.phase {
8461            Validate::validate_at(value, path, out);
8462        }
8463        path.pop();
8464        path.push_key("location");
8465        if let Some(value) = &self.location {
8466            Validate::validate_at(value, path, out);
8467        }
8468        path.pop();
8469        path.push_key("signedMeterValue");
8470        if let Some(value) = &self.signed_meter_value {
8471            Validate::validate_at(value, path, out);
8472        }
8473        path.pop();
8474        path.push_key("unitOfMeasure");
8475        if let Some(value) = &self.unit_of_measure {
8476            Validate::validate_at(value, path, out);
8477        }
8478        path.pop();
8479        path.push_key("customData");
8480        if let Some(value) = &self.custom_data {
8481            Validate::validate_at(value, path, out);
8482        }
8483        path.pop();
8484    }
8485}
8486
8487/// Class to hold parameters of SetVariableMonitoring request.
8488///
8489/// The OCPP 2.1 `SetMonitoringData` data type.
8490#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8491pub struct SetMonitoringData {
8492    /// Value for threshold or delta monitoring.
8493    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
8494    pub value: crate::types::Decimal,
8495    /// The `type` member.
8496    pub r#type: Monitor,
8497    /// 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.
8498    ///
8499    /// The severity levels have the following meaning: +
8500    /// *0-Danger* +
8501    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
8502    /// *1-Hardware Failure* +
8503    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
8504    /// *2-System Failure* +
8505    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
8506    /// *3-Critical* +
8507    /// Indicates a critical error. Action is required. +
8508    /// *4-Error* +
8509    /// Indicates a non-urgent error. Action is required. +
8510    /// *5-Alert* +
8511    /// Indicates an alert event. Default severity for any type of monitoring event.  +
8512    /// *6-Warning* +
8513    /// Indicates a warning event. Action may be required. +
8514    /// *7-Notice* +
8515    /// Indicates an unusual event. No immediate action is required. +
8516    /// *8-Informational* +
8517    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
8518    /// *9-Debug* +
8519    /// Indicates information useful to developers for debugging, not useful during operations.
8520    pub severity: i32,
8521    /// The `component` member.
8522    pub component: Component,
8523    /// The `variable` member.
8524    pub variable: Variable,
8525    /// An id SHALL only be given to replace an existing monitor. The Charging Station handles the generation of id's for new monitors.
8526    #[serde(default, skip_serializing_if = "Option::is_none")]
8527    pub id: Option<i32>,
8528    /// The `periodicEventStream` member.
8529    #[serde(rename = "periodicEventStream")]
8530    #[serde(default, skip_serializing_if = "Option::is_none")]
8531    pub periodic_event_stream: Option<PeriodicEventStreamParams>,
8532    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction. Default = false.
8533    /// Schema default: `false`.
8534    #[serde(default, skip_serializing_if = "Option::is_none")]
8535    pub transaction: Option<bool>,
8536    /// The `customData` member.
8537    #[serde(rename = "customData")]
8538    #[serde(default, skip_serializing_if = "Option::is_none")]
8539    pub custom_data: Option<crate::types::CustomData>,
8540}
8541
8542impl SetMonitoringData {
8543    /// Creates a `SetMonitoringData` from its required fields.
8544    #[must_use]
8545    pub fn new(
8546        value: impl Into<crate::types::Decimal>,
8547        r#type: Monitor,
8548        severity: i32,
8549        component: Component,
8550        variable: Variable,
8551    ) -> Self {
8552        Self {
8553            value: value.into(),
8554            r#type,
8555            severity,
8556            component,
8557            variable,
8558            id: None,
8559            periodic_event_stream: None,
8560            transaction: None,
8561            custom_data: None,
8562        }
8563    }
8564
8565    /// Sets the optional `id` field.
8566    #[must_use]
8567    pub fn with_id(mut self, value: i32) -> Self {
8568        self.id = Some(value);
8569        self
8570    }
8571
8572    /// Sets the optional `periodicEventStream` field.
8573    #[must_use]
8574    pub fn with_periodic_event_stream(mut self, value: PeriodicEventStreamParams) -> Self {
8575        self.periodic_event_stream = Some(value);
8576        self
8577    }
8578
8579    /// Sets the optional `transaction` field.
8580    #[must_use]
8581    pub fn with_transaction(mut self, value: bool) -> Self {
8582        self.transaction = Some(value);
8583        self
8584    }
8585
8586    /// Sets the optional `customData` field.
8587    #[must_use]
8588    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8589        self.custom_data = Some(value);
8590        self
8591    }
8592}
8593
8594impl Validate for SetMonitoringData {
8595    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8596        path.push_key("type");
8597        Validate::validate_at(&self.r#type, path, out);
8598        path.pop();
8599        path.push_key("severity");
8600        validate::int_range(i64::from(self.severity), Some(0.0), None, path, out);
8601        path.pop();
8602        path.push_key("component");
8603        Validate::validate_at(&self.component, path, out);
8604        path.pop();
8605        path.push_key("variable");
8606        Validate::validate_at(&self.variable, path, out);
8607        path.pop();
8608        path.push_key("id");
8609        if let Some(value) = &self.id {
8610            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
8611        }
8612        path.pop();
8613        path.push_key("periodicEventStream");
8614        if let Some(value) = &self.periodic_event_stream {
8615            Validate::validate_at(value, path, out);
8616        }
8617        path.pop();
8618        path.push_key("customData");
8619        if let Some(value) = &self.custom_data {
8620            Validate::validate_at(value, path, out);
8621        }
8622        path.pop();
8623    }
8624}
8625
8626/// Class to hold result of SetVariableMonitoring request.
8627///
8628/// The OCPP 2.1 `SetMonitoringResult` data type.
8629#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8630pub struct SetMonitoringResult {
8631    /// The `status` member.
8632    pub status: SetMonitoringStatus,
8633    /// The `type` member.
8634    pub r#type: Monitor,
8635    /// The `component` member.
8636    pub component: Component,
8637    /// The `variable` member.
8638    pub variable: Variable,
8639    /// 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.
8640    ///
8641    /// The severity levels have the following meaning: +
8642    /// *0-Danger* +
8643    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
8644    /// *1-Hardware Failure* +
8645    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
8646    /// *2-System Failure* +
8647    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
8648    /// *3-Critical* +
8649    /// Indicates a critical error. Action is required. +
8650    /// *4-Error* +
8651    /// Indicates a non-urgent error. Action is required. +
8652    /// *5-Alert* +
8653    /// Indicates an alert event. Default severity for any type of monitoring event.  +
8654    /// *6-Warning* +
8655    /// Indicates a warning event. Action may be required. +
8656    /// *7-Notice* +
8657    /// Indicates an unusual event. No immediate action is required. +
8658    /// *8-Informational* +
8659    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
8660    /// *9-Debug* +
8661    /// Indicates information useful to developers for debugging, not useful during operations.
8662    pub severity: i32,
8663    /// 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.
8664    #[serde(default, skip_serializing_if = "Option::is_none")]
8665    pub id: Option<i32>,
8666    /// The `statusInfo` member.
8667    #[serde(rename = "statusInfo")]
8668    #[serde(default, skip_serializing_if = "Option::is_none")]
8669    pub status_info: Option<StatusInfo>,
8670    /// The `customData` member.
8671    #[serde(rename = "customData")]
8672    #[serde(default, skip_serializing_if = "Option::is_none")]
8673    pub custom_data: Option<crate::types::CustomData>,
8674}
8675
8676impl SetMonitoringResult {
8677    /// Creates a `SetMonitoringResult` from its required fields.
8678    #[must_use]
8679    pub fn new(
8680        status: SetMonitoringStatus,
8681        r#type: Monitor,
8682        component: Component,
8683        variable: Variable,
8684        severity: i32,
8685    ) -> Self {
8686        Self {
8687            status,
8688            r#type,
8689            component,
8690            variable,
8691            severity,
8692            id: None,
8693            status_info: None,
8694            custom_data: None,
8695        }
8696    }
8697
8698    /// Sets the optional `id` field.
8699    #[must_use]
8700    pub fn with_id(mut self, value: i32) -> Self {
8701        self.id = Some(value);
8702        self
8703    }
8704
8705    /// Sets the optional `statusInfo` field.
8706    #[must_use]
8707    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8708        self.status_info = Some(value);
8709        self
8710    }
8711
8712    /// Sets the optional `customData` field.
8713    #[must_use]
8714    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8715        self.custom_data = Some(value);
8716        self
8717    }
8718}
8719
8720impl Validate for SetMonitoringResult {
8721    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8722        path.push_key("status");
8723        Validate::validate_at(&self.status, path, out);
8724        path.pop();
8725        path.push_key("type");
8726        Validate::validate_at(&self.r#type, path, out);
8727        path.pop();
8728        path.push_key("component");
8729        Validate::validate_at(&self.component, path, out);
8730        path.pop();
8731        path.push_key("variable");
8732        Validate::validate_at(&self.variable, path, out);
8733        path.pop();
8734        path.push_key("severity");
8735        validate::int_range(i64::from(self.severity), Some(0.0), None, path, out);
8736        path.pop();
8737        path.push_key("id");
8738        if let Some(value) = &self.id {
8739            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
8740        }
8741        path.pop();
8742        path.push_key("statusInfo");
8743        if let Some(value) = &self.status_info {
8744            Validate::validate_at(value, path, out);
8745        }
8746        path.pop();
8747        path.push_key("customData");
8748        if let Some(value) = &self.custom_data {
8749            Validate::validate_at(value, path, out);
8750        }
8751        path.pop();
8752    }
8753}
8754
8755/// The OCPP 2.1 `SetVariableData` data type.
8756#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8757pub struct SetVariableData {
8758    /// Value to be assigned to attribute of variable.
8759    /// This value is allowed to be an empty string ("").
8760    ///
8761    /// The Configuration Variable &lt;&lt;configkey-configuration-value-size,ConfigurationValueSize&gt;&gt; can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valuesList. The max size of these values will always remain equal.
8762    #[serde(rename = "attributeValue")]
8763    pub attribute_value: String,
8764    /// The `component` member.
8765    pub component: Component,
8766    /// The `variable` member.
8767    pub variable: Variable,
8768    /// The `attributeType` member.
8769    #[serde(rename = "attributeType")]
8770    #[serde(default, skip_serializing_if = "Option::is_none")]
8771    pub attribute_type: Option<Attribute>,
8772    /// The `customData` member.
8773    #[serde(rename = "customData")]
8774    #[serde(default, skip_serializing_if = "Option::is_none")]
8775    pub custom_data: Option<crate::types::CustomData>,
8776}
8777
8778impl SetVariableData {
8779    /// Creates a `SetVariableData` from its required fields.
8780    #[must_use]
8781    pub fn new(
8782        attribute_value: impl Into<String>,
8783        component: Component,
8784        variable: Variable,
8785    ) -> Self {
8786        Self {
8787            attribute_value: attribute_value.into(),
8788            component,
8789            variable,
8790            attribute_type: None,
8791            custom_data: None,
8792        }
8793    }
8794
8795    /// Sets the optional `attributeType` field.
8796    #[must_use]
8797    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
8798        self.attribute_type = Some(value);
8799        self
8800    }
8801
8802    /// Sets the optional `customData` field.
8803    #[must_use]
8804    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8805        self.custom_data = Some(value);
8806        self
8807    }
8808}
8809
8810impl Validate for SetVariableData {
8811    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8812        path.push_key("attributeValue");
8813        validate::string(self.attribute_value.as_str(), None, Some(2500), path, out);
8814        path.pop();
8815        path.push_key("component");
8816        Validate::validate_at(&self.component, path, out);
8817        path.pop();
8818        path.push_key("variable");
8819        Validate::validate_at(&self.variable, path, out);
8820        path.pop();
8821        path.push_key("attributeType");
8822        if let Some(value) = &self.attribute_type {
8823            Validate::validate_at(value, path, out);
8824        }
8825        path.pop();
8826        path.push_key("customData");
8827        if let Some(value) = &self.custom_data {
8828            Validate::validate_at(value, path, out);
8829        }
8830        path.pop();
8831    }
8832}
8833
8834/// The OCPP 2.1 `SetVariableResult` data type.
8835#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8836pub struct SetVariableResult {
8837    /// The `attributeStatus` member.
8838    #[serde(rename = "attributeStatus")]
8839    pub attribute_status: SetVariableStatus,
8840    /// The `component` member.
8841    pub component: Component,
8842    /// The `variable` member.
8843    pub variable: Variable,
8844    /// The `attributeType` member.
8845    #[serde(rename = "attributeType")]
8846    #[serde(default, skip_serializing_if = "Option::is_none")]
8847    pub attribute_type: Option<Attribute>,
8848    /// The `attributeStatusInfo` member.
8849    #[serde(rename = "attributeStatusInfo")]
8850    #[serde(default, skip_serializing_if = "Option::is_none")]
8851    pub attribute_status_info: Option<StatusInfo>,
8852    /// The `customData` member.
8853    #[serde(rename = "customData")]
8854    #[serde(default, skip_serializing_if = "Option::is_none")]
8855    pub custom_data: Option<crate::types::CustomData>,
8856}
8857
8858impl SetVariableResult {
8859    /// Creates a `SetVariableResult` from its required fields.
8860    #[must_use]
8861    pub fn new(
8862        attribute_status: SetVariableStatus,
8863        component: Component,
8864        variable: Variable,
8865    ) -> Self {
8866        Self {
8867            attribute_status,
8868            component,
8869            variable,
8870            attribute_type: None,
8871            attribute_status_info: None,
8872            custom_data: None,
8873        }
8874    }
8875
8876    /// Sets the optional `attributeType` field.
8877    #[must_use]
8878    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
8879        self.attribute_type = Some(value);
8880        self
8881    }
8882
8883    /// Sets the optional `attributeStatusInfo` field.
8884    #[must_use]
8885    pub fn with_attribute_status_info(mut self, value: StatusInfo) -> Self {
8886        self.attribute_status_info = Some(value);
8887        self
8888    }
8889
8890    /// Sets the optional `customData` field.
8891    #[must_use]
8892    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8893        self.custom_data = Some(value);
8894        self
8895    }
8896}
8897
8898impl Validate for SetVariableResult {
8899    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8900        path.push_key("attributeStatus");
8901        Validate::validate_at(&self.attribute_status, path, out);
8902        path.pop();
8903        path.push_key("component");
8904        Validate::validate_at(&self.component, path, out);
8905        path.pop();
8906        path.push_key("variable");
8907        Validate::validate_at(&self.variable, path, out);
8908        path.pop();
8909        path.push_key("attributeType");
8910        if let Some(value) = &self.attribute_type {
8911            Validate::validate_at(value, path, out);
8912        }
8913        path.pop();
8914        path.push_key("attributeStatusInfo");
8915        if let Some(value) = &self.attribute_status_info {
8916            Validate::validate_at(value, path, out);
8917        }
8918        path.pop();
8919        path.push_key("customData");
8920        if let Some(value) = &self.custom_data {
8921            Validate::validate_at(value, path, out);
8922        }
8923        path.pop();
8924    }
8925}
8926
8927/// Represent a signed version of the meter value.
8928///
8929/// The OCPP 2.1 `SignedMeterValue` data type.
8930#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8931pub struct SignedMeterValue {
8932    /// Base64 encoded, contains the signed data from the meter in the format specified in _encodingMethod_, which might contain more then just the meter value. It can contain information like timestamps, reference to a customer etc.
8933    #[serde(rename = "signedMeterData")]
8934    pub signed_meter_data: String,
8935    /// Format used by the energy meter to encode the meter data. For example: OCMF or EDL.
8936    #[serde(rename = "encodingMethod")]
8937    pub encoding_method: String,
8938    /// *(2.1)* Method used to create the digital signature. Optional, if already included in _signedMeterData_. Standard values for this are defined in Appendix as SigningMethodEnumStringType.
8939    #[serde(rename = "signingMethod")]
8940    #[serde(default, skip_serializing_if = "Option::is_none")]
8941    pub signing_method: Option<String>,
8942    /// *(2.1)* Base64 encoded, sending depends on configuration variable _PublicKeyWithSignedMeterValue_.
8943    #[serde(rename = "publicKey")]
8944    #[serde(default, skip_serializing_if = "Option::is_none")]
8945    pub public_key: Option<String>,
8946    /// The `customData` member.
8947    #[serde(rename = "customData")]
8948    #[serde(default, skip_serializing_if = "Option::is_none")]
8949    pub custom_data: Option<crate::types::CustomData>,
8950}
8951
8952impl SignedMeterValue {
8953    /// Creates a `SignedMeterValue` from its required fields.
8954    #[must_use]
8955    pub fn new(signed_meter_data: impl Into<String>, encoding_method: impl Into<String>) -> Self {
8956        Self {
8957            signed_meter_data: signed_meter_data.into(),
8958            encoding_method: encoding_method.into(),
8959            signing_method: None,
8960            public_key: None,
8961            custom_data: None,
8962        }
8963    }
8964
8965    /// Sets the optional `signingMethod` field.
8966    #[must_use]
8967    pub fn with_signing_method(mut self, value: impl Into<String>) -> Self {
8968        self.signing_method = Some(value.into());
8969        self
8970    }
8971
8972    /// Sets the optional `publicKey` field.
8973    #[must_use]
8974    pub fn with_public_key(mut self, value: impl Into<String>) -> Self {
8975        self.public_key = Some(value.into());
8976        self
8977    }
8978
8979    /// Sets the optional `customData` field.
8980    #[must_use]
8981    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8982        self.custom_data = Some(value);
8983        self
8984    }
8985}
8986
8987impl Validate for SignedMeterValue {
8988    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8989        path.push_key("signedMeterData");
8990        validate::string(
8991            self.signed_meter_data.as_str(),
8992            None,
8993            Some(32768),
8994            path,
8995            out,
8996        );
8997        path.pop();
8998        path.push_key("encodingMethod");
8999        validate::string(self.encoding_method.as_str(), None, Some(50), path, out);
9000        path.pop();
9001        path.push_key("signingMethod");
9002        if let Some(value) = &self.signing_method {
9003            validate::string(value.as_str(), None, Some(50), path, out);
9004        }
9005        path.pop();
9006        path.push_key("publicKey");
9007        if let Some(value) = &self.public_key {
9008            validate::string(value.as_str(), None, Some(2500), path, out);
9009        }
9010        path.pop();
9011        path.push_key("customData");
9012        if let Some(value) = &self.custom_data {
9013            Validate::validate_at(value, path, out);
9014        }
9015        path.pop();
9016    }
9017}
9018
9019/// Element providing more information about the status.
9020///
9021/// The OCPP 2.1 `StatusInfo` data type.
9022#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9023pub struct StatusInfo {
9024    /// A predefined code for the reason why the status is returned in this response. The string is case-insensitive.
9025    #[serde(rename = "reasonCode")]
9026    pub reason_code: String,
9027    /// Additional text to provide detailed information.
9028    #[serde(rename = "additionalInfo")]
9029    #[serde(default, skip_serializing_if = "Option::is_none")]
9030    pub additional_info: Option<String>,
9031    /// The `customData` member.
9032    #[serde(rename = "customData")]
9033    #[serde(default, skip_serializing_if = "Option::is_none")]
9034    pub custom_data: Option<crate::types::CustomData>,
9035}
9036
9037impl StatusInfo {
9038    /// Creates a `StatusInfo` from its required fields.
9039    #[must_use]
9040    pub fn new(reason_code: impl Into<String>) -> Self {
9041        Self {
9042            reason_code: reason_code.into(),
9043            additional_info: None,
9044            custom_data: None,
9045        }
9046    }
9047
9048    /// Sets the optional `additionalInfo` field.
9049    #[must_use]
9050    pub fn with_additional_info(mut self, value: impl Into<String>) -> Self {
9051        self.additional_info = Some(value.into());
9052        self
9053    }
9054
9055    /// Sets the optional `customData` field.
9056    #[must_use]
9057    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9058        self.custom_data = Some(value);
9059        self
9060    }
9061}
9062
9063impl Validate for StatusInfo {
9064    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9065        path.push_key("reasonCode");
9066        validate::string(self.reason_code.as_str(), None, Some(20), path, out);
9067        path.pop();
9068        path.push_key("additionalInfo");
9069        if let Some(value) = &self.additional_info {
9070            validate::string(value.as_str(), None, Some(1024), path, out);
9071        }
9072        path.pop();
9073        path.push_key("customData");
9074        if let Some(value) = &self.custom_data {
9075            Validate::validate_at(value, path, out);
9076        }
9077        path.pop();
9078    }
9079}
9080
9081/// The OCPP 2.1 `StreamDataElement` data type.
9082#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9083pub struct StreamDataElement {
9084    /// Offset relative to _basetime_ of this message. _basetime_ + _t_ is timestamp of recorded value.
9085    pub t: crate::types::Decimal,
9086    /// The `v` member.
9087    pub v: String,
9088    /// The `customData` member.
9089    #[serde(rename = "customData")]
9090    #[serde(default, skip_serializing_if = "Option::is_none")]
9091    pub custom_data: Option<crate::types::CustomData>,
9092}
9093
9094impl StreamDataElement {
9095    /// Creates a `StreamDataElement` from its required fields.
9096    #[must_use]
9097    pub fn new(t: impl Into<crate::types::Decimal>, v: impl Into<String>) -> Self {
9098        Self {
9099            t: t.into(),
9100            v: v.into(),
9101            custom_data: None,
9102        }
9103    }
9104
9105    /// Sets the optional `customData` field.
9106    #[must_use]
9107    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9108        self.custom_data = Some(value);
9109        self
9110    }
9111}
9112
9113impl Validate for StreamDataElement {
9114    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9115        path.push_key("v");
9116        validate::string(self.v.as_str(), None, Some(2500), path, out);
9117        path.pop();
9118        path.push_key("customData");
9119        if let Some(value) = &self.custom_data {
9120            Validate::validate_at(value, path, out);
9121        }
9122        path.pop();
9123    }
9124}
9125
9126/// A tariff is described by fields with prices for:
9127/// energy,
9128/// charging time,
9129/// idle time,
9130/// fixed fee,
9131/// reservation time,
9132/// reservation fixed fee. +
9133/// Each of these fields may have (optional) conditions that specify when a price is applicable. +
9134/// The _description_ contains a human-readable explanation of the tariff to be shown to the user. +
9135/// The other fields are parameters that define the tariff. These are used by the charging station to calculate the price.
9136///
9137/// The OCPP 2.1 `Tariff` data type.
9138#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9139pub struct Tariff {
9140    /// Unique id of tariff
9141    #[serde(rename = "tariffId")]
9142    pub tariff_id: String,
9143    /// Currency code according to ISO 4217
9144    pub currency: String,
9145    /// The `description` member.
9146    #[serde(default, skip_serializing_if = "Option::is_none")]
9147    pub description: Option<Vec<MessageContent>>,
9148    /// The `energy` member.
9149    #[serde(default, skip_serializing_if = "Option::is_none")]
9150    pub energy: Option<TariffEnergy>,
9151    /// Time when this tariff becomes active. When absent, it is immediately active.
9152    #[serde(rename = "validFrom")]
9153    #[serde(default, skip_serializing_if = "Option::is_none")]
9154    pub valid_from: Option<crate::types::DateTime>,
9155    /// The `chargingTime` member.
9156    #[serde(rename = "chargingTime")]
9157    #[serde(default, skip_serializing_if = "Option::is_none")]
9158    pub charging_time: Option<TariffTime>,
9159    /// The `idleTime` member.
9160    #[serde(rename = "idleTime")]
9161    #[serde(default, skip_serializing_if = "Option::is_none")]
9162    pub idle_time: Option<TariffTime>,
9163    /// The `fixedFee` member.
9164    #[serde(rename = "fixedFee")]
9165    #[serde(default, skip_serializing_if = "Option::is_none")]
9166    pub fixed_fee: Option<TariffFixed>,
9167    /// The `reservationTime` member.
9168    #[serde(rename = "reservationTime")]
9169    #[serde(default, skip_serializing_if = "Option::is_none")]
9170    pub reservation_time: Option<TariffTime>,
9171    /// The `reservationFixed` member.
9172    #[serde(rename = "reservationFixed")]
9173    #[serde(default, skip_serializing_if = "Option::is_none")]
9174    pub reservation_fixed: Option<TariffFixed>,
9175    /// The `minCost` member.
9176    #[serde(rename = "minCost")]
9177    #[serde(default, skip_serializing_if = "Option::is_none")]
9178    pub min_cost: Option<Price>,
9179    /// The `maxCost` member.
9180    #[serde(rename = "maxCost")]
9181    #[serde(default, skip_serializing_if = "Option::is_none")]
9182    pub max_cost: Option<Price>,
9183    /// The `customData` member.
9184    #[serde(rename = "customData")]
9185    #[serde(default, skip_serializing_if = "Option::is_none")]
9186    pub custom_data: Option<crate::types::CustomData>,
9187}
9188
9189impl Tariff {
9190    /// Creates a `Tariff` from its required fields.
9191    #[must_use]
9192    pub fn new(tariff_id: impl Into<String>, currency: impl Into<String>) -> Self {
9193        Self {
9194            tariff_id: tariff_id.into(),
9195            currency: currency.into(),
9196            description: None,
9197            energy: None,
9198            valid_from: None,
9199            charging_time: None,
9200            idle_time: None,
9201            fixed_fee: None,
9202            reservation_time: None,
9203            reservation_fixed: None,
9204            min_cost: None,
9205            max_cost: None,
9206            custom_data: None,
9207        }
9208    }
9209
9210    /// Sets the optional `description` field.
9211    #[must_use]
9212    pub fn with_description(mut self, value: Vec<MessageContent>) -> Self {
9213        self.description = Some(value);
9214        self
9215    }
9216
9217    /// Sets the optional `energy` field.
9218    #[must_use]
9219    pub fn with_energy(mut self, value: TariffEnergy) -> Self {
9220        self.energy = Some(value);
9221        self
9222    }
9223
9224    /// Sets the optional `validFrom` field.
9225    #[must_use]
9226    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
9227        self.valid_from = Some(value.into());
9228        self
9229    }
9230
9231    /// Sets the optional `chargingTime` field.
9232    #[must_use]
9233    pub fn with_charging_time(mut self, value: TariffTime) -> Self {
9234        self.charging_time = Some(value);
9235        self
9236    }
9237
9238    /// Sets the optional `idleTime` field.
9239    #[must_use]
9240    pub fn with_idle_time(mut self, value: TariffTime) -> Self {
9241        self.idle_time = Some(value);
9242        self
9243    }
9244
9245    /// Sets the optional `fixedFee` field.
9246    #[must_use]
9247    pub fn with_fixed_fee(mut self, value: TariffFixed) -> Self {
9248        self.fixed_fee = Some(value);
9249        self
9250    }
9251
9252    /// Sets the optional `reservationTime` field.
9253    #[must_use]
9254    pub fn with_reservation_time(mut self, value: TariffTime) -> Self {
9255        self.reservation_time = Some(value);
9256        self
9257    }
9258
9259    /// Sets the optional `reservationFixed` field.
9260    #[must_use]
9261    pub fn with_reservation_fixed(mut self, value: TariffFixed) -> Self {
9262        self.reservation_fixed = Some(value);
9263        self
9264    }
9265
9266    /// Sets the optional `minCost` field.
9267    #[must_use]
9268    pub fn with_min_cost(mut self, value: Price) -> Self {
9269        self.min_cost = Some(value);
9270        self
9271    }
9272
9273    /// Sets the optional `maxCost` field.
9274    #[must_use]
9275    pub fn with_max_cost(mut self, value: Price) -> Self {
9276        self.max_cost = Some(value);
9277        self
9278    }
9279
9280    /// Sets the optional `customData` field.
9281    #[must_use]
9282    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9283        self.custom_data = Some(value);
9284        self
9285    }
9286}
9287
9288impl Validate for Tariff {
9289    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9290        path.push_key("tariffId");
9291        validate::string(self.tariff_id.as_str(), None, Some(60), path, out);
9292        path.pop();
9293        path.push_key("currency");
9294        validate::string(self.currency.as_str(), None, Some(3), path, out);
9295        path.pop();
9296        path.push_key("description");
9297        if let Some(value) = &self.description {
9298            validate::list_len(value.len(), Some(1), Some(10), path, out);
9299            for (index, item) in value.iter().enumerate() {
9300                path.push_index(index);
9301                Validate::validate_at(item, path, out);
9302                path.pop();
9303            }
9304        }
9305        path.pop();
9306        path.push_key("energy");
9307        if let Some(value) = &self.energy {
9308            Validate::validate_at(value, path, out);
9309        }
9310        path.pop();
9311        path.push_key("chargingTime");
9312        if let Some(value) = &self.charging_time {
9313            Validate::validate_at(value, path, out);
9314        }
9315        path.pop();
9316        path.push_key("idleTime");
9317        if let Some(value) = &self.idle_time {
9318            Validate::validate_at(value, path, out);
9319        }
9320        path.pop();
9321        path.push_key("fixedFee");
9322        if let Some(value) = &self.fixed_fee {
9323            Validate::validate_at(value, path, out);
9324        }
9325        path.pop();
9326        path.push_key("reservationTime");
9327        if let Some(value) = &self.reservation_time {
9328            Validate::validate_at(value, path, out);
9329        }
9330        path.pop();
9331        path.push_key("reservationFixed");
9332        if let Some(value) = &self.reservation_fixed {
9333            Validate::validate_at(value, path, out);
9334        }
9335        path.pop();
9336        path.push_key("minCost");
9337        if let Some(value) = &self.min_cost {
9338            Validate::validate_at(value, path, out);
9339        }
9340        path.pop();
9341        path.push_key("maxCost");
9342        if let Some(value) = &self.max_cost {
9343            Validate::validate_at(value, path, out);
9344        }
9345        path.pop();
9346        path.push_key("customData");
9347        if let Some(value) = &self.custom_data {
9348            Validate::validate_at(value, path, out);
9349        }
9350        path.pop();
9351    }
9352}
9353
9354/// Shows assignment of tariffs to EVSE or IdToken.
9355///
9356/// The OCPP 2.1 `TariffAssignment` data type.
9357#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9358pub struct TariffAssignment {
9359    /// Tariff id.
9360    #[serde(rename = "tariffId")]
9361    pub tariff_id: String,
9362    /// The `tariffKind` member.
9363    #[serde(rename = "tariffKind")]
9364    pub tariff_kind: TariffKind,
9365    /// Date/time when this tariff become active.
9366    #[serde(rename = "validFrom")]
9367    #[serde(default, skip_serializing_if = "Option::is_none")]
9368    pub valid_from: Option<crate::types::DateTime>,
9369    /// The `evseIds` member.
9370    #[serde(rename = "evseIds")]
9371    #[serde(default, skip_serializing_if = "Option::is_none")]
9372    pub evse_ids: Option<Vec<i32>>,
9373    /// IdTokens related to tariff
9374    #[serde(rename = "idTokens")]
9375    #[serde(default, skip_serializing_if = "Option::is_none")]
9376    pub id_tokens: Option<Vec<String>>,
9377    /// The `customData` member.
9378    #[serde(rename = "customData")]
9379    #[serde(default, skip_serializing_if = "Option::is_none")]
9380    pub custom_data: Option<crate::types::CustomData>,
9381}
9382
9383impl TariffAssignment {
9384    /// Creates a `TariffAssignment` from its required fields.
9385    #[must_use]
9386    pub fn new(tariff_id: impl Into<String>, tariff_kind: TariffKind) -> Self {
9387        Self {
9388            tariff_id: tariff_id.into(),
9389            tariff_kind,
9390            valid_from: None,
9391            evse_ids: None,
9392            id_tokens: None,
9393            custom_data: None,
9394        }
9395    }
9396
9397    /// Sets the optional `validFrom` field.
9398    #[must_use]
9399    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
9400        self.valid_from = Some(value.into());
9401        self
9402    }
9403
9404    /// Sets the optional `evseIds` field.
9405    #[must_use]
9406    pub fn with_evse_ids(mut self, value: Vec<i32>) -> Self {
9407        self.evse_ids = Some(value);
9408        self
9409    }
9410
9411    /// Sets the optional `idTokens` field.
9412    #[must_use]
9413    pub fn with_id_tokens(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
9414        self.id_tokens = Some(value.into_iter().map(Into::into).collect());
9415        self
9416    }
9417
9418    /// Sets the optional `customData` field.
9419    #[must_use]
9420    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9421        self.custom_data = Some(value);
9422        self
9423    }
9424}
9425
9426impl Validate for TariffAssignment {
9427    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9428        path.push_key("tariffId");
9429        validate::string(self.tariff_id.as_str(), None, Some(60), path, out);
9430        path.pop();
9431        path.push_key("tariffKind");
9432        Validate::validate_at(&self.tariff_kind, path, out);
9433        path.pop();
9434        path.push_key("evseIds");
9435        if let Some(value) = &self.evse_ids {
9436            validate::list_len(value.len(), Some(1), None, path, out);
9437            for (index, item) in value.iter().enumerate() {
9438                path.push_index(index);
9439                validate::int_range(i64::from(*item), Some(0.0), None, path, out);
9440                path.pop();
9441            }
9442        }
9443        path.pop();
9444        path.push_key("idTokens");
9445        if let Some(value) = &self.id_tokens {
9446            validate::list_len(value.len(), Some(1), None, path, out);
9447            for (index, item) in value.iter().enumerate() {
9448                path.push_index(index);
9449                validate::string(item.as_str(), None, Some(255), path, out);
9450                path.pop();
9451            }
9452        }
9453        path.pop();
9454        path.push_key("customData");
9455        if let Some(value) = &self.custom_data {
9456            Validate::validate_at(value, path, out);
9457        }
9458        path.pop();
9459    }
9460}
9461
9462/// These conditions describe if and when a TariffEnergyType or TariffTimeType applies during a transaction.
9463///
9464/// When more than one restriction is set, they are to be treated as a logical AND. All need to be valid before this price is active.
9465///
9466/// For reverse energy flow (discharging) negative values of energy, power and current are used.
9467///
9468/// NOTE: _minXXX_ (where XXX = Kwh/A/Kw) must be read as "closest to zero", and _maxXXX_ as "furthest from zero". For example, a *charging* power range from 10 kW to 50 kWh is given by _minPower_ = 10000 and _maxPower_ = 50000, and a *discharging* power range from -10 kW to -50 kW is given by _minPower_ = -10 and _maxPower_ = -50.
9469///
9470/// NOTE: _startTimeOfDay_ and _endTimeOfDay_ are in local time, because it is the time in the tariff as it is shown to the EV driver at the Charging Station.
9471/// A Charging Station will convert this to the internal time zone that it uses (which is recommended to be UTC, see section Generic chapter 3.1) when performing cost calculation.
9472///
9473/// The OCPP 2.1 `TariffConditions` data type.
9474#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9475pub struct TariffConditions {
9476    /// Start time of day in local time. +
9477    /// Format as per RFC 3339: time-hour ":" time-minute  +
9478    /// Must be in 24h format with leading zeros. Hour/Minute separator: ":"
9479    /// Regex: (\[0-1\]\[0-9\]\|2\[0-3\]):\[0-5\]\[0-9\]
9480    #[serde(rename = "startTimeOfDay")]
9481    #[serde(default, skip_serializing_if = "Option::is_none")]
9482    pub start_time_of_day: Option<String>,
9483    /// End time of day in local time. Same syntax as _startTimeOfDay_. +
9484    ///     If end time &lt; start time then the period wraps around to the next day. +
9485    ///     To stop at end of the day use: 00:00.
9486    #[serde(rename = "endTimeOfDay")]
9487    #[serde(default, skip_serializing_if = "Option::is_none")]
9488    pub end_time_of_day: Option<String>,
9489    /// Day(s) of the week this is tariff applies.
9490    #[serde(rename = "dayOfWeek")]
9491    #[serde(default, skip_serializing_if = "Option::is_none")]
9492    pub day_of_week: Option<Vec<DayOfWeek>>,
9493    /// Start date in local time, for example: 2015-12-24.
9494    /// Valid from this day (inclusive). +
9495    /// Format as per RFC 3339: full-date  +
9496    ///
9497    /// Regex: (\[12\]\[0-9\]{3})-(0\[1-9\]\|1\[0-2\])-(0\[1-9\]\|\[12\]\[0-9\]\|3\[01\])
9498    #[serde(rename = "validFromDate")]
9499    #[serde(default, skip_serializing_if = "Option::is_none")]
9500    pub valid_from_date: Option<String>,
9501    /// End date in local time, for example: 2015-12-27.
9502    ///     Valid until this day (exclusive). Same syntax as _validFromDate_.
9503    #[serde(rename = "validToDate")]
9504    #[serde(default, skip_serializing_if = "Option::is_none")]
9505    pub valid_to_date: Option<String>,
9506    /// The `evseKind` member.
9507    #[serde(rename = "evseKind")]
9508    #[serde(default, skip_serializing_if = "Option::is_none")]
9509    pub evse_kind: Option<EvseKind>,
9510    /// Minimum consumed energy in Wh, for example 20000 Wh.
9511    ///     Valid from this amount of energy (inclusive) being used.
9512    #[serde(rename = "minEnergy")]
9513    #[serde(default, skip_serializing_if = "Option::is_none")]
9514    pub min_energy: Option<crate::types::Decimal>,
9515    /// Maximum consumed energy in Wh, for example 50000 Wh.
9516    ///     Valid until this amount of energy (exclusive) being used.
9517    #[serde(rename = "maxEnergy")]
9518    #[serde(default, skip_serializing_if = "Option::is_none")]
9519    pub max_energy: Option<crate::types::Decimal>,
9520    /// Sum of the minimum current (in Amperes) over all phases, for example 5 A.
9521    ///     When the EV is charging with more than, or equal to, the defined amount of current, this price is/becomes active. If the charging current is or becomes lower, this price is not or no longer valid and becomes inactive. +
9522    ///     This is NOT about the minimum current over the entire transaction.
9523    #[serde(rename = "minCurrent")]
9524    #[serde(default, skip_serializing_if = "Option::is_none")]
9525    pub min_current: Option<crate::types::Decimal>,
9526    /// Sum of the maximum current (in Amperes) over all phases, for example 20 A.
9527    ///       When the EV is charging with less than the defined amount of current, this price becomes/is active. If the charging current is or becomes higher, this price is not or no longer valid and becomes inactive.
9528    ///       This is NOT about the maximum current over the entire transaction.
9529    #[serde(rename = "maxCurrent")]
9530    #[serde(default, skip_serializing_if = "Option::is_none")]
9531    pub max_current: Option<crate::types::Decimal>,
9532    /// Minimum power in W, for example 5000 W.
9533    ///       When the EV is charging with more than, or equal to, the defined amount of power, this price is/becomes active.
9534    ///       If the charging power is or becomes lower, this price is not or no longer valid and becomes inactive.
9535    ///       This is NOT about the minimum power over the entire transaction.
9536    #[serde(rename = "minPower")]
9537    #[serde(default, skip_serializing_if = "Option::is_none")]
9538    pub min_power: Option<crate::types::Decimal>,
9539    /// Maximum power in W, for example 20000 W.
9540    ///       When the EV is charging with less than the defined amount of power, this price becomes/is active.
9541    ///       If the charging power is or becomes higher, this price is not or no longer valid and becomes inactive.
9542    ///       This is NOT about the maximum power over the entire transaction.
9543    #[serde(rename = "maxPower")]
9544    #[serde(default, skip_serializing_if = "Option::is_none")]
9545    pub max_power: Option<crate::types::Decimal>,
9546    /// Minimum duration in seconds the transaction (charging &amp; idle) MUST last (inclusive).
9547    ///       When the duration of a transaction is longer than the defined value, this price is or becomes active.
9548    ///       Before that moment, this price is not yet active.
9549    #[serde(rename = "minTime")]
9550    #[serde(default, skip_serializing_if = "Option::is_none")]
9551    pub min_time: Option<i32>,
9552    /// Maximum duration in seconds the transaction (charging &amp; idle) MUST last (exclusive).
9553    ///       When the duration of a transaction is shorter than the defined value, this price is or becomes active.
9554    ///       After that moment, this price is no longer active.
9555    #[serde(rename = "maxTime")]
9556    #[serde(default, skip_serializing_if = "Option::is_none")]
9557    pub max_time: Option<i32>,
9558    /// Minimum duration in seconds the charging MUST last (inclusive).
9559    ///       When the duration of a charging is longer than the defined value, this price is or becomes active.
9560    ///       Before that moment, this price is not yet active.
9561    #[serde(rename = "minChargingTime")]
9562    #[serde(default, skip_serializing_if = "Option::is_none")]
9563    pub min_charging_time: Option<i32>,
9564    /// Maximum duration in seconds the charging MUST last (exclusive).
9565    ///       When the duration of a charging is shorter than the defined value, this price is or becomes active.
9566    ///       After that moment, this price is no longer active.
9567    #[serde(rename = "maxChargingTime")]
9568    #[serde(default, skip_serializing_if = "Option::is_none")]
9569    pub max_charging_time: Option<i32>,
9570    /// Minimum duration in seconds the idle period (i.e. not charging) MUST last (inclusive).
9571    ///       When the duration of the idle time is longer than the defined value, this price is or becomes active.
9572    ///       Before that moment, this price is not yet active.
9573    #[serde(rename = "minIdleTime")]
9574    #[serde(default, skip_serializing_if = "Option::is_none")]
9575    pub min_idle_time: Option<i32>,
9576    /// Maximum duration in seconds the idle period (i.e. not charging) MUST last (exclusive).
9577    ///       When the duration of idle time is shorter than the defined value, this price is or becomes active.
9578    ///       After that moment, this price is no longer active.
9579    #[serde(rename = "maxIdleTime")]
9580    #[serde(default, skip_serializing_if = "Option::is_none")]
9581    pub max_idle_time: Option<i32>,
9582    /// The `customData` member.
9583    #[serde(rename = "customData")]
9584    #[serde(default, skip_serializing_if = "Option::is_none")]
9585    pub custom_data: Option<crate::types::CustomData>,
9586}
9587
9588impl TariffConditions {
9589    /// Creates an empty `TariffConditions`. Every field of this type is optional.
9590    #[must_use]
9591    pub fn new() -> Self {
9592        Self::default()
9593    }
9594
9595    /// Sets the optional `startTimeOfDay` field.
9596    #[must_use]
9597    pub fn with_start_time_of_day(mut self, value: impl Into<String>) -> Self {
9598        self.start_time_of_day = Some(value.into());
9599        self
9600    }
9601
9602    /// Sets the optional `endTimeOfDay` field.
9603    #[must_use]
9604    pub fn with_end_time_of_day(mut self, value: impl Into<String>) -> Self {
9605        self.end_time_of_day = Some(value.into());
9606        self
9607    }
9608
9609    /// Sets the optional `dayOfWeek` field.
9610    #[must_use]
9611    pub fn with_day_of_week(mut self, value: Vec<DayOfWeek>) -> Self {
9612        self.day_of_week = Some(value);
9613        self
9614    }
9615
9616    /// Sets the optional `validFromDate` field.
9617    #[must_use]
9618    pub fn with_valid_from_date(mut self, value: impl Into<String>) -> Self {
9619        self.valid_from_date = Some(value.into());
9620        self
9621    }
9622
9623    /// Sets the optional `validToDate` field.
9624    #[must_use]
9625    pub fn with_valid_to_date(mut self, value: impl Into<String>) -> Self {
9626        self.valid_to_date = Some(value.into());
9627        self
9628    }
9629
9630    /// Sets the optional `evseKind` field.
9631    #[must_use]
9632    pub fn with_evse_kind(mut self, value: EvseKind) -> Self {
9633        self.evse_kind = Some(value);
9634        self
9635    }
9636
9637    /// Sets the optional `minEnergy` field.
9638    #[must_use]
9639    pub fn with_min_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9640        self.min_energy = Some(value.into());
9641        self
9642    }
9643
9644    /// Sets the optional `maxEnergy` field.
9645    #[must_use]
9646    pub fn with_max_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9647        self.max_energy = Some(value.into());
9648        self
9649    }
9650
9651    /// Sets the optional `minCurrent` field.
9652    #[must_use]
9653    pub fn with_min_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9654        self.min_current = Some(value.into());
9655        self
9656    }
9657
9658    /// Sets the optional `maxCurrent` field.
9659    #[must_use]
9660    pub fn with_max_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9661        self.max_current = Some(value.into());
9662        self
9663    }
9664
9665    /// Sets the optional `minPower` field.
9666    #[must_use]
9667    pub fn with_min_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9668        self.min_power = Some(value.into());
9669        self
9670    }
9671
9672    /// Sets the optional `maxPower` field.
9673    #[must_use]
9674    pub fn with_max_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9675        self.max_power = Some(value.into());
9676        self
9677    }
9678
9679    /// Sets the optional `minTime` field.
9680    #[must_use]
9681    pub fn with_min_time(mut self, value: i32) -> Self {
9682        self.min_time = Some(value);
9683        self
9684    }
9685
9686    /// Sets the optional `maxTime` field.
9687    #[must_use]
9688    pub fn with_max_time(mut self, value: i32) -> Self {
9689        self.max_time = Some(value);
9690        self
9691    }
9692
9693    /// Sets the optional `minChargingTime` field.
9694    #[must_use]
9695    pub fn with_min_charging_time(mut self, value: i32) -> Self {
9696        self.min_charging_time = Some(value);
9697        self
9698    }
9699
9700    /// Sets the optional `maxChargingTime` field.
9701    #[must_use]
9702    pub fn with_max_charging_time(mut self, value: i32) -> Self {
9703        self.max_charging_time = Some(value);
9704        self
9705    }
9706
9707    /// Sets the optional `minIdleTime` field.
9708    #[must_use]
9709    pub fn with_min_idle_time(mut self, value: i32) -> Self {
9710        self.min_idle_time = Some(value);
9711        self
9712    }
9713
9714    /// Sets the optional `maxIdleTime` field.
9715    #[must_use]
9716    pub fn with_max_idle_time(mut self, value: i32) -> Self {
9717        self.max_idle_time = Some(value);
9718        self
9719    }
9720
9721    /// Sets the optional `customData` field.
9722    #[must_use]
9723    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9724        self.custom_data = Some(value);
9725        self
9726    }
9727}
9728
9729impl Validate for TariffConditions {
9730    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9731        path.push_key("dayOfWeek");
9732        if let Some(value) = &self.day_of_week {
9733            validate::list_len(value.len(), Some(1), Some(7), path, out);
9734            for (index, item) in value.iter().enumerate() {
9735                path.push_index(index);
9736                Validate::validate_at(item, path, out);
9737                path.pop();
9738            }
9739        }
9740        path.pop();
9741        path.push_key("evseKind");
9742        if let Some(value) = &self.evse_kind {
9743            Validate::validate_at(value, path, out);
9744        }
9745        path.pop();
9746        path.push_key("customData");
9747        if let Some(value) = &self.custom_data {
9748            Validate::validate_at(value, path, out);
9749        }
9750        path.pop();
9751    }
9752}
9753
9754/// These conditions describe if a FixedPrice applies at start of the transaction.
9755///
9756/// When more than one restriction is set, they are to be treated as a logical AND. All need to be valid before this price is active.
9757///
9758/// NOTE: _startTimeOfDay_ and _endTimeOfDay_ are in local time, because it is the time in the tariff as it is shown to the EV driver at the Charging Station.
9759/// A Charging Station will convert this to the internal time zone that it uses (which is recommended to be UTC, see section Generic chapter 3.1) when performing cost calculation.
9760///
9761/// The OCPP 2.1 `TariffConditionsFixed` data type.
9762#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9763pub struct TariffConditionsFixed {
9764    /// Start time of day in local time. +
9765    /// Format as per RFC 3339: time-hour ":" time-minute  +
9766    /// Must be in 24h format with leading zeros. Hour/Minute separator: ":"
9767    /// Regex: (\[0-1\]\[0-9\]\|2\[0-3\]):\[0-5\]\[0-9\]
9768    #[serde(rename = "startTimeOfDay")]
9769    #[serde(default, skip_serializing_if = "Option::is_none")]
9770    pub start_time_of_day: Option<String>,
9771    /// End time of day in local time. Same syntax as _startTimeOfDay_. +
9772    ///     If end time &lt; start time then the period wraps around to the next day. +
9773    ///     To stop at end of the day use: 00:00.
9774    #[serde(rename = "endTimeOfDay")]
9775    #[serde(default, skip_serializing_if = "Option::is_none")]
9776    pub end_time_of_day: Option<String>,
9777    /// Day(s) of the week this is tariff applies.
9778    #[serde(rename = "dayOfWeek")]
9779    #[serde(default, skip_serializing_if = "Option::is_none")]
9780    pub day_of_week: Option<Vec<DayOfWeek>>,
9781    /// Start date in local time, for example: 2015-12-24.
9782    /// Valid from this day (inclusive). +
9783    /// Format as per RFC 3339: full-date  +
9784    ///
9785    /// Regex: (\[12\]\[0-9\]{3})-(0\[1-9\]\|1\[0-2\])-(0\[1-9\]\|\[12\]\[0-9\]\|3\[01\])
9786    #[serde(rename = "validFromDate")]
9787    #[serde(default, skip_serializing_if = "Option::is_none")]
9788    pub valid_from_date: Option<String>,
9789    /// End date in local time, for example: 2015-12-27.
9790    ///     Valid until this day (exclusive). Same syntax as _validFromDate_.
9791    #[serde(rename = "validToDate")]
9792    #[serde(default, skip_serializing_if = "Option::is_none")]
9793    pub valid_to_date: Option<String>,
9794    /// The `evseKind` member.
9795    #[serde(rename = "evseKind")]
9796    #[serde(default, skip_serializing_if = "Option::is_none")]
9797    pub evse_kind: Option<EvseKind>,
9798    /// For which payment brand this (adhoc) tariff applies. Can be used to add a surcharge for certain payment brands.
9799    ///     Based on value of _additionalIdToken_ from _idToken.additionalInfo.type_ = "PaymentBrand".
9800    #[serde(rename = "paymentBrand")]
9801    #[serde(default, skip_serializing_if = "Option::is_none")]
9802    pub payment_brand: Option<String>,
9803    /// Type of adhoc payment, e.g. CC, Debit.
9804    ///     Based on value of _additionalIdToken_ from _idToken.additionalInfo.type_ = "PaymentRecognition".
9805    #[serde(rename = "paymentRecognition")]
9806    #[serde(default, skip_serializing_if = "Option::is_none")]
9807    pub payment_recognition: Option<String>,
9808    /// The `customData` member.
9809    #[serde(rename = "customData")]
9810    #[serde(default, skip_serializing_if = "Option::is_none")]
9811    pub custom_data: Option<crate::types::CustomData>,
9812}
9813
9814impl TariffConditionsFixed {
9815    /// Creates an empty `TariffConditionsFixed`. Every field of this type is optional.
9816    #[must_use]
9817    pub fn new() -> Self {
9818        Self::default()
9819    }
9820
9821    /// Sets the optional `startTimeOfDay` field.
9822    #[must_use]
9823    pub fn with_start_time_of_day(mut self, value: impl Into<String>) -> Self {
9824        self.start_time_of_day = Some(value.into());
9825        self
9826    }
9827
9828    /// Sets the optional `endTimeOfDay` field.
9829    #[must_use]
9830    pub fn with_end_time_of_day(mut self, value: impl Into<String>) -> Self {
9831        self.end_time_of_day = Some(value.into());
9832        self
9833    }
9834
9835    /// Sets the optional `dayOfWeek` field.
9836    #[must_use]
9837    pub fn with_day_of_week(mut self, value: Vec<DayOfWeek>) -> Self {
9838        self.day_of_week = Some(value);
9839        self
9840    }
9841
9842    /// Sets the optional `validFromDate` field.
9843    #[must_use]
9844    pub fn with_valid_from_date(mut self, value: impl Into<String>) -> Self {
9845        self.valid_from_date = Some(value.into());
9846        self
9847    }
9848
9849    /// Sets the optional `validToDate` field.
9850    #[must_use]
9851    pub fn with_valid_to_date(mut self, value: impl Into<String>) -> Self {
9852        self.valid_to_date = Some(value.into());
9853        self
9854    }
9855
9856    /// Sets the optional `evseKind` field.
9857    #[must_use]
9858    pub fn with_evse_kind(mut self, value: EvseKind) -> Self {
9859        self.evse_kind = Some(value);
9860        self
9861    }
9862
9863    /// Sets the optional `paymentBrand` field.
9864    #[must_use]
9865    pub fn with_payment_brand(mut self, value: impl Into<String>) -> Self {
9866        self.payment_brand = Some(value.into());
9867        self
9868    }
9869
9870    /// Sets the optional `paymentRecognition` field.
9871    #[must_use]
9872    pub fn with_payment_recognition(mut self, value: impl Into<String>) -> Self {
9873        self.payment_recognition = Some(value.into());
9874        self
9875    }
9876
9877    /// Sets the optional `customData` field.
9878    #[must_use]
9879    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9880        self.custom_data = Some(value);
9881        self
9882    }
9883}
9884
9885impl Validate for TariffConditionsFixed {
9886    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9887        path.push_key("dayOfWeek");
9888        if let Some(value) = &self.day_of_week {
9889            validate::list_len(value.len(), Some(1), Some(7), path, out);
9890            for (index, item) in value.iter().enumerate() {
9891                path.push_index(index);
9892                Validate::validate_at(item, path, out);
9893                path.pop();
9894            }
9895        }
9896        path.pop();
9897        path.push_key("evseKind");
9898        if let Some(value) = &self.evse_kind {
9899            Validate::validate_at(value, path, out);
9900        }
9901        path.pop();
9902        path.push_key("paymentBrand");
9903        if let Some(value) = &self.payment_brand {
9904            validate::string(value.as_str(), None, Some(20), path, out);
9905        }
9906        path.pop();
9907        path.push_key("paymentRecognition");
9908        if let Some(value) = &self.payment_recognition {
9909            validate::string(value.as_str(), None, Some(20), path, out);
9910        }
9911        path.pop();
9912        path.push_key("customData");
9913        if let Some(value) = &self.custom_data {
9914            Validate::validate_at(value, path, out);
9915        }
9916        path.pop();
9917    }
9918}
9919
9920/// Price elements and tax for energy
9921///
9922/// The OCPP 2.1 `TariffEnergy` data type.
9923#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9924pub struct TariffEnergy {
9925    /// The `prices` member.
9926    pub prices: Vec<TariffEnergyPrice>,
9927    /// The `taxRates` member.
9928    #[serde(rename = "taxRates")]
9929    #[serde(default, skip_serializing_if = "Option::is_none")]
9930    pub tax_rates: Option<Vec<TaxRate>>,
9931    /// The `customData` member.
9932    #[serde(rename = "customData")]
9933    #[serde(default, skip_serializing_if = "Option::is_none")]
9934    pub custom_data: Option<crate::types::CustomData>,
9935}
9936
9937impl TariffEnergy {
9938    /// Creates a `TariffEnergy` from its required fields.
9939    #[must_use]
9940    pub fn new(prices: Vec<TariffEnergyPrice>) -> Self {
9941        Self {
9942            prices,
9943            tax_rates: None,
9944            custom_data: None,
9945        }
9946    }
9947
9948    /// Sets the optional `taxRates` field.
9949    #[must_use]
9950    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
9951        self.tax_rates = Some(value);
9952        self
9953    }
9954
9955    /// Sets the optional `customData` field.
9956    #[must_use]
9957    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9958        self.custom_data = Some(value);
9959        self
9960    }
9961}
9962
9963impl Validate for TariffEnergy {
9964    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9965        path.push_key("prices");
9966        validate::list_len(self.prices.len(), Some(1), None, path, out);
9967        for (index, item) in self.prices.iter().enumerate() {
9968            path.push_index(index);
9969            Validate::validate_at(item, path, out);
9970            path.pop();
9971        }
9972        path.pop();
9973        path.push_key("taxRates");
9974        if let Some(value) = &self.tax_rates {
9975            validate::list_len(value.len(), Some(1), Some(5), path, out);
9976            for (index, item) in value.iter().enumerate() {
9977                path.push_index(index);
9978                Validate::validate_at(item, path, out);
9979                path.pop();
9980            }
9981        }
9982        path.pop();
9983        path.push_key("customData");
9984        if let Some(value) = &self.custom_data {
9985            Validate::validate_at(value, path, out);
9986        }
9987        path.pop();
9988    }
9989}
9990
9991/// Tariff with optional conditions for an energy price.
9992///
9993/// The OCPP 2.1 `TariffEnergyPrice` data type.
9994#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9995pub struct TariffEnergyPrice {
9996    /// Price per kWh (excl. tax) for this element.
9997    #[serde(rename = "priceKwh")]
9998    pub price_kwh: crate::types::Decimal,
9999    /// The `conditions` member.
10000    #[serde(default, skip_serializing_if = "Option::is_none")]
10001    pub conditions: Option<TariffConditions>,
10002    /// The `customData` member.
10003    #[serde(rename = "customData")]
10004    #[serde(default, skip_serializing_if = "Option::is_none")]
10005    pub custom_data: Option<crate::types::CustomData>,
10006}
10007
10008impl TariffEnergyPrice {
10009    /// Creates a `TariffEnergyPrice` from its required fields.
10010    #[must_use]
10011    pub fn new(price_kwh: impl Into<crate::types::Decimal>) -> Self {
10012        Self {
10013            price_kwh: price_kwh.into(),
10014            conditions: None,
10015            custom_data: None,
10016        }
10017    }
10018
10019    /// Sets the optional `conditions` field.
10020    #[must_use]
10021    pub fn with_conditions(mut self, value: TariffConditions) -> Self {
10022        self.conditions = Some(value);
10023        self
10024    }
10025
10026    /// Sets the optional `customData` field.
10027    #[must_use]
10028    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10029        self.custom_data = Some(value);
10030        self
10031    }
10032}
10033
10034impl Validate for TariffEnergyPrice {
10035    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10036        path.push_key("conditions");
10037        if let Some(value) = &self.conditions {
10038            Validate::validate_at(value, path, out);
10039        }
10040        path.pop();
10041        path.push_key("customData");
10042        if let Some(value) = &self.custom_data {
10043            Validate::validate_at(value, path, out);
10044        }
10045        path.pop();
10046    }
10047}
10048
10049/// The OCPP 2.1 `TariffFixed` data type.
10050#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10051pub struct TariffFixed {
10052    /// The `prices` member.
10053    pub prices: Vec<TariffFixedPrice>,
10054    /// The `taxRates` member.
10055    #[serde(rename = "taxRates")]
10056    #[serde(default, skip_serializing_if = "Option::is_none")]
10057    pub tax_rates: Option<Vec<TaxRate>>,
10058    /// The `customData` member.
10059    #[serde(rename = "customData")]
10060    #[serde(default, skip_serializing_if = "Option::is_none")]
10061    pub custom_data: Option<crate::types::CustomData>,
10062}
10063
10064impl TariffFixed {
10065    /// Creates a `TariffFixed` from its required fields.
10066    #[must_use]
10067    pub fn new(prices: Vec<TariffFixedPrice>) -> Self {
10068        Self {
10069            prices,
10070            tax_rates: None,
10071            custom_data: None,
10072        }
10073    }
10074
10075    /// Sets the optional `taxRates` field.
10076    #[must_use]
10077    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
10078        self.tax_rates = Some(value);
10079        self
10080    }
10081
10082    /// Sets the optional `customData` field.
10083    #[must_use]
10084    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10085        self.custom_data = Some(value);
10086        self
10087    }
10088}
10089
10090impl Validate for TariffFixed {
10091    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10092        path.push_key("prices");
10093        validate::list_len(self.prices.len(), Some(1), None, path, out);
10094        for (index, item) in self.prices.iter().enumerate() {
10095            path.push_index(index);
10096            Validate::validate_at(item, path, out);
10097            path.pop();
10098        }
10099        path.pop();
10100        path.push_key("taxRates");
10101        if let Some(value) = &self.tax_rates {
10102            validate::list_len(value.len(), Some(1), Some(5), path, out);
10103            for (index, item) in value.iter().enumerate() {
10104                path.push_index(index);
10105                Validate::validate_at(item, path, out);
10106                path.pop();
10107            }
10108        }
10109        path.pop();
10110        path.push_key("customData");
10111        if let Some(value) = &self.custom_data {
10112            Validate::validate_at(value, path, out);
10113        }
10114        path.pop();
10115    }
10116}
10117
10118/// Tariff with optional conditions for a fixed price.
10119///
10120/// The OCPP 2.1 `TariffFixedPrice` data type.
10121#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10122pub struct TariffFixedPrice {
10123    /// Fixed price  for this element e.g. a start fee.
10124    #[serde(rename = "priceFixed")]
10125    pub price_fixed: crate::types::Decimal,
10126    /// The `conditions` member.
10127    #[serde(default, skip_serializing_if = "Option::is_none")]
10128    pub conditions: Option<TariffConditionsFixed>,
10129    /// The `customData` member.
10130    #[serde(rename = "customData")]
10131    #[serde(default, skip_serializing_if = "Option::is_none")]
10132    pub custom_data: Option<crate::types::CustomData>,
10133}
10134
10135impl TariffFixedPrice {
10136    /// Creates a `TariffFixedPrice` from its required fields.
10137    #[must_use]
10138    pub fn new(price_fixed: impl Into<crate::types::Decimal>) -> Self {
10139        Self {
10140            price_fixed: price_fixed.into(),
10141            conditions: None,
10142            custom_data: None,
10143        }
10144    }
10145
10146    /// Sets the optional `conditions` field.
10147    #[must_use]
10148    pub fn with_conditions(mut self, value: TariffConditionsFixed) -> Self {
10149        self.conditions = Some(value);
10150        self
10151    }
10152
10153    /// Sets the optional `customData` field.
10154    #[must_use]
10155    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10156        self.custom_data = Some(value);
10157        self
10158    }
10159}
10160
10161impl Validate for TariffFixedPrice {
10162    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10163        path.push_key("conditions");
10164        if let Some(value) = &self.conditions {
10165            Validate::validate_at(value, path, out);
10166        }
10167        path.pop();
10168        path.push_key("customData");
10169        if let Some(value) = &self.custom_data {
10170            Validate::validate_at(value, path, out);
10171        }
10172        path.pop();
10173    }
10174}
10175
10176/// Price elements and tax for time
10177///
10178/// The OCPP 2.1 `TariffTime` data type.
10179#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10180pub struct TariffTime {
10181    /// The `prices` member.
10182    pub prices: Vec<TariffTimePrice>,
10183    /// The `taxRates` member.
10184    #[serde(rename = "taxRates")]
10185    #[serde(default, skip_serializing_if = "Option::is_none")]
10186    pub tax_rates: Option<Vec<TaxRate>>,
10187    /// The `customData` member.
10188    #[serde(rename = "customData")]
10189    #[serde(default, skip_serializing_if = "Option::is_none")]
10190    pub custom_data: Option<crate::types::CustomData>,
10191}
10192
10193impl TariffTime {
10194    /// Creates a `TariffTime` from its required fields.
10195    #[must_use]
10196    pub fn new(prices: Vec<TariffTimePrice>) -> Self {
10197        Self {
10198            prices,
10199            tax_rates: None,
10200            custom_data: None,
10201        }
10202    }
10203
10204    /// Sets the optional `taxRates` field.
10205    #[must_use]
10206    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
10207        self.tax_rates = Some(value);
10208        self
10209    }
10210
10211    /// Sets the optional `customData` field.
10212    #[must_use]
10213    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10214        self.custom_data = Some(value);
10215        self
10216    }
10217}
10218
10219impl Validate for TariffTime {
10220    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10221        path.push_key("prices");
10222        validate::list_len(self.prices.len(), Some(1), None, path, out);
10223        for (index, item) in self.prices.iter().enumerate() {
10224            path.push_index(index);
10225            Validate::validate_at(item, path, out);
10226            path.pop();
10227        }
10228        path.pop();
10229        path.push_key("taxRates");
10230        if let Some(value) = &self.tax_rates {
10231            validate::list_len(value.len(), Some(1), Some(5), path, out);
10232            for (index, item) in value.iter().enumerate() {
10233                path.push_index(index);
10234                Validate::validate_at(item, path, out);
10235                path.pop();
10236            }
10237        }
10238        path.pop();
10239        path.push_key("customData");
10240        if let Some(value) = &self.custom_data {
10241            Validate::validate_at(value, path, out);
10242        }
10243        path.pop();
10244    }
10245}
10246
10247/// Tariff with optional conditions for a time duration price.
10248///
10249/// The OCPP 2.1 `TariffTimePrice` data type.
10250#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10251pub struct TariffTimePrice {
10252    /// Price per minute (excl. tax) for this element.
10253    #[serde(rename = "priceMinute")]
10254    pub price_minute: crate::types::Decimal,
10255    /// The `conditions` member.
10256    #[serde(default, skip_serializing_if = "Option::is_none")]
10257    pub conditions: Option<TariffConditions>,
10258    /// The `customData` member.
10259    #[serde(rename = "customData")]
10260    #[serde(default, skip_serializing_if = "Option::is_none")]
10261    pub custom_data: Option<crate::types::CustomData>,
10262}
10263
10264impl TariffTimePrice {
10265    /// Creates a `TariffTimePrice` from its required fields.
10266    #[must_use]
10267    pub fn new(price_minute: impl Into<crate::types::Decimal>) -> Self {
10268        Self {
10269            price_minute: price_minute.into(),
10270            conditions: None,
10271            custom_data: None,
10272        }
10273    }
10274
10275    /// Sets the optional `conditions` field.
10276    #[must_use]
10277    pub fn with_conditions(mut self, value: TariffConditions) -> Self {
10278        self.conditions = Some(value);
10279        self
10280    }
10281
10282    /// Sets the optional `customData` field.
10283    #[must_use]
10284    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10285        self.custom_data = Some(value);
10286        self
10287    }
10288}
10289
10290impl Validate for TariffTimePrice {
10291    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10292        path.push_key("conditions");
10293        if let Some(value) = &self.conditions {
10294            Validate::validate_at(value, path, out);
10295        }
10296        path.pop();
10297        path.push_key("customData");
10298        if let Some(value) = &self.custom_data {
10299            Validate::validate_at(value, path, out);
10300        }
10301        path.pop();
10302    }
10303}
10304
10305/// Tax percentage
10306///
10307/// The OCPP 2.1 `TaxRate` data type.
10308#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10309pub struct TaxRate {
10310    /// Type of this tax, e.g.  "Federal ",  "State", for information on receipt.
10311    pub r#type: String,
10312    /// Tax percentage
10313    pub tax: crate::types::Decimal,
10314    /// Stack level for this type of tax. Default value, when absent, is 0. +
10315    /// _stack_ = 0: tax on net price; +
10316    /// _stack_ = 1: tax added on top of _stack_ 0; +
10317    /// _stack_ = 2: tax added on top of _stack_ 1, etc.
10318    #[serde(default, skip_serializing_if = "Option::is_none")]
10319    pub stack: Option<i32>,
10320    /// The `customData` member.
10321    #[serde(rename = "customData")]
10322    #[serde(default, skip_serializing_if = "Option::is_none")]
10323    pub custom_data: Option<crate::types::CustomData>,
10324}
10325
10326impl TaxRate {
10327    /// Creates a `TaxRate` from its required fields.
10328    #[must_use]
10329    pub fn new(r#type: impl Into<String>, tax: impl Into<crate::types::Decimal>) -> Self {
10330        Self {
10331            r#type: r#type.into(),
10332            tax: tax.into(),
10333            stack: None,
10334            custom_data: None,
10335        }
10336    }
10337
10338    /// Sets the optional `stack` field.
10339    #[must_use]
10340    pub fn with_stack(mut self, value: i32) -> Self {
10341        self.stack = Some(value);
10342        self
10343    }
10344
10345    /// Sets the optional `customData` field.
10346    #[must_use]
10347    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10348        self.custom_data = Some(value);
10349        self
10350    }
10351}
10352
10353impl Validate for TaxRate {
10354    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10355        path.push_key("type");
10356        validate::string(self.r#type.as_str(), None, Some(20), path, out);
10357        path.pop();
10358        path.push_key("stack");
10359        if let Some(value) = &self.stack {
10360            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
10361        }
10362        path.pop();
10363        path.push_key("customData");
10364        if let Some(value) = &self.custom_data {
10365            Validate::validate_at(value, path, out);
10366        }
10367        path.pop();
10368    }
10369}
10370
10371/// Part of ISO 15118-20 price schedule.
10372///
10373/// The OCPP 2.1 `TaxRule` data type.
10374#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10375pub struct TaxRule {
10376    /// Id for the tax rule.
10377    #[serde(rename = "taxRuleID")]
10378    pub tax_rule_id: i32,
10379    /// Indicates whether this tax applies to Energy Fees.
10380    #[serde(rename = "appliesToEnergyFee")]
10381    pub applies_to_energy_fee: bool,
10382    /// Indicates whether this tax applies to Parking Fees.
10383    #[serde(rename = "appliesToParkingFee")]
10384    pub applies_to_parking_fee: bool,
10385    /// Indicates whether this tax applies to Overstay Fees.
10386    #[serde(rename = "appliesToOverstayFee")]
10387    pub applies_to_overstay_fee: bool,
10388    /// Indicates whether this tax applies to Minimum/Maximum Cost.
10389    #[serde(rename = "appliesToMinimumMaximumCost")]
10390    pub applies_to_minimum_maximum_cost: bool,
10391    /// The `taxRate` member.
10392    #[serde(rename = "taxRate")]
10393    pub tax_rate: RationalNumber,
10394    /// Human readable string to identify the tax rule.
10395    #[serde(rename = "taxRuleName")]
10396    #[serde(default, skip_serializing_if = "Option::is_none")]
10397    pub tax_rule_name: Option<String>,
10398    /// Indicates whether the tax is included in any price or not.
10399    #[serde(rename = "taxIncludedInPrice")]
10400    #[serde(default, skip_serializing_if = "Option::is_none")]
10401    pub tax_included_in_price: Option<bool>,
10402    /// The `customData` member.
10403    #[serde(rename = "customData")]
10404    #[serde(default, skip_serializing_if = "Option::is_none")]
10405    pub custom_data: Option<crate::types::CustomData>,
10406}
10407
10408impl TaxRule {
10409    /// Creates a `TaxRule` from its required fields.
10410    #[must_use]
10411    pub fn new(
10412        tax_rule_id: i32,
10413        applies_to_energy_fee: bool,
10414        applies_to_parking_fee: bool,
10415        applies_to_overstay_fee: bool,
10416        applies_to_minimum_maximum_cost: bool,
10417        tax_rate: RationalNumber,
10418    ) -> Self {
10419        Self {
10420            tax_rule_id,
10421            applies_to_energy_fee,
10422            applies_to_parking_fee,
10423            applies_to_overstay_fee,
10424            applies_to_minimum_maximum_cost,
10425            tax_rate,
10426            tax_rule_name: None,
10427            tax_included_in_price: None,
10428            custom_data: None,
10429        }
10430    }
10431
10432    /// Sets the optional `taxRuleName` field.
10433    #[must_use]
10434    pub fn with_tax_rule_name(mut self, value: impl Into<String>) -> Self {
10435        self.tax_rule_name = Some(value.into());
10436        self
10437    }
10438
10439    /// Sets the optional `taxIncludedInPrice` field.
10440    #[must_use]
10441    pub fn with_tax_included_in_price(mut self, value: bool) -> Self {
10442        self.tax_included_in_price = Some(value);
10443        self
10444    }
10445
10446    /// Sets the optional `customData` field.
10447    #[must_use]
10448    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10449        self.custom_data = Some(value);
10450        self
10451    }
10452}
10453
10454impl Validate for TaxRule {
10455    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10456        path.push_key("taxRuleID");
10457        validate::int_range(i64::from(self.tax_rule_id), Some(0.0), None, path, out);
10458        path.pop();
10459        path.push_key("taxRate");
10460        Validate::validate_at(&self.tax_rate, path, out);
10461        path.pop();
10462        path.push_key("taxRuleName");
10463        if let Some(value) = &self.tax_rule_name {
10464            validate::string(value.as_str(), None, Some(100), path, out);
10465        }
10466        path.pop();
10467        path.push_key("customData");
10468        if let Some(value) = &self.custom_data {
10469            Validate::validate_at(value, path, out);
10470        }
10471        path.pop();
10472    }
10473}
10474
10475/// This contains the cost calculated during a transaction. It is used both for running cost and final cost of the transaction.
10476///
10477/// The OCPP 2.1 `TotalCost` data type.
10478#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10479pub struct TotalCost {
10480    /// Currency of the costs in ISO 4217 Code.
10481    pub currency: String,
10482    /// The `typeOfCost` member.
10483    #[serde(rename = "typeOfCost")]
10484    pub type_of_cost: TariffCost,
10485    /// The `total` member.
10486    pub total: TotalPrice,
10487    /// The `fixed` member.
10488    #[serde(default, skip_serializing_if = "Option::is_none")]
10489    pub fixed: Option<Price>,
10490    /// The `energy` member.
10491    #[serde(default, skip_serializing_if = "Option::is_none")]
10492    pub energy: Option<Price>,
10493    /// The `chargingTime` member.
10494    #[serde(rename = "chargingTime")]
10495    #[serde(default, skip_serializing_if = "Option::is_none")]
10496    pub charging_time: Option<Price>,
10497    /// The `idleTime` member.
10498    #[serde(rename = "idleTime")]
10499    #[serde(default, skip_serializing_if = "Option::is_none")]
10500    pub idle_time: Option<Price>,
10501    /// The `reservationTime` member.
10502    #[serde(rename = "reservationTime")]
10503    #[serde(default, skip_serializing_if = "Option::is_none")]
10504    pub reservation_time: Option<Price>,
10505    /// The `reservationFixed` member.
10506    #[serde(rename = "reservationFixed")]
10507    #[serde(default, skip_serializing_if = "Option::is_none")]
10508    pub reservation_fixed: Option<Price>,
10509    /// The `customData` member.
10510    #[serde(rename = "customData")]
10511    #[serde(default, skip_serializing_if = "Option::is_none")]
10512    pub custom_data: Option<crate::types::CustomData>,
10513}
10514
10515impl TotalCost {
10516    /// Creates a `TotalCost` from its required fields.
10517    #[must_use]
10518    pub fn new(currency: impl Into<String>, type_of_cost: TariffCost, total: TotalPrice) -> Self {
10519        Self {
10520            currency: currency.into(),
10521            type_of_cost,
10522            total,
10523            fixed: None,
10524            energy: None,
10525            charging_time: None,
10526            idle_time: None,
10527            reservation_time: None,
10528            reservation_fixed: None,
10529            custom_data: None,
10530        }
10531    }
10532
10533    /// Sets the optional `fixed` field.
10534    #[must_use]
10535    pub fn with_fixed(mut self, value: Price) -> Self {
10536        self.fixed = Some(value);
10537        self
10538    }
10539
10540    /// Sets the optional `energy` field.
10541    #[must_use]
10542    pub fn with_energy(mut self, value: Price) -> Self {
10543        self.energy = Some(value);
10544        self
10545    }
10546
10547    /// Sets the optional `chargingTime` field.
10548    #[must_use]
10549    pub fn with_charging_time(mut self, value: Price) -> Self {
10550        self.charging_time = Some(value);
10551        self
10552    }
10553
10554    /// Sets the optional `idleTime` field.
10555    #[must_use]
10556    pub fn with_idle_time(mut self, value: Price) -> Self {
10557        self.idle_time = Some(value);
10558        self
10559    }
10560
10561    /// Sets the optional `reservationTime` field.
10562    #[must_use]
10563    pub fn with_reservation_time(mut self, value: Price) -> Self {
10564        self.reservation_time = Some(value);
10565        self
10566    }
10567
10568    /// Sets the optional `reservationFixed` field.
10569    #[must_use]
10570    pub fn with_reservation_fixed(mut self, value: Price) -> Self {
10571        self.reservation_fixed = Some(value);
10572        self
10573    }
10574
10575    /// Sets the optional `customData` field.
10576    #[must_use]
10577    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10578        self.custom_data = Some(value);
10579        self
10580    }
10581}
10582
10583impl Validate for TotalCost {
10584    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10585        path.push_key("currency");
10586        validate::string(self.currency.as_str(), None, Some(3), path, out);
10587        path.pop();
10588        path.push_key("typeOfCost");
10589        Validate::validate_at(&self.type_of_cost, path, out);
10590        path.pop();
10591        path.push_key("total");
10592        Validate::validate_at(&self.total, path, out);
10593        path.pop();
10594        path.push_key("fixed");
10595        if let Some(value) = &self.fixed {
10596            Validate::validate_at(value, path, out);
10597        }
10598        path.pop();
10599        path.push_key("energy");
10600        if let Some(value) = &self.energy {
10601            Validate::validate_at(value, path, out);
10602        }
10603        path.pop();
10604        path.push_key("chargingTime");
10605        if let Some(value) = &self.charging_time {
10606            Validate::validate_at(value, path, out);
10607        }
10608        path.pop();
10609        path.push_key("idleTime");
10610        if let Some(value) = &self.idle_time {
10611            Validate::validate_at(value, path, out);
10612        }
10613        path.pop();
10614        path.push_key("reservationTime");
10615        if let Some(value) = &self.reservation_time {
10616            Validate::validate_at(value, path, out);
10617        }
10618        path.pop();
10619        path.push_key("reservationFixed");
10620        if let Some(value) = &self.reservation_fixed {
10621            Validate::validate_at(value, path, out);
10622        }
10623        path.pop();
10624        path.push_key("customData");
10625        if let Some(value) = &self.custom_data {
10626            Validate::validate_at(value, path, out);
10627        }
10628        path.pop();
10629    }
10630}
10631
10632/// Total cost with and without tax. Contains the total of energy, charging time, idle time, fixed and reservation costs including and/or excluding tax.
10633///
10634/// The OCPP 2.1 `TotalPrice` data type.
10635#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
10636pub struct TotalPrice {
10637    /// Price/cost excluding tax. Can be absent if _inclTax_ is present.
10638    #[serde(rename = "exclTax")]
10639    #[serde(default, skip_serializing_if = "Option::is_none")]
10640    pub excl_tax: Option<crate::types::Decimal>,
10641    /// Price/cost including tax. Can be absent if _exclTax_ is present.
10642    #[serde(rename = "inclTax")]
10643    #[serde(default, skip_serializing_if = "Option::is_none")]
10644    pub incl_tax: Option<crate::types::Decimal>,
10645    /// The `customData` member.
10646    #[serde(rename = "customData")]
10647    #[serde(default, skip_serializing_if = "Option::is_none")]
10648    pub custom_data: Option<crate::types::CustomData>,
10649}
10650
10651impl TotalPrice {
10652    /// Creates an empty `TotalPrice`. Every field of this type is optional.
10653    #[must_use]
10654    pub fn new() -> Self {
10655        Self::default()
10656    }
10657
10658    /// Sets the optional `exclTax` field.
10659    #[must_use]
10660    pub fn with_excl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10661        self.excl_tax = Some(value.into());
10662        self
10663    }
10664
10665    /// Sets the optional `inclTax` field.
10666    #[must_use]
10667    pub fn with_incl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10668        self.incl_tax = Some(value.into());
10669        self
10670    }
10671
10672    /// Sets the optional `customData` field.
10673    #[must_use]
10674    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10675        self.custom_data = Some(value);
10676        self
10677    }
10678}
10679
10680impl Validate for TotalPrice {
10681    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10682        path.push_key("customData");
10683        if let Some(value) = &self.custom_data {
10684            Validate::validate_at(value, path, out);
10685        }
10686        path.pop();
10687    }
10688}
10689
10690/// This contains the calculated usage of energy, charging time and idle time during a transaction.
10691///
10692/// The OCPP 2.1 `TotalUsage` data type.
10693#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10694pub struct TotalUsage {
10695    /// The `energy` member.
10696    pub energy: crate::types::Decimal,
10697    /// Total duration of the charging session (including the duration of charging and not charging), in seconds.
10698    #[serde(rename = "chargingTime")]
10699    pub charging_time: i32,
10700    /// Total duration of the charging session where the EV was not charging (no energy was transferred between EVSE and EV), in seconds.
10701    #[serde(rename = "idleTime")]
10702    pub idle_time: i32,
10703    /// Total time of reservation in seconds.
10704    #[serde(rename = "reservationTime")]
10705    #[serde(default, skip_serializing_if = "Option::is_none")]
10706    pub reservation_time: Option<i32>,
10707    /// The `customData` member.
10708    #[serde(rename = "customData")]
10709    #[serde(default, skip_serializing_if = "Option::is_none")]
10710    pub custom_data: Option<crate::types::CustomData>,
10711}
10712
10713impl TotalUsage {
10714    /// Creates a `TotalUsage` from its required fields.
10715    #[must_use]
10716    pub fn new(
10717        energy: impl Into<crate::types::Decimal>,
10718        charging_time: i32,
10719        idle_time: i32,
10720    ) -> Self {
10721        Self {
10722            energy: energy.into(),
10723            charging_time,
10724            idle_time,
10725            reservation_time: None,
10726            custom_data: None,
10727        }
10728    }
10729
10730    /// Sets the optional `reservationTime` field.
10731    #[must_use]
10732    pub fn with_reservation_time(mut self, value: i32) -> Self {
10733        self.reservation_time = Some(value);
10734        self
10735    }
10736
10737    /// Sets the optional `customData` field.
10738    #[must_use]
10739    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10740        self.custom_data = Some(value);
10741        self
10742    }
10743}
10744
10745impl Validate for TotalUsage {
10746    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10747        path.push_key("customData");
10748        if let Some(value) = &self.custom_data {
10749            Validate::validate_at(value, path, out);
10750        }
10751        path.pop();
10752    }
10753}
10754
10755/// The OCPP 2.1 `Transaction` data type.
10756#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10757pub struct Transaction {
10758    /// This contains the Id of the transaction.
10759    #[serde(rename = "transactionId")]
10760    pub transaction_id: String,
10761    /// The `chargingState` member.
10762    #[serde(rename = "chargingState")]
10763    #[serde(default, skip_serializing_if = "Option::is_none")]
10764    pub charging_state: Option<ChargingState>,
10765    /// 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.
10766    #[serde(rename = "timeSpentCharging")]
10767    #[serde(default, skip_serializing_if = "Option::is_none")]
10768    pub time_spent_charging: Option<i32>,
10769    /// The `stoppedReason` member.
10770    #[serde(rename = "stoppedReason")]
10771    #[serde(default, skip_serializing_if = "Option::is_none")]
10772    pub stopped_reason: Option<Reason>,
10773    /// 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.
10774    #[serde(rename = "remoteStartId")]
10775    #[serde(default, skip_serializing_if = "Option::is_none")]
10776    pub remote_start_id: Option<i32>,
10777    /// The `operationMode` member.
10778    #[serde(rename = "operationMode")]
10779    #[serde(default, skip_serializing_if = "Option::is_none")]
10780    pub operation_mode: Option<OperationMode>,
10781    /// *(2.1)* Id of tariff in use for transaction
10782    #[serde(rename = "tariffId")]
10783    #[serde(default, skip_serializing_if = "Option::is_none")]
10784    pub tariff_id: Option<String>,
10785    /// The `transactionLimit` member.
10786    #[serde(rename = "transactionLimit")]
10787    #[serde(default, skip_serializing_if = "Option::is_none")]
10788    pub transaction_limit: Option<TransactionLimit>,
10789    /// The `customData` member.
10790    #[serde(rename = "customData")]
10791    #[serde(default, skip_serializing_if = "Option::is_none")]
10792    pub custom_data: Option<crate::types::CustomData>,
10793}
10794
10795impl Transaction {
10796    /// Creates a `Transaction` from its required fields.
10797    #[must_use]
10798    pub fn new(transaction_id: impl Into<String>) -> Self {
10799        Self {
10800            transaction_id: transaction_id.into(),
10801            charging_state: None,
10802            time_spent_charging: None,
10803            stopped_reason: None,
10804            remote_start_id: None,
10805            operation_mode: None,
10806            tariff_id: None,
10807            transaction_limit: None,
10808            custom_data: None,
10809        }
10810    }
10811
10812    /// Sets the optional `chargingState` field.
10813    #[must_use]
10814    pub fn with_charging_state(mut self, value: ChargingState) -> Self {
10815        self.charging_state = Some(value);
10816        self
10817    }
10818
10819    /// Sets the optional `timeSpentCharging` field.
10820    #[must_use]
10821    pub fn with_time_spent_charging(mut self, value: i32) -> Self {
10822        self.time_spent_charging = Some(value);
10823        self
10824    }
10825
10826    /// Sets the optional `stoppedReason` field.
10827    #[must_use]
10828    pub fn with_stopped_reason(mut self, value: Reason) -> Self {
10829        self.stopped_reason = Some(value);
10830        self
10831    }
10832
10833    /// Sets the optional `remoteStartId` field.
10834    #[must_use]
10835    pub fn with_remote_start_id(mut self, value: i32) -> Self {
10836        self.remote_start_id = Some(value);
10837        self
10838    }
10839
10840    /// Sets the optional `operationMode` field.
10841    #[must_use]
10842    pub fn with_operation_mode(mut self, value: OperationMode) -> Self {
10843        self.operation_mode = Some(value);
10844        self
10845    }
10846
10847    /// Sets the optional `tariffId` field.
10848    #[must_use]
10849    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
10850        self.tariff_id = Some(value.into());
10851        self
10852    }
10853
10854    /// Sets the optional `transactionLimit` field.
10855    #[must_use]
10856    pub fn with_transaction_limit(mut self, value: TransactionLimit) -> Self {
10857        self.transaction_limit = Some(value);
10858        self
10859    }
10860
10861    /// Sets the optional `customData` field.
10862    #[must_use]
10863    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10864        self.custom_data = Some(value);
10865        self
10866    }
10867}
10868
10869impl Validate for Transaction {
10870    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10871        path.push_key("transactionId");
10872        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
10873        path.pop();
10874        path.push_key("chargingState");
10875        if let Some(value) = &self.charging_state {
10876            Validate::validate_at(value, path, out);
10877        }
10878        path.pop();
10879        path.push_key("stoppedReason");
10880        if let Some(value) = &self.stopped_reason {
10881            Validate::validate_at(value, path, out);
10882        }
10883        path.pop();
10884        path.push_key("operationMode");
10885        if let Some(value) = &self.operation_mode {
10886            Validate::validate_at(value, path, out);
10887        }
10888        path.pop();
10889        path.push_key("tariffId");
10890        if let Some(value) = &self.tariff_id {
10891            validate::string(value.as_str(), None, Some(60), path, out);
10892        }
10893        path.pop();
10894        path.push_key("transactionLimit");
10895        if let Some(value) = &self.transaction_limit {
10896            Validate::validate_at(value, path, out);
10897        }
10898        path.pop();
10899        path.push_key("customData");
10900        if let Some(value) = &self.custom_data {
10901            Validate::validate_at(value, path, out);
10902        }
10903        path.pop();
10904    }
10905}
10906
10907/// Cost, energy, time or SoC limit for a transaction.
10908///
10909/// The OCPP 2.1 `TransactionLimit` data type.
10910#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
10911pub struct TransactionLimit {
10912    /// Maximum allowed cost of transaction in currency of tariff.
10913    #[serde(rename = "maxCost")]
10914    #[serde(default, skip_serializing_if = "Option::is_none")]
10915    pub max_cost: Option<crate::types::Decimal>,
10916    /// Maximum allowed energy in Wh to charge in transaction.
10917    #[serde(rename = "maxEnergy")]
10918    #[serde(default, skip_serializing_if = "Option::is_none")]
10919    pub max_energy: Option<crate::types::Decimal>,
10920    /// Maximum duration of transaction in seconds from start to end.
10921    #[serde(rename = "maxTime")]
10922    #[serde(default, skip_serializing_if = "Option::is_none")]
10923    pub max_time: Option<i32>,
10924    /// Maximum State of Charge of EV in percentage.
10925    #[serde(rename = "maxSoC")]
10926    #[serde(default, skip_serializing_if = "Option::is_none")]
10927    pub max_so_c: Option<i32>,
10928    /// The `customData` member.
10929    #[serde(rename = "customData")]
10930    #[serde(default, skip_serializing_if = "Option::is_none")]
10931    pub custom_data: Option<crate::types::CustomData>,
10932}
10933
10934impl TransactionLimit {
10935    /// Creates an empty `TransactionLimit`. Every field of this type is optional.
10936    #[must_use]
10937    pub fn new() -> Self {
10938        Self::default()
10939    }
10940
10941    /// Sets the optional `maxCost` field.
10942    #[must_use]
10943    pub fn with_max_cost(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10944        self.max_cost = Some(value.into());
10945        self
10946    }
10947
10948    /// Sets the optional `maxEnergy` field.
10949    #[must_use]
10950    pub fn with_max_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10951        self.max_energy = Some(value.into());
10952        self
10953    }
10954
10955    /// Sets the optional `maxTime` field.
10956    #[must_use]
10957    pub fn with_max_time(mut self, value: i32) -> Self {
10958        self.max_time = Some(value);
10959        self
10960    }
10961
10962    /// Sets the optional `maxSoC` field.
10963    #[must_use]
10964    pub fn with_max_so_c(mut self, value: i32) -> Self {
10965        self.max_so_c = Some(value);
10966        self
10967    }
10968
10969    /// Sets the optional `customData` field.
10970    #[must_use]
10971    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10972        self.custom_data = Some(value);
10973        self
10974    }
10975}
10976
10977impl Validate for TransactionLimit {
10978    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10979        path.push_key("maxSoC");
10980        if let Some(value) = &self.max_so_c {
10981            validate::int_range(i64::from(*value), Some(0.0), Some(100.0), path, out);
10982        }
10983        path.pop();
10984        path.push_key("customData");
10985        if let Some(value) = &self.custom_data {
10986            Validate::validate_at(value, path, out);
10987        }
10988        path.pop();
10989    }
10990}
10991
10992/// Represents a UnitOfMeasure with a multiplier
10993///
10994/// The OCPP 2.1 `UnitOfMeasure` data type.
10995#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
10996pub struct UnitOfMeasure {
10997    /// Unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type.
10998    /// This field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
10999    /// If an applicable unit is available in that list, otherwise a "custom" unit might be used.
11000    /// Schema default: `"Wh"`.
11001    #[serde(default, skip_serializing_if = "Option::is_none")]
11002    pub unit: Option<String>,
11003    /// Multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10 raised to the 3rd power. Default is 0. +
11004    /// The _multiplier_ only multiplies the value of the measurand. It does not specify a conversion between units, for example, kW and W.
11005    /// Schema default: `0`.
11006    #[serde(default, skip_serializing_if = "Option::is_none")]
11007    pub multiplier: Option<i32>,
11008    /// The `customData` member.
11009    #[serde(rename = "customData")]
11010    #[serde(default, skip_serializing_if = "Option::is_none")]
11011    pub custom_data: Option<crate::types::CustomData>,
11012}
11013
11014impl UnitOfMeasure {
11015    /// Creates an empty `UnitOfMeasure`. Every field of this type is optional.
11016    #[must_use]
11017    pub fn new() -> Self {
11018        Self::default()
11019    }
11020
11021    /// Sets the optional `unit` field.
11022    #[must_use]
11023    pub fn with_unit(mut self, value: impl Into<String>) -> Self {
11024        self.unit = Some(value.into());
11025        self
11026    }
11027
11028    /// Sets the optional `multiplier` field.
11029    #[must_use]
11030    pub fn with_multiplier(mut self, value: i32) -> Self {
11031        self.multiplier = Some(value);
11032        self
11033    }
11034
11035    /// Sets the optional `customData` field.
11036    #[must_use]
11037    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11038        self.custom_data = Some(value);
11039        self
11040    }
11041}
11042
11043impl Validate for UnitOfMeasure {
11044    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11045        path.push_key("unit");
11046        if let Some(value) = &self.unit {
11047            validate::string(value.as_str(), None, Some(20), path, out);
11048        }
11049        path.pop();
11050        path.push_key("customData");
11051        if let Some(value) = &self.custom_data {
11052            Validate::validate_at(value, path, out);
11053        }
11054        path.pop();
11055    }
11056}
11057
11058/// Charging parameters for ISO 15118-20, also supporting V2X charging/discharging.+
11059/// All values are greater or equal to zero, with the exception of EVMinEnergyRequest, EVMaxEnergyRequest, EVTargetEnergyRequest, EVMinV2XEnergyRequest and EVMaxV2XEnergyRequest.
11060///
11061/// The OCPP 2.1 `V2XChargingParameters` data type.
11062#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11063pub struct V2XChargingParameters {
11064    /// Minimum charge power in W, defined by max(EV, EVSE).
11065    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11066    /// Relates to:
11067    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower
11068    #[serde(rename = "minChargePower")]
11069    #[serde(default, skip_serializing_if = "Option::is_none")]
11070    pub min_charge_power: Option<crate::types::Decimal>,
11071    /// Minimum charge power on phase L2 in W, defined by max(EV, EVSE).
11072    /// Relates to:
11073    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower_L2
11074    #[serde(rename = "minChargePower_L2")]
11075    #[serde(default, skip_serializing_if = "Option::is_none")]
11076    pub min_charge_power_l2: Option<crate::types::Decimal>,
11077    /// Minimum charge power on phase L3 in W, defined by max(EV, EVSE).
11078    /// Relates to:
11079    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower_L3
11080    #[serde(rename = "minChargePower_L3")]
11081    #[serde(default, skip_serializing_if = "Option::is_none")]
11082    pub min_charge_power_l3: Option<crate::types::Decimal>,
11083    /// Maximum charge (absorbed) power in W, defined by min(EV, EVSE) at unity power factor. +
11084    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11085    /// It corresponds to the ChaWMax attribute in the IEC 61850.
11086    /// It is usually equivalent to the rated apparent power of the EV when discharging (ChaVAMax) in IEC 61850. +
11087    ///
11088    /// Relates to:
11089    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower
11090    #[serde(rename = "maxChargePower")]
11091    #[serde(default, skip_serializing_if = "Option::is_none")]
11092    pub max_charge_power: Option<crate::types::Decimal>,
11093    /// Maximum charge power on phase L2 in W, defined by min(EV, EVSE)
11094    /// Relates to:
11095    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower_L2
11096    #[serde(rename = "maxChargePower_L2")]
11097    #[serde(default, skip_serializing_if = "Option::is_none")]
11098    pub max_charge_power_l2: Option<crate::types::Decimal>,
11099    /// Maximum charge power on phase L3 in W, defined by min(EV, EVSE)
11100    /// Relates to:
11101    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower_L3
11102    #[serde(rename = "maxChargePower_L3")]
11103    #[serde(default, skip_serializing_if = "Option::is_none")]
11104    pub max_charge_power_l3: Option<crate::types::Decimal>,
11105    /// Minimum discharge (injected) power in W, defined by max(EV, EVSE) at unity power factor. Value &gt;= 0. +
11106    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1. +
11107    /// It corresponds to the WMax attribute in the IEC 61850.
11108    /// It is usually equivalent to the rated apparent power of the EV when discharging (VAMax attribute in the IEC 61850).
11109    ///
11110    /// Relates to:
11111    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower
11112    #[serde(rename = "minDischargePower")]
11113    #[serde(default, skip_serializing_if = "Option::is_none")]
11114    pub min_discharge_power: Option<crate::types::Decimal>,
11115    /// Minimum discharge power on phase L2 in W, defined by max(EV, EVSE).  Value &gt;= 0.
11116    /// Relates to:
11117    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower_L2
11118    #[serde(rename = "minDischargePower_L2")]
11119    #[serde(default, skip_serializing_if = "Option::is_none")]
11120    pub min_discharge_power_l2: Option<crate::types::Decimal>,
11121    /// Minimum discharge power on phase L3 in W, defined by max(EV, EVSE).  Value &gt;= 0.
11122    /// Relates to:
11123    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower_L3
11124    #[serde(rename = "minDischargePower_L3")]
11125    #[serde(default, skip_serializing_if = "Option::is_none")]
11126    pub min_discharge_power_l3: Option<crate::types::Decimal>,
11127    /// Maximum discharge (injected) power in W, defined by min(EV, EVSE) at unity power factor.  Value &gt;= 0.
11128    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11129    /// Relates to:
11130    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePower
11131    #[serde(rename = "maxDischargePower")]
11132    #[serde(default, skip_serializing_if = "Option::is_none")]
11133    pub max_discharge_power: Option<crate::types::Decimal>,
11134    /// Maximum discharge power on phase L2 in W, defined by min(EV, EVSE).  Value &gt;= 0.
11135    /// Relates to:
11136    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePowe_L2
11137    #[serde(rename = "maxDischargePower_L2")]
11138    #[serde(default, skip_serializing_if = "Option::is_none")]
11139    pub max_discharge_power_l2: Option<crate::types::Decimal>,
11140    /// Maximum discharge power on phase L3 in W, defined by min(EV, EVSE).  Value &gt;= 0.
11141    /// Relates to:
11142    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePower_L3
11143    #[serde(rename = "maxDischargePower_L3")]
11144    #[serde(default, skip_serializing_if = "Option::is_none")]
11145    pub max_discharge_power_l3: Option<crate::types::Decimal>,
11146    /// Minimum charge current in A, defined by max(EV, EVSE)
11147    /// Relates to:
11148    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumChargeCurrent
11149    #[serde(rename = "minChargeCurrent")]
11150    #[serde(default, skip_serializing_if = "Option::is_none")]
11151    pub min_charge_current: Option<crate::types::Decimal>,
11152    /// Maximum charge current in A, defined by min(EV, EVSE)
11153    /// Relates to:
11154    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumChargeCurrent
11155    #[serde(rename = "maxChargeCurrent")]
11156    #[serde(default, skip_serializing_if = "Option::is_none")]
11157    pub max_charge_current: Option<crate::types::Decimal>,
11158    /// Minimum discharge current in A, defined by max(EV, EVSE).  Value &gt;= 0.
11159    /// Relates to:
11160    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumDischargeCurrent
11161    #[serde(rename = "minDischargeCurrent")]
11162    #[serde(default, skip_serializing_if = "Option::is_none")]
11163    pub min_discharge_current: Option<crate::types::Decimal>,
11164    /// Maximum discharge current in A, defined by min(EV, EVSE).  Value &gt;= 0.
11165    /// Relates to:
11166    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumDischargeCurrent
11167    #[serde(rename = "maxDischargeCurrent")]
11168    #[serde(default, skip_serializing_if = "Option::is_none")]
11169    pub max_discharge_current: Option<crate::types::Decimal>,
11170    /// Minimum voltage in V, defined by max(EV, EVSE)
11171    /// Relates to:
11172    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumVoltage
11173    #[serde(rename = "minVoltage")]
11174    #[serde(default, skip_serializing_if = "Option::is_none")]
11175    pub min_voltage: Option<crate::types::Decimal>,
11176    /// Maximum voltage in V, defined by min(EV, EVSE)
11177    /// Relates to:
11178    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumVoltage
11179    #[serde(rename = "maxVoltage")]
11180    #[serde(default, skip_serializing_if = "Option::is_none")]
11181    pub max_voltage: Option<crate::types::Decimal>,
11182    /// Energy to requested state of charge in Wh
11183    /// Relates to:
11184    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVTargetEnergyRequest
11185    #[serde(rename = "evTargetEnergyRequest")]
11186    #[serde(default, skip_serializing_if = "Option::is_none")]
11187    pub ev_target_energy_request: Option<crate::types::Decimal>,
11188    /// Energy to minimum allowed state of charge in Wh
11189    /// Relates to:
11190    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVMinimumEnergyRequest
11191    #[serde(rename = "evMinEnergyRequest")]
11192    #[serde(default, skip_serializing_if = "Option::is_none")]
11193    pub ev_min_energy_request: Option<crate::types::Decimal>,
11194    /// Energy to maximum state of charge in Wh
11195    /// Relates to:
11196    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVMaximumEnergyRequest
11197    #[serde(rename = "evMaxEnergyRequest")]
11198    #[serde(default, skip_serializing_if = "Option::is_none")]
11199    pub ev_max_energy_request: Option<crate::types::Decimal>,
11200    /// Energy (in Wh) to minimum state of charge for cycling (V2X) activity.
11201    /// Positive value means that current state of charge is below V2X range.
11202    /// Relates to:
11203    /// *ISO 15118-20*: Dynamic_SEReqControlModeType: EVMinimumV2XEnergyRequest
11204    #[serde(rename = "evMinV2XEnergyRequest")]
11205    #[serde(default, skip_serializing_if = "Option::is_none")]
11206    pub ev_min_v2_x_energy_request: Option<crate::types::Decimal>,
11207    /// Energy (in Wh) to maximum state of charge for cycling (V2X) activity.
11208    /// Negative value indicates that current state of charge is above V2X range.
11209    /// Relates to:
11210    /// *ISO 15118-20*: Dynamic_SEReqControlModeType: EVMaximumV2XEnergyRequest
11211    #[serde(rename = "evMaxV2XEnergyRequest")]
11212    #[serde(default, skip_serializing_if = "Option::is_none")]
11213    pub ev_max_v2_x_energy_request: Option<crate::types::Decimal>,
11214    /// Target state of charge at departure as percentage.
11215    /// Relates to:
11216    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: TargetSOC
11217    #[serde(rename = "targetSoC")]
11218    #[serde(default, skip_serializing_if = "Option::is_none")]
11219    pub target_so_c: Option<i32>,
11220    /// The `customData` member.
11221    #[serde(rename = "customData")]
11222    #[serde(default, skip_serializing_if = "Option::is_none")]
11223    pub custom_data: Option<crate::types::CustomData>,
11224}
11225
11226impl V2XChargingParameters {
11227    /// Creates an empty `V2XChargingParameters`. Every field of this type is optional.
11228    #[must_use]
11229    pub fn new() -> Self {
11230        Self::default()
11231    }
11232
11233    /// Sets the optional `minChargePower` field.
11234    #[must_use]
11235    pub fn with_min_charge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11236        self.min_charge_power = Some(value.into());
11237        self
11238    }
11239
11240    /// Sets the optional `minChargePower_L2` field.
11241    #[must_use]
11242    pub fn with_min_charge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11243        self.min_charge_power_l2 = Some(value.into());
11244        self
11245    }
11246
11247    /// Sets the optional `minChargePower_L3` field.
11248    #[must_use]
11249    pub fn with_min_charge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11250        self.min_charge_power_l3 = Some(value.into());
11251        self
11252    }
11253
11254    /// Sets the optional `maxChargePower` field.
11255    #[must_use]
11256    pub fn with_max_charge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11257        self.max_charge_power = Some(value.into());
11258        self
11259    }
11260
11261    /// Sets the optional `maxChargePower_L2` field.
11262    #[must_use]
11263    pub fn with_max_charge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11264        self.max_charge_power_l2 = Some(value.into());
11265        self
11266    }
11267
11268    /// Sets the optional `maxChargePower_L3` field.
11269    #[must_use]
11270    pub fn with_max_charge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11271        self.max_charge_power_l3 = Some(value.into());
11272        self
11273    }
11274
11275    /// Sets the optional `minDischargePower` field.
11276    #[must_use]
11277    pub fn with_min_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11278        self.min_discharge_power = Some(value.into());
11279        self
11280    }
11281
11282    /// Sets the optional `minDischargePower_L2` field.
11283    #[must_use]
11284    pub fn with_min_discharge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11285        self.min_discharge_power_l2 = Some(value.into());
11286        self
11287    }
11288
11289    /// Sets the optional `minDischargePower_L3` field.
11290    #[must_use]
11291    pub fn with_min_discharge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11292        self.min_discharge_power_l3 = Some(value.into());
11293        self
11294    }
11295
11296    /// Sets the optional `maxDischargePower` field.
11297    #[must_use]
11298    pub fn with_max_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11299        self.max_discharge_power = Some(value.into());
11300        self
11301    }
11302
11303    /// Sets the optional `maxDischargePower_L2` field.
11304    #[must_use]
11305    pub fn with_max_discharge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11306        self.max_discharge_power_l2 = Some(value.into());
11307        self
11308    }
11309
11310    /// Sets the optional `maxDischargePower_L3` field.
11311    #[must_use]
11312    pub fn with_max_discharge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11313        self.max_discharge_power_l3 = Some(value.into());
11314        self
11315    }
11316
11317    /// Sets the optional `minChargeCurrent` field.
11318    #[must_use]
11319    pub fn with_min_charge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11320        self.min_charge_current = Some(value.into());
11321        self
11322    }
11323
11324    /// Sets the optional `maxChargeCurrent` field.
11325    #[must_use]
11326    pub fn with_max_charge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11327        self.max_charge_current = Some(value.into());
11328        self
11329    }
11330
11331    /// Sets the optional `minDischargeCurrent` field.
11332    #[must_use]
11333    pub fn with_min_discharge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11334        self.min_discharge_current = Some(value.into());
11335        self
11336    }
11337
11338    /// Sets the optional `maxDischargeCurrent` field.
11339    #[must_use]
11340    pub fn with_max_discharge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11341        self.max_discharge_current = Some(value.into());
11342        self
11343    }
11344
11345    /// Sets the optional `minVoltage` field.
11346    #[must_use]
11347    pub fn with_min_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11348        self.min_voltage = Some(value.into());
11349        self
11350    }
11351
11352    /// Sets the optional `maxVoltage` field.
11353    #[must_use]
11354    pub fn with_max_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11355        self.max_voltage = Some(value.into());
11356        self
11357    }
11358
11359    /// Sets the optional `evTargetEnergyRequest` field.
11360    #[must_use]
11361    pub fn with_ev_target_energy_request(
11362        mut self,
11363        value: impl Into<crate::types::Decimal>,
11364    ) -> Self {
11365        self.ev_target_energy_request = Some(value.into());
11366        self
11367    }
11368
11369    /// Sets the optional `evMinEnergyRequest` field.
11370    #[must_use]
11371    pub fn with_ev_min_energy_request(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11372        self.ev_min_energy_request = Some(value.into());
11373        self
11374    }
11375
11376    /// Sets the optional `evMaxEnergyRequest` field.
11377    #[must_use]
11378    pub fn with_ev_max_energy_request(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11379        self.ev_max_energy_request = Some(value.into());
11380        self
11381    }
11382
11383    /// Sets the optional `evMinV2XEnergyRequest` field.
11384    #[must_use]
11385    pub fn with_ev_min_v2_x_energy_request(
11386        mut self,
11387        value: impl Into<crate::types::Decimal>,
11388    ) -> Self {
11389        self.ev_min_v2_x_energy_request = Some(value.into());
11390        self
11391    }
11392
11393    /// Sets the optional `evMaxV2XEnergyRequest` field.
11394    #[must_use]
11395    pub fn with_ev_max_v2_x_energy_request(
11396        mut self,
11397        value: impl Into<crate::types::Decimal>,
11398    ) -> Self {
11399        self.ev_max_v2_x_energy_request = Some(value.into());
11400        self
11401    }
11402
11403    /// Sets the optional `targetSoC` field.
11404    #[must_use]
11405    pub fn with_target_so_c(mut self, value: i32) -> Self {
11406        self.target_so_c = Some(value);
11407        self
11408    }
11409
11410    /// Sets the optional `customData` field.
11411    #[must_use]
11412    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11413        self.custom_data = Some(value);
11414        self
11415    }
11416}
11417
11418impl Validate for V2XChargingParameters {
11419    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11420        path.push_key("targetSoC");
11421        if let Some(value) = &self.target_so_c {
11422            validate::int_range(i64::from(*value), Some(0.0), Some(100.0), path, out);
11423        }
11424        path.pop();
11425        path.push_key("customData");
11426        if let Some(value) = &self.custom_data {
11427            Validate::validate_at(value, path, out);
11428        }
11429        path.pop();
11430    }
11431}
11432
11433/// *(2.1)* A point of a frequency-watt curve.
11434///
11435/// The OCPP 2.1 `V2XFreqWattPoint` data type.
11436#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11437pub struct V2XFreqWattPoint {
11438    /// Net frequency in Hz.
11439    pub frequency: crate::types::Decimal,
11440    /// Power in W to charge (positive) or discharge (negative) at specified frequency.
11441    pub power: crate::types::Decimal,
11442    /// The `customData` member.
11443    #[serde(rename = "customData")]
11444    #[serde(default, skip_serializing_if = "Option::is_none")]
11445    pub custom_data: Option<crate::types::CustomData>,
11446}
11447
11448impl V2XFreqWattPoint {
11449    /// Creates a `V2XFreqWattPoint` from its required fields.
11450    #[must_use]
11451    pub fn new(
11452        frequency: impl Into<crate::types::Decimal>,
11453        power: impl Into<crate::types::Decimal>,
11454    ) -> Self {
11455        Self {
11456            frequency: frequency.into(),
11457            power: power.into(),
11458            custom_data: None,
11459        }
11460    }
11461
11462    /// Sets the optional `customData` field.
11463    #[must_use]
11464    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11465        self.custom_data = Some(value);
11466        self
11467    }
11468}
11469
11470impl Validate for V2XFreqWattPoint {
11471    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11472        path.push_key("customData");
11473        if let Some(value) = &self.custom_data {
11474            Validate::validate_at(value, path, out);
11475        }
11476        path.pop();
11477    }
11478}
11479
11480/// *(2.1)* A point of a signal-watt curve.
11481///
11482/// The OCPP 2.1 `V2XSignalWattPoint` data type.
11483#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11484pub struct V2XSignalWattPoint {
11485    /// Signal value from an AFRRSignalRequest.
11486    pub signal: i32,
11487    /// Power in W to charge (positive) or discharge (negative) at specified frequency.
11488    pub power: crate::types::Decimal,
11489    /// The `customData` member.
11490    #[serde(rename = "customData")]
11491    #[serde(default, skip_serializing_if = "Option::is_none")]
11492    pub custom_data: Option<crate::types::CustomData>,
11493}
11494
11495impl V2XSignalWattPoint {
11496    /// Creates a `V2XSignalWattPoint` from its required fields.
11497    #[must_use]
11498    pub fn new(signal: i32, power: impl Into<crate::types::Decimal>) -> Self {
11499        Self {
11500            signal,
11501            power: power.into(),
11502            custom_data: None,
11503        }
11504    }
11505
11506    /// Sets the optional `customData` field.
11507    #[must_use]
11508    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11509        self.custom_data = Some(value);
11510        self
11511    }
11512}
11513
11514impl Validate for V2XSignalWattPoint {
11515    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11516        path.push_key("customData");
11517        if let Some(value) = &self.custom_data {
11518            Validate::validate_at(value, path, out);
11519        }
11520        path.pop();
11521    }
11522}
11523
11524/// VPN Configuration settings
11525///
11526/// The OCPP 2.1 `VPN` data type.
11527#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11528pub struct VPN {
11529    /// VPN Server Address
11530    pub server: String,
11531    /// VPN User
11532    pub user: String,
11533    /// *(2.1)* VPN Password.
11534    pub password: String,
11535    /// VPN shared secret.
11536    pub key: String,
11537    /// The `type` member.
11538    pub r#type: VPNEnum,
11539    /// VPN group.
11540    #[serde(default, skip_serializing_if = "Option::is_none")]
11541    pub group: Option<String>,
11542    /// The `customData` member.
11543    #[serde(rename = "customData")]
11544    #[serde(default, skip_serializing_if = "Option::is_none")]
11545    pub custom_data: Option<crate::types::CustomData>,
11546}
11547
11548impl VPN {
11549    /// Creates a `VPN` from its required fields.
11550    #[must_use]
11551    pub fn new(
11552        server: impl Into<String>,
11553        user: impl Into<String>,
11554        password: impl Into<String>,
11555        key: impl Into<String>,
11556        r#type: VPNEnum,
11557    ) -> Self {
11558        Self {
11559            server: server.into(),
11560            user: user.into(),
11561            password: password.into(),
11562            key: key.into(),
11563            r#type,
11564            group: None,
11565            custom_data: None,
11566        }
11567    }
11568
11569    /// Sets the optional `group` field.
11570    #[must_use]
11571    pub fn with_group(mut self, value: impl Into<String>) -> Self {
11572        self.group = Some(value.into());
11573        self
11574    }
11575
11576    /// Sets the optional `customData` field.
11577    #[must_use]
11578    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11579        self.custom_data = Some(value);
11580        self
11581    }
11582}
11583
11584impl Validate for VPN {
11585    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11586        path.push_key("server");
11587        validate::string(self.server.as_str(), None, Some(2000), path, out);
11588        path.pop();
11589        path.push_key("user");
11590        validate::string(self.user.as_str(), None, Some(50), path, out);
11591        path.pop();
11592        path.push_key("password");
11593        validate::string(self.password.as_str(), None, Some(64), path, out);
11594        path.pop();
11595        path.push_key("key");
11596        validate::string(self.key.as_str(), None, Some(255), path, out);
11597        path.pop();
11598        path.push_key("type");
11599        Validate::validate_at(&self.r#type, path, out);
11600        path.pop();
11601        path.push_key("group");
11602        if let Some(value) = &self.group {
11603            validate::string(value.as_str(), None, Some(50), path, out);
11604        }
11605        path.pop();
11606        path.push_key("customData");
11607        if let Some(value) = &self.custom_data {
11608            Validate::validate_at(value, path, out);
11609        }
11610        path.pop();
11611    }
11612}
11613
11614/// Reference key to a component-variable.
11615///
11616/// The OCPP 2.1 `Variable` data type.
11617#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11618pub struct Variable {
11619    /// 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.
11620    pub name: String,
11621    /// Name of instance in case the variable exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
11622    #[serde(default, skip_serializing_if = "Option::is_none")]
11623    pub instance: Option<String>,
11624    /// The `customData` member.
11625    #[serde(rename = "customData")]
11626    #[serde(default, skip_serializing_if = "Option::is_none")]
11627    pub custom_data: Option<crate::types::CustomData>,
11628}
11629
11630impl Variable {
11631    /// Creates a `Variable` from its required fields.
11632    #[must_use]
11633    pub fn new(name: impl Into<String>) -> Self {
11634        Self {
11635            name: name.into(),
11636            instance: None,
11637            custom_data: None,
11638        }
11639    }
11640
11641    /// Sets the optional `instance` field.
11642    #[must_use]
11643    pub fn with_instance(mut self, value: impl Into<String>) -> Self {
11644        self.instance = Some(value.into());
11645        self
11646    }
11647
11648    /// Sets the optional `customData` field.
11649    #[must_use]
11650    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11651        self.custom_data = Some(value);
11652        self
11653    }
11654}
11655
11656impl Validate for Variable {
11657    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11658        path.push_key("name");
11659        validate::string(self.name.as_str(), None, Some(50), path, out);
11660        path.pop();
11661        path.push_key("instance");
11662        if let Some(value) = &self.instance {
11663            validate::string(value.as_str(), None, Some(50), path, out);
11664        }
11665        path.pop();
11666        path.push_key("customData");
11667        if let Some(value) = &self.custom_data {
11668            Validate::validate_at(value, path, out);
11669        }
11670        path.pop();
11671    }
11672}
11673
11674/// Attribute data of a variable.
11675///
11676/// The OCPP 2.1 `VariableAttribute` data type.
11677#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11678pub struct VariableAttribute {
11679    /// The `type` member.
11680    #[serde(default, skip_serializing_if = "Option::is_none")]
11681    pub r#type: Option<Attribute>,
11682    /// Value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
11683    ///
11684    /// 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.
11685    #[serde(default, skip_serializing_if = "Option::is_none")]
11686    pub value: Option<String>,
11687    /// The `mutability` member.
11688    #[serde(default, skip_serializing_if = "Option::is_none")]
11689    pub mutability: Option<Mutability>,
11690    /// If true, value will be persistent across system reboots or power down. Default when omitted is false.
11691    /// Schema default: `false`.
11692    #[serde(default, skip_serializing_if = "Option::is_none")]
11693    pub persistent: Option<bool>,
11694    /// If true, value that will never be changed by the Charging Station at runtime. Default when omitted is false.
11695    /// Schema default: `false`.
11696    #[serde(default, skip_serializing_if = "Option::is_none")]
11697    pub constant: Option<bool>,
11698    /// The `customData` member.
11699    #[serde(rename = "customData")]
11700    #[serde(default, skip_serializing_if = "Option::is_none")]
11701    pub custom_data: Option<crate::types::CustomData>,
11702}
11703
11704impl VariableAttribute {
11705    /// Creates an empty `VariableAttribute`. Every field of this type is optional.
11706    #[must_use]
11707    pub fn new() -> Self {
11708        Self::default()
11709    }
11710
11711    /// Sets the optional `type` field.
11712    #[must_use]
11713    pub fn with_type(mut self, value: Attribute) -> Self {
11714        self.r#type = Some(value);
11715        self
11716    }
11717
11718    /// Sets the optional `value` field.
11719    #[must_use]
11720    pub fn with_value(mut self, value: impl Into<String>) -> Self {
11721        self.value = Some(value.into());
11722        self
11723    }
11724
11725    /// Sets the optional `mutability` field.
11726    #[must_use]
11727    pub fn with_mutability(mut self, value: Mutability) -> Self {
11728        self.mutability = Some(value);
11729        self
11730    }
11731
11732    /// Sets the optional `persistent` field.
11733    #[must_use]
11734    pub fn with_persistent(mut self, value: bool) -> Self {
11735        self.persistent = Some(value);
11736        self
11737    }
11738
11739    /// Sets the optional `constant` field.
11740    #[must_use]
11741    pub fn with_constant(mut self, value: bool) -> Self {
11742        self.constant = Some(value);
11743        self
11744    }
11745
11746    /// Sets the optional `customData` field.
11747    #[must_use]
11748    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11749        self.custom_data = Some(value);
11750        self
11751    }
11752}
11753
11754impl Validate for VariableAttribute {
11755    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11756        path.push_key("type");
11757        if let Some(value) = &self.r#type {
11758            Validate::validate_at(value, path, out);
11759        }
11760        path.pop();
11761        path.push_key("value");
11762        if let Some(value) = &self.value {
11763            validate::string(value.as_str(), None, Some(2500), path, out);
11764        }
11765        path.pop();
11766        path.push_key("mutability");
11767        if let Some(value) = &self.mutability {
11768            Validate::validate_at(value, path, out);
11769        }
11770        path.pop();
11771        path.push_key("customData");
11772        if let Some(value) = &self.custom_data {
11773            Validate::validate_at(value, path, out);
11774        }
11775        path.pop();
11776    }
11777}
11778
11779/// Fixed read-only parameters of a variable.
11780///
11781/// The OCPP 2.1 `VariableCharacteristics` data type.
11782#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11783pub struct VariableCharacteristics {
11784    /// The `dataType` member.
11785    #[serde(rename = "dataType")]
11786    pub data_type: Data,
11787    /// Flag indicating if this variable supports monitoring.
11788    #[serde(rename = "supportsMonitoring")]
11789    pub supports_monitoring: bool,
11790    /// Unit of the variable. When the transmitted value has a unit, this field SHALL be included.
11791    #[serde(default, skip_serializing_if = "Option::is_none")]
11792    pub unit: Option<String>,
11793    /// Minimum possible value of this variable.
11794    #[serde(rename = "minLimit")]
11795    #[serde(default, skip_serializing_if = "Option::is_none")]
11796    pub min_limit: Option<crate::types::Decimal>,
11797    /// 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.
11798    #[serde(rename = "maxLimit")]
11799    #[serde(default, skip_serializing_if = "Option::is_none")]
11800    pub max_limit: Option<crate::types::Decimal>,
11801    /// *(2.1)* Maximum number of elements from _valuesList_ that are supported as _attributeValue_.
11802    #[serde(rename = "maxElements")]
11803    #[serde(default, skip_serializing_if = "Option::is_none")]
11804    pub max_elements: Option<i32>,
11805    /// Mandatory when _dataType_ = OptionList, MemberList or SequenceList. In that case _valuesList_ specifies the allowed values for the type.
11806    ///
11807    /// The length of this field can be limited by DeviceDataCtrlr.ConfigurationValueSize.
11808    ///
11809    /// * OptionList: The (Actual) Variable value must be a single value from the reported (CSV) enumeration list.
11810    ///
11811    /// * MemberList: The (Actual) Variable value  may be an (unordered) (sub-)set of the reported (CSV) valid values list.
11812    ///
11813    /// * SequenceList: The (Actual) Variable value  may be an ordered (priority, etc)  (sub-)set of the reported (CSV) valid values.
11814    ///
11815    /// This is a comma separated list.
11816    ///
11817    /// The Configuration Variable &lt;&lt;configkey-configuration-value-size,ConfigurationValueSize&gt;&gt; can be used to limit SetVariableData.attributeValue and VariableCharacteristics.valuesList. The max size of these values will always remain equal.
11818    #[serde(rename = "valuesList")]
11819    #[serde(default, skip_serializing_if = "Option::is_none")]
11820    pub values_list: Option<String>,
11821    /// The `customData` member.
11822    #[serde(rename = "customData")]
11823    #[serde(default, skip_serializing_if = "Option::is_none")]
11824    pub custom_data: Option<crate::types::CustomData>,
11825}
11826
11827impl VariableCharacteristics {
11828    /// Creates a `VariableCharacteristics` from its required fields.
11829    #[must_use]
11830    pub fn new(data_type: Data, supports_monitoring: bool) -> Self {
11831        Self {
11832            data_type,
11833            supports_monitoring,
11834            unit: None,
11835            min_limit: None,
11836            max_limit: None,
11837            max_elements: None,
11838            values_list: None,
11839            custom_data: None,
11840        }
11841    }
11842
11843    /// Sets the optional `unit` field.
11844    #[must_use]
11845    pub fn with_unit(mut self, value: impl Into<String>) -> Self {
11846        self.unit = Some(value.into());
11847        self
11848    }
11849
11850    /// Sets the optional `minLimit` field.
11851    #[must_use]
11852    pub fn with_min_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11853        self.min_limit = Some(value.into());
11854        self
11855    }
11856
11857    /// Sets the optional `maxLimit` field.
11858    #[must_use]
11859    pub fn with_max_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11860        self.max_limit = Some(value.into());
11861        self
11862    }
11863
11864    /// Sets the optional `maxElements` field.
11865    #[must_use]
11866    pub fn with_max_elements(mut self, value: i32) -> Self {
11867        self.max_elements = Some(value);
11868        self
11869    }
11870
11871    /// Sets the optional `valuesList` field.
11872    #[must_use]
11873    pub fn with_values_list(mut self, value: impl Into<String>) -> Self {
11874        self.values_list = Some(value.into());
11875        self
11876    }
11877
11878    /// Sets the optional `customData` field.
11879    #[must_use]
11880    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11881        self.custom_data = Some(value);
11882        self
11883    }
11884}
11885
11886impl Validate for VariableCharacteristics {
11887    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11888        path.push_key("dataType");
11889        Validate::validate_at(&self.data_type, path, out);
11890        path.pop();
11891        path.push_key("unit");
11892        if let Some(value) = &self.unit {
11893            validate::string(value.as_str(), None, Some(16), path, out);
11894        }
11895        path.pop();
11896        path.push_key("maxElements");
11897        if let Some(value) = &self.max_elements {
11898            validate::int_range(i64::from(*value), Some(1.0), None, path, out);
11899        }
11900        path.pop();
11901        path.push_key("valuesList");
11902        if let Some(value) = &self.values_list {
11903            validate::string(value.as_str(), None, Some(1000), path, out);
11904        }
11905        path.pop();
11906        path.push_key("customData");
11907        if let Some(value) = &self.custom_data {
11908            Validate::validate_at(value, path, out);
11909        }
11910        path.pop();
11911    }
11912}
11913
11914/// A monitoring setting for a variable.
11915///
11916/// The OCPP 2.1 `VariableMonitoring` data type.
11917#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11918pub struct VariableMonitoring {
11919    /// Identifies the monitor.
11920    pub id: i32,
11921    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction.
11922    pub transaction: bool,
11923    /// Value for threshold or delta monitoring.
11924    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
11925    pub value: crate::types::Decimal,
11926    /// The `type` member.
11927    pub r#type: Monitor,
11928    /// 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.
11929    ///
11930    /// The severity levels have the following meaning: +
11931    /// *0-Danger* +
11932    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
11933    /// *1-Hardware Failure* +
11934    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
11935    /// *2-System Failure* +
11936    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
11937    /// *3-Critical* +
11938    /// Indicates a critical error. Action is required. +
11939    /// *4-Error* +
11940    /// Indicates a non-urgent error. Action is required. +
11941    /// *5-Alert* +
11942    /// Indicates an alert event. Default severity for any type of monitoring event.  +
11943    /// *6-Warning* +
11944    /// Indicates a warning event. Action may be required. +
11945    /// *7-Notice* +
11946    /// Indicates an unusual event. No immediate action is required. +
11947    /// *8-Informational* +
11948    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
11949    /// *9-Debug* +
11950    /// Indicates information useful to developers for debugging, not useful during operations.
11951    pub severity: i32,
11952    /// The `eventNotificationType` member.
11953    #[serde(rename = "eventNotificationType")]
11954    pub event_notification_type: EventNotification,
11955    /// The `customData` member.
11956    #[serde(rename = "customData")]
11957    #[serde(default, skip_serializing_if = "Option::is_none")]
11958    pub custom_data: Option<crate::types::CustomData>,
11959}
11960
11961impl VariableMonitoring {
11962    /// Creates a `VariableMonitoring` from its required fields.
11963    #[must_use]
11964    pub fn new(
11965        id: i32,
11966        transaction: bool,
11967        value: impl Into<crate::types::Decimal>,
11968        r#type: Monitor,
11969        severity: i32,
11970        event_notification_type: EventNotification,
11971    ) -> Self {
11972        Self {
11973            id,
11974            transaction,
11975            value: value.into(),
11976            r#type,
11977            severity,
11978            event_notification_type,
11979            custom_data: None,
11980        }
11981    }
11982
11983    /// Sets the optional `customData` field.
11984    #[must_use]
11985    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11986        self.custom_data = Some(value);
11987        self
11988    }
11989}
11990
11991impl Validate for VariableMonitoring {
11992    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11993        path.push_key("id");
11994        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
11995        path.pop();
11996        path.push_key("type");
11997        Validate::validate_at(&self.r#type, path, out);
11998        path.pop();
11999        path.push_key("severity");
12000        validate::int_range(i64::from(self.severity), Some(0.0), None, path, out);
12001        path.pop();
12002        path.push_key("eventNotificationType");
12003        Validate::validate_at(&self.event_notification_type, path, out);
12004        path.pop();
12005        path.push_key("customData");
12006        if let Some(value) = &self.custom_data {
12007            Validate::validate_at(value, path, out);
12008        }
12009        path.pop();
12010    }
12011}
12012
12013/// The OCPP 2.1 `VoltageParams` data type.
12014#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
12015pub struct VoltageParams {
12016    /// EN 50549-1 chapter 4.9.3.4
12017    ///     Voltage threshold for the 10 min time window mean value monitoring.
12018    ///     The 10 min mean is recalculated up to every 3 s.
12019    ///     If the present voltage is above this threshold for more than the time defined by _hv10MinMeanValue_, the EV must trip.
12020    ///     This value is mandatory if _hv10MinMeanTripDelay_ is set.
12021    #[serde(rename = "hv10MinMeanValue")]
12022    #[serde(default, skip_serializing_if = "Option::is_none")]
12023    pub hv10_min_mean_value: Option<crate::types::Decimal>,
12024    /// Time for which the voltage is allowed to stay above the 10 min mean value.
12025    ///     After this time, the EV must trip.
12026    ///     This value is mandatory if OverVoltageMeanValue10min is set.
12027    #[serde(rename = "hv10MinMeanTripDelay")]
12028    #[serde(default, skip_serializing_if = "Option::is_none")]
12029    pub hv10_min_mean_trip_delay: Option<crate::types::Decimal>,
12030    /// The `powerDuringCessation` member.
12031    #[serde(rename = "powerDuringCessation")]
12032    #[serde(default, skip_serializing_if = "Option::is_none")]
12033    pub power_during_cessation: Option<PowerDuringCessation>,
12034    /// The `customData` member.
12035    #[serde(rename = "customData")]
12036    #[serde(default, skip_serializing_if = "Option::is_none")]
12037    pub custom_data: Option<crate::types::CustomData>,
12038}
12039
12040impl VoltageParams {
12041    /// Creates an empty `VoltageParams`. Every field of this type is optional.
12042    #[must_use]
12043    pub fn new() -> Self {
12044        Self::default()
12045    }
12046
12047    /// Sets the optional `hv10MinMeanValue` field.
12048    #[must_use]
12049    pub fn with_hv10_min_mean_value(mut self, value: impl Into<crate::types::Decimal>) -> Self {
12050        self.hv10_min_mean_value = Some(value.into());
12051        self
12052    }
12053
12054    /// Sets the optional `hv10MinMeanTripDelay` field.
12055    #[must_use]
12056    pub fn with_hv10_min_mean_trip_delay(
12057        mut self,
12058        value: impl Into<crate::types::Decimal>,
12059    ) -> Self {
12060        self.hv10_min_mean_trip_delay = Some(value.into());
12061        self
12062    }
12063
12064    /// Sets the optional `powerDuringCessation` field.
12065    #[must_use]
12066    pub fn with_power_during_cessation(mut self, value: PowerDuringCessation) -> Self {
12067        self.power_during_cessation = Some(value);
12068        self
12069    }
12070
12071    /// Sets the optional `customData` field.
12072    #[must_use]
12073    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12074        self.custom_data = Some(value);
12075        self
12076    }
12077}
12078
12079impl Validate for VoltageParams {
12080    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12081        path.push_key("powerDuringCessation");
12082        if let Some(value) = &self.power_during_cessation {
12083            Validate::validate_at(value, path, out);
12084        }
12085        path.pop();
12086        path.push_key("customData");
12087        if let Some(value) = &self.custom_data {
12088            Validate::validate_at(value, path, out);
12089        }
12090        path.pop();
12091    }
12092}